src/Template/TemplateUtil.php
public function getTemplate(string $name, string $format = 'twig'): string
    {
        // Check for a theme folder
        if ($this->containerUtil->isFrontend()) {
            /* @var PageModel $objPage */
            global $objPage;

            if ('' != $objPage->templateGroup) {
                if (\Validator::isInsecurePath($objPage->templateGroup)) {
                    throw new \RuntimeException('Invalid path '.$objPage->templateGroup);
                }

                $templates = $this->findTemplates($this->containerUtil->getProjectDir().'/'.$objPage->templateGroup, $name, $format);

                if (!empty($templates)) {
                    return reset($templates);
                }
            }
        }

        if (!isset(self::$twigFiles[$name])) {
            throw new \Twig_Error_Loader(sprintf('Unable to find template "%s".', $name));
        }

        return self::$twigFiles[$name];
    }
public function getTemplate(string $name, string $format = 'twig'): string
    {
        // Check for a theme folder
        if ($this->containerUtil->isFrontend()) {
            /* @var PageModel $objPage */
            global $objPage;

            if ('' != $objPage->templateGroup) {
                if (\Validator::isInsecurePath($objPage->templateGroup)) {
                    throw new \RuntimeException('Invalid path '.$objPage->templateGroup);
                }

                $templates = $this->findTemplates($this->containerUtil->getProjectDir().'/'.$objPage->templateGroup, $name, $format);

                if (!empty($templates)) {
                    return reset($templates);
                }
            }
        }

        if (!isset(self::$twigFiles[$name])) {
            throw new \Twig_Error_Loader(sprintf('Unable to find template "%s".', $name));
        }

        return self::$twigFiles[$name];
    }
public function getTemplate ( string $ name , string $ format = 'twig' ) : string { // Check for a theme folder if ( $ this -> containerUtil -> isFrontend ( ) ) { /* @var PageModel $objPage */ global $ objPage ; if ( '' != $ objPage -> templateGroup ) { if ( \ Validator :: isInsecurePath ( $ objPage -> templateGroup ) ) { throw new \ RuntimeException ( 'Invalid path ' . $ objPage -> templateGroup ) ; } $ templates = $ this -> findTemplates ( $ this -> containerUtil -> getProjectDir ( ) . '/' . $ objPage -> templateGroup , $ name , $ format ) ; if ( ! empty ( $ templates ) ) { return reset ( $ templates ) ; } } } if ( ! isset ( self :: $ twigFiles [ $ name ] ) ) { throw new \ Twig_Error_Loader ( sprintf ( 'Unable to find template "%s".' , $ name ) ) ; } return self :: $ twigFiles [ $ name ] ; }
Find a particular template file and return its path.

@param string $name   The name of the template
@param string $format The file extension

@throws \InvalidArgumentException If $strFormat is unknown
@throws \RuntimeException         If the template group folder is insecure
@throws \Twig_Error_Loader

@return string The path to the template file
Find a particular template file and return its path .