Opens an existing template from the index page
@return array
764821
public function index_onOpenTemplate()
    {
        $this->validateRequestTheme();

        $type = Request::input('type');
        $template = $this->loadTemplate($type, Request::input('path'));
        $widget = $this->makeTemplateFormWidget($type, $template);

        $this->vars['templatePath'] = Request::input('path');
        $this->vars['lastModified'] = DateTime::makeCarbon($template->mtime);

        if ($type === 'page') {
            $router = new RainRouter;
            $this->vars['pageUrl'] = $router->urlFromPattern($template->url);
        }

        return [
            'tabTitle' => $this->getTabTitle($type, $template),
            'tab'      => $this->makePartial('form_page', [
                'form'          => $widget,
                'templateType'  => $type,
                'templateTheme' => $this->theme->getDirName(),
                'templateMtime' => $template->mtime
            ])
        ];
    }
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;
    }
854103
public function hasRoutableTemplates()
    {
        $this->buildTemplateIndex();

        $routable = false;

        foreach ($this->templateIndex as $name => $template) {
            if (($name !== self::INDEX_TEMPLATE) && ($name !== self::NOTFOUND_TEMPLATE)) {
                $routable = true;
                break;
            }
        }

        return($routable);
    }
820212
private function getViewsToTreat()
    {
        $templateRepo = $this->entityManager->getRepository('VictoireTemplateBundle:Template');
        $rootTemplates = $templateRepo->getInstance()
            ->where('template.template IS NULL')
            ->getQuery()
            ->getResult();
        $templates = [];
        $recursiveGetTemplates = function ($template) use (&$recursiveGetTemplates, &$templates) {
            array_push($templates, $template);
            foreach ($template->getInheritors() as $_template) {
                if ($_template instanceof Template) {
                    $recursiveGetTemplates($_template);
                }
            }
        };

        foreach ($rootTemplates as $rootTemplate) {
            $recursiveGetTemplates($rootTemplate);
        }

        $pageRepo = $this->entityManager->getRepository('VictoirePageBundle:BasePage');
        $pages = $pageRepo->findAll();
        $errorRepo = $this->entityManager->getRepository('VictoireTwigBundle:ErrorPage');
        $errorPages = $errorRepo->findAll();

        return array_merge($templates, array_merge($pages, $errorPages));
    }
922567
protected function buildTemplateIndex()
    {
        // We'll iterate the template paths and find
        // any routable templates. Note that if there is
        // more than one directory, the earlier directories
        // are checked first, then on down the stack to
        // mimic the behavior of Twig_Loader_Filesystem.

        if (false === $this->templateIndexBuilt) {
            foreach ($this->templatePath as $path) {
                $dir = new \RecursiveDirectoryIterator($path);
                $it = new \RecursiveIteratorIterator($dir);

                foreach ($it as $template_file) {
                    if ($this->validateTemplate($template_file)) {

                        // Strip the path from the template file relative to
                        // the root template directory to get the template "route"
                        $template_full_path = $template_file->getPathname();
                        $template_rel_path = str_replace($path, '', $template_full_path);
                        $template_route = '/' . $template_rel_path;

                        if (!array_key_exists($template_route, $this->templateIndex)) {
                            $this->debug(sprintf('buildTemplateIndex: Routable Template %s Found at %s.', $template_rel_path, $template_full_path));

                            $template = new Template($template_rel_path, $template_full_path);
                            $this->templateIndex[$template_route] = $template;
                        }
                    }
                }
            }

            $this->templateIndexBuilt = true;
        }
    }
186246
public function buildTemplate()
    {
        if (!empty($this->template)) {
            return $this->template;
        }

        $this->template = [
            'imageUrl' => $this->imageUrl,
            'action' => $this->actionBuilder->buildTemplateAction(),
        ];

        return $this->template;
    }
1308759
public static function Init()
    {
        add_filter('template_include',function($t){
        return get_template_directory().'/index.php';
        });
        add_filter('theme_templates', array('Balise\AnchorFramework\Anchor', 'loadThemeTemplates'), 10, 4);
        $types = array('index', '404', 'archive', 'author', 'category', 'tag', 'taxonomy', 'date', 'embed', 'home', 'frontpage', 'page', 'paged', 'search', 'single', 'singular', 'attachment');
        foreach ($types as $type) {
            add_filter("{$type}_template", array('Balise\AnchorFramework\Anchor', 'getThemeTemplate'), 10, 3);
        }
        
        if (!self::$renderer) {
            $paths = new \SplPriorityQueue;
            $paths->insert(get_template_directory() . '/app/views', 200);
            $paths->insert(dirname(__DIR__) . '/views', 100);
            self::$renderer = new BladeRenderer($paths, array('cache_path' => get_template_directory() . '/public/views/'));
            self::$renderer->addCustomCompiler('wp_head', function ($expression) {
                return '<?php wp_head(); ?>';
            });
            self::$renderer->addCustomCompiler('doquery', function ($expression) {
                return '<?php
                if (!isset($__posts)) { $posts = array(); }
                $__posts[] = $posts;
                
                $args = '.$expression.';

                if (@!$args["paged"]) {
                   $args["paged"] = get_query_var( "paged", 1 );
                }
                $query = new WP_Query($args);
                $posts = array_map(function($post){
                    return new \Balise\AnchorFramework\PostWrapper($post, true);
                }, $query->posts);

                ?>
                ';
            });
            self::$renderer->addCustomCompiler('endquery', function () {
                return '<?php
                $posts = array_pop($__posts);

                ?>
                ';
            });

            self::$renderer->addCustomCompiler('wp_footer', function ($expression) {
                return '<?php wp_footer(); ?>';
            });
        }
    }
690395
public function getTemplate()
    {
        if (null === $this->template) {
            $this->template = $this->getTemplatePathDefault('layout');
        }

        return $this->template;
    }
260391
public function index()
    {
        Piwik::checkUserHasViewAccess($this->idSite);

        $template = '@Overlay/index';
        if (Config::getInstance()->General['overlay_disable_framed_mode']) {
            $template = '@Overlay/index_noframe';
        }

        $view = new View($template);

        $this->setGeneralVariablesView($view);
        $view->segment = Request::getRawSegmentFromRequest();

        $view->ssl = ProxyHttp::isHttps();
        $view->siteUrls = SitesManager\API::getInstance()->getSiteUrlsFromId($this->site->getId());

        $this->outputCORSHeaders();
        return $view->render();
    }
962909
public function onCreateTemplate()
    {
        $type = Request::input('type');
        $template = $this->createTemplate($type);

        if ($type === 'asset') {
            $template->fileName = $this->widget->assetList->getCurrentRelativePath();
        }

        $widget = $this->makeTemplateFormWidget($type, $template);

        $this->vars['templatePath'] = '';

        return [
            'tabTitle' => $this->getTabTitle($type, $template),
            'tab'      => $this->makePartial('form_page', [
                'form'          => $widget,
                'templateType'  => $type,
                'templateTheme' => $this->theme->getDirName(),
                'templateMtime' => null
            ])
        ];
    }
853710
private function getTemplates()
	{
		if (is_null($this->templates))
		{
			useLib('templates');
			$this->templates = new Templates();
		}

		return $this->templates;
	}
681617
public function GetTemplateFiles()
	{
		$files = array();
		
		list($nothing,$data) = explode("[files]", $this->GetConfigFileContents(),2);
		
		if ($data)
		{
			$lines = explode("\n",$data);
			
			foreach ($lines as $line)
			{
				if ($line) $files[] = new TemplateFile($line);
			}
		}
		
		return $files;
	}
896379
public function getTemplates()
    {
        $templates = SSViewer::get_templates_by_class($this, '', __CLASS__);
        // Prefer any custom template
        if ($this->getTemplate()) {
            array_unshift($templates, $this->getTemplate());
        }
        return $templates;
    }
182063
public function getTemplates()
    {
        $templates_array = [];

        $templates_trait = new \ReflectionClass('App\GeoTemplates');
        $templates = $templates_trait->getMethods();

        if (! count($templates)) {
            abort('403', 'No templates have been found.');
        }

        return $templates;
    }
336174
public function getTemplate()
    {
        if ($this->templateEngine == false) {
            return false;
        }
        
        $this->view->setTwigEnvironment();

        return $this->view->getTemplate();
    }
1366228
private function getTemplateList()
    {
        $templates = $this->getAvailableTemplates($this->bundle);

        $types = array();
        foreach ($templates as $key => $template) {
            $types[$key] = $template['name'];
        }

        return $types;
    }
990775
public function getTemplateDirs()
    {
        $config = \OxidEsales\Eshop\Core\Registry::getConfig();

        // buffer for CE (main) edition templates
        $mainTemplatesDirectory = $config->getTemplateDir($this->isAdmin());

        // main templates directory has not much priority anymore
        $this->setTemplateDir($mainTemplatesDirectory);

        // out directory can have templates too
        if (!$this->isAdmin()) {
            $this->setTemplateDir($this->addActiveThemeId($config->getOutDir(true)));
        }

        return $this->_aTemplateDir;
    }