Refreshes the TemplateManager

@param  ThemeSlotsInterface $themeSlots
@param  Template            $template
@param  PageBlocksInterface $pageBlocks
@return self
502839
public function refresh(ThemeSlotsInterface $themeSlots, Template $template = null, PageBlocksInterface $pageBlocks = null)
    {
        $this->themeSlots = $themeSlots;
        $this->template = $template;
        $this->pageBlocks = $pageBlocks;

        $this->setUpSlotManagers();

        return $this;
    }
158645
public function generateTemplate(PageTree $pageTree, ThemeInterface $theme, array $options)
    {
        $this->language = $pageTree->getLanguage();
        $this->page = $pageTree->getPage();
        switch ($options["type"]) {
            case 'Base':
                $this->template = $pageTree->getTemplate();
                $this->generateBaseTemplate($pageTree, $theme, $options);
                $this->baseFolder = "/base";
                $this->fileName = $this->template->getTemplateName();
                break;
            case 'Pages':
                $this->generatePageTemplate($pageTree, $theme, $options);
                $this->baseFolder = "";
                $this->fileName = $this->page->getPageName();
                break;
        }

        return $this;
    }
698173
protected function changeTemplate(ThemeInterface $theme, array $templatesMap)
    {
        $ignoreRepeatedSlots = false;
        foreach ($this->languagesRepository->activeLanguages() as $language) {
            foreach ($this->pagesRepository->activePages() as $page) {
                $templateName = $page->getTemplateName();
                if ( ! array_key_exists($templateName, $templatesMap)) {
                    continue;
                }

                $page->setTemplateName($templatesMap[$templateName]);
                $page->save();

                $template = $theme->getTemplate($page->getTemplateName());
                $this->templateManager
                    ->refresh($theme->getThemeSlots(), $template);

                $this->templateManager->populate($language->getId(), $page->getId(), $ignoreRepeatedSlots);
                $ignoreRepeatedSlots = true;
            }
        }
    }
1139603
public void setTemplate(String template) throws MissingIncludeException {
	PageSource ps = pageContext.getCurrentPageSource().getRealPage(template);
	if (!ps.exists()) throw new MissingIncludeException(ps);
	errorPage.setTemplate(ps);
    }
937552
public function prepare(
        $content,
        ThemeInterface $theme,
        TemplateInterface $template,
        ZoneInterface $zone,
        ComponentInterface $component
    ) {
        $this->contextStack->push(
            $this->contextBuilder
                ->setContent($content)
                ->setTheme($theme)
                ->setTemplate($template)
                ->setZone($zone)
                ->setComponent($component)
            ->createContext()
        );

        return $this;
    }
73817
public function setTemplate($template)
    {
        if (is_string($template)) {
            $template = new TemplateView($template);
        }
        $template->mergeData([
            'layout' => $this
        ]);
        $this->addChild(new Part($template, 'template'));
        return $this;
    }
169811
public function addTemplateTo($zone, $template, Array $params=array()){
		if(!isset($this->content[$zone]))
			$this->content[$zone] = array();
		$this->content[$zone][] = array('type'=>'template', 'template'=>$template, 'params'=>$params);
	}
438034
public function addTemplates($templates)
    {
        foreach ($templates as $name => $template) {
            $this->twig->getLoader()->setTemplate($name, $template);
        }
    }
1250130
protected static function initializeColumns(\Template $template)
	{
		$layout = Bootstrap::getLayout();

		switch($layout->cols)
		{
			case '2cll':
				$template->leftClass           = $layout->bootstrap_leftClass;
				$template->mainClass           = $layout->bootstrap_mainClass;

				$template->mainClassAttribute  = sprintf(static::$classAttribute, $layout->bootstrap_mainClass);
				$template->leftClassAttribute  = sprintf(static::$classAttribute, $layout->bootstrap_leftClass);
				break;

			case '2clr':
				$template->rightClass          = $layout->bootstrap_rightClass;
				$template->mainClass           = $layout->bootstrap_mainClass;

				$template->mainClassAttribute  = sprintf(static::$classAttribute, $layout->bootstrap_mainClass);
				$template->rightClassAttribute = sprintf(static::$classAttribute, $layout->bootstrap_rightClass);
				break;

			case '3cl':
				$template->leftClass           = $layout->bootstrap_leftClass;
				$template->rightClass          = $layout->bootstrap_rightClass;
				$template->mainClass           = $layout->bootstrap_mainClass;

				$template->mainClassAttribute  = sprintf(static::$classAttribute, $layout->bootstrap_mainClass);
				$template->rightClassAttribute = sprintf(static::$classAttribute, $layout->bootstrap_rightClass);
				$template->leftClassAttribute  = sprintf(static::$classAttribute, $layout->bootstrap_leftClass);
				break;

			default:
				$template->useGrid = false;
				return;
		}

		$template->useGrid = true;
	}
873841
public function reload()
    {
        $f = $this->findTemplate($this->template_file);
        $template_source = implode('', file($f));
        $this->loadTemplateFromString($template_source);

        return $this;
    }
1178240
protected function generateBaseTemplate(PageTree $pageTree, ThemeInterface $theme, array $options)
    {
        $options["filter"] = array('site', 'language');
        $this->twigTemplate = sprintf("{%% extends '%s:Theme:%s.html.twig' %%}" . PHP_EOL, $theme->getThemeName(), $this->template->getTemplateName());
        $this->twigTemplate .= $this->contentSection->generateSection($pageTree, $theme, $options);

        return $this;
    }
1172930
protected function mergeTemplateResources(TemplateResources $templateResources)
    {
        $this->stylesheets    = array_merge($this->stylesheets, $templateResources->getStylesheets());
        $this->headerScripts  = array_merge($this->headerScripts, $templateResources->getHeaderScripts());
        $this->headerIncludes = array_merge($this->headerIncludes, $templateResources->getHeaderIncludes());
        $this->footerScripts  = array_merge($this->footerScripts, $templateResources->getFooterScripts());
        $this->footerIncludes = array_merge($this->footerIncludes, $templateResources->getFooterIncludes());
    }
156846
public function setTemplate($template)
    {
        if (is_readable($template) === false) {
            throw new RuntimeException("Unable to read template file “{$template}”.");
        }

        $this->template = $template;

        return $this;
    }
553545
function blockSet(BlockInterface $block, $templateFile) {
		$this->_blockStack[]= $block;
		$this->_templateFileStack[]= $templateFile;
	}
851558
public function updateTemplate(TemplateInterface $template)
    {
        $template->setRevision($template->getRevision() + 1);

        $this->dumper->dumpTemplate($template);
    }
1175952
public function setTemplate(Template $template = null)
	{
		if ($this->writeOnce($this->template, $template)) {
			$this->template->addTemplateLayout($this);
		}
	}
983131
private function renderParentBlock(Template $parent, $blockName, Context $context)
    {
        while ($parent->parentTemplate) {
            $parent = $this->environment->load($parent->parentTemplate);
            if (isset($parent->blocks[ $blockName ])) {
                $parent->blocks[$blockName]($context);

                return;
            }
        }

        throw new \RuntimeException("Block {$blockName} was not found.");
    }