Get the appropriate template to use for the named sub-template, or null if none are appropriate

@param string $subtemplate Sub-template to use

@return array|null
435184
protected function getSubtemplateFor($subtemplate)
    {
        // Get explicit subtemplate name
        if (isset($this->subTemplates[$subtemplate])) {
            return $this->subTemplates[$subtemplate];
        }

        // Don't apply sub-templates if type is already specified (e.g. 'Includes')
        if (isset($this->templates['type'])) {
            return null;
        }

        // Filter out any other typed templates as we can only add, not change type
        $templates = array_filter(
            (array)$this->templates,
            function ($template) {
                return !isset($template['type']);
            }
        );
        if (empty($templates)) {
            return null;
        }

        // Set type to subtemplate
        $templates['type'] = $subtemplate;
        return $templates;
    }
338550
public function getTemplate()
    {
        if (is_null($this->_template)) {
            $this->_template = new \Slick\Form\Template\SelectMultiple();
        }
        return $this->_template;
    }
529903
public static function getTemplates($template, $format = 'html5')
	{
		$templates = array();

		try {
			$theme = \ThemeModel::findAll(array('order'=>'name'));
		}
		catch (\Exception $e) {
			$theme = null;
		}

		while ($theme && $theme->next()) {
			if ($theme->templates != '') {
				if (file_exists(TL_ROOT . '/' . $theme->templates . '/' . $template . '.' . $format)) {
					$templates[] = TL_ROOT . '/' . $theme->templates . '/' . $template . '.' . $format;
				}
			}
		}

		if (file_exists(TL_ROOT . '/templates/' . $template . '.' . $format)) {
			$templates[] = TL_ROOT . '/templates/' . $template . '.' . $format;
		}

		// Add templates of inactive themes to the bottom of the templates array
		$allFiles = glob(TL_ROOT . '/templates/*/' . $template . '.' . $format) ?: array();
		foreach ($allFiles as $file) {
			if (!in_array($file, $templates)) {
				$templates[] = $file;
			}
		}

		if (count($templates)) {
			return $templates;
		}

		return array(parent::getTemplate($template, $format));
	}
1171284
protected function getPathToTemplates($template = null)
    {
        $template = Helpers::getPathWithSlash($template ?: Config::getDefaultTemplateName());
        $basePath = base_path(Config::getTemplatesPath() . $template);
        $path = Helpers::getPathWithSlash($basePath);

        if (!$this->isFileExists($path)) {
            throw new Exception('Invalid template. Make sure the following path exists: "' . $path . '"');
        }

        return $path;
    }
1050836
protected function getTemplate($template)
    {
        $template = config("imagecache.templates.{$template}");

        switch (true) {
            // closure template found
            case is_callable($template):
                return $template;

            // filter template found
            case class_exists($template):
                return new $template;

            default:
                // template not found
                abort(404);
                break;
        }
    }
579684
protected function fetchSubTemplateName()
    {
        if (!empty($this->subTemplate)) return;

        $className = get_called_class();

        if (mb_strpos($className, 'Controllers') === false)
        {
            $this->system->log()->notice("Fully qualified Controller class name does not contain 'Controllers' so we can't automatically discern the sub template name.");
            return;
        }

        $classSegments = explode('\\', $className);

        $templateName = '';
        while (($segment = array_pop($classSegments)) !== 'Controllers')
        {
            if (empty($templateName))
            {
                $templateName = strtolower($segment) . '.php';
            }
            else
            {
                $templateName = strtolower($segment) . DIRECTORY_SEPARATOR . $templateName;
            }
        }

        $this->subTemplate = 'pages' . DIRECTORY_SEPARATOR . $templateName;
    }
591287
protected function _getTemplate()
    {
        if (is_null($this->_template)) {
            foreach ($this->_map as $method => $className) {
                if ($this->_sql instanceof $className) {
                    $this->_template = $this->$method();
                    break;
                }
            }
        }
        return $this->_template;
    }
1218880
public function template($template = false, $layout = null)
    {
        if ($template === false) {
            return [
                'template' => $this->_template,
                'layout' => $this->_layout,
            ];
        }
        $this->_template = $template;
        if ($layout !== null) {
            $this->_layout = $layout;
        }

        return $this;
    }
481633
public function load($template)
    {
        $template = $this->findFirstExistingTemplate($template);
        if (!isset($this->loadedTemplates[ $template ])) {
            $class = $this->getTemplateClassName($template);

            $this->loadedTemplates[ $template ] = new $class($this);
            if (!$this->loadedTemplates[ $template ] instanceof Template) {
                throw new TemplatingException("The compiled class for {$template} is invalid");
            }
        }

        return $this->loadedTemplates[ $template ];
    }
1257446
public function getTemplate() : ?string 
    {
        if ( ! $this->hasTemplate()) {
            $this->setTemplate($this->getDefaultTemplate());
        }
        return $this->template;
    }
837038
public function getTemplateQuery($template)
    {
        if(isset($this->template[$template]))
        {
            return $this->template[$template];
        }

        return FALSE;
    }
709918
protected function getTemplates()
    {
        if (empty($this->templates)) {
            $this->templates[] = $this->environment->loadTemplate($this::DEFAULT_TEMPLATE);
        }

        return $this->templates;
    }
714628
public function getListTemplate()
    {
        if (null === $this->listTemplate) {
            $template = rtrim($this->getTemplatePrefix(), '/') . '/' . $this->getListSuffix();
            $this->setListTemplate($template);
        }

        return $this->listTemplate;
    }
88896
protected function generateSitemapLinkTemplate($template)
    {
        $ret = null;

        // Set link template for index file
        $linkConf = array(
            'parameter' => $this->sitemapDir . '/' . $template,
        );

        if (strlen($GLOBALS['TSFE']->baseUrl) > 1) {
            $ret = $GLOBALS['TSFE']->baseUrlWrap($GLOBALS['TSFE']->cObj->typoLink_URL($linkConf));
        } elseif (strlen($GLOBALS['TSFE']->absRefPrefix) > 1) {
            $ret = $GLOBALS['TSFE']->absRefPrefix . $GLOBALS['TSFE']->cObj->typoLink_URL($linkConf);
        } else {
            $ret = $GLOBALS['TSFE']->cObj->typoLink_URL($linkConf);
        }

        return $ret;
    }
522291
private function loadTemplate($template)
    {
        if (!array_key_exists($template, $this->templateCache)) {
            $this->templateCache[$template] = $this->twig->loadTemplate($template);
        }

        return $this->templateCache[$template];
    }
1204678
public function getTemplateRelativePath($template)
	{
	    $rootPath = Config::getRootPath();
	    return str_replace($rootPath, '', $this->getTemplatePath()) . $this->_getRelativeTemplate($template) . $this->getSuffix();
	}
349883
protected function getTemplate(string $template) : string
    {
        if (isset($this->templates[$template])) {
            return $this->templates[$template];
        }

        $file = $this->basePath . $template;

        if (file_exists($file)) {
            $this->templates[$template] = file_get_contents($file);
        }

        if (!isset($this->templates[$template]) || !$this->templates[$template]) {
            unset($this->templates[$template]);
            throw new FileSystemException("Template $template not found");
        }

        return $this->templates[$template];
    }