Prepare the template.

@param ContaoBackendViewTemplate $template    The template to populate.
@param EnvironmentInterface      $environment The environment.

@return void
518081
protected function renderTemplate(ContaoBackendViewTemplate $template, EnvironmentInterface $environment)
    {
        $definition = $environment->getDataDefinition();
        $showColumn = $this->getViewSection($definition)->getListingConfig()->getShowColumns();

        $template
            ->set('subHeadline', $this->translate('MSC.select_models', 'contao_default'))
            ->set('tableName', ($definition->getName() ?? 'none'))
            ->set('select', 'select' === $environment->getInputProvider()->getParameter('act'))
            ->set('action', \ampersand(Environment::get('request')))
            ->set('selectButtons', $this->getSelectButtons($environment))
            ->set('sortable', $this->isSortable($environment))
            ->set('showColumns', $showColumn)
            ->set('tableHead', $showColumn ? $this->getTableHead($environment) : '')
            // Add breadcrumb, if we have one.
            ->set('breadcrumb', $this->breadcrumb($environment))
            ->set('floatRightSelectButtons', true)
            ->set('selectCheckBoxName', 'models[]')
            ->set('selectCheckBoxIdPrefix', 'models_')
            ->set('selectContainer', $this->getSelectContainer($environment));

        if ((null !== $template->get('action'))
            && (false !== \strpos($template->get('action'), 'select=models'))
        ) {
            $template->set('action', \str_replace('select=models', 'select=properties', $template->get('action')));
        }
    }
153862
protected function populateView(EnvironmentInterface $environment)
    {
        // Already populated, get out then.
        if ($environment->getView()) {
            return;
        }

        $definition = $environment->getDataDefinition();

        // If we encounter an extended definition, that one may override.
        if (!$definition->hasDefinition(ExtendedDca::NAME)) {
            return;
        }

        /** @var ExtendedDca $extendedDefinition */
        if (!($class = $definition->getDefinition(ExtendedDca::NAME)->getViewClass())) {
            return;
        }

        /** @var ViewInterface $view */
        $view = (new \ReflectionClass($class))->newInstance();
        $view->setEnvironment($environment);
        $environment->setView($view);
    }
370889
public static function compileTemplate(&$context, $template) {
        array_unshift($context['parsed'], array());
        Validator::verify($context, $template);
        static::$lastParsed = $context['parsed'];

        if (count($context['error'])) {
            return;
        }

        Parser::setDelimiter($context);

        $context['compile'] = true;

        // Handle dynamic partials
        Partial::handleDynamic($context);

        // Do PHP code generation.
        $code = '';
        foreach ($context['parsed'][0] as $info) {
            if (is_array($info)) {
                $context['tokens']['current']++;
                $code .= "'" . static::compileToken($context, $info) . "'";
            } else {
                $code .= $info;
            }
        }

        array_shift($context['parsed']);

        return $code;
    }
443303
public function init(TemplateInterface $template)
    {
        $this->template = $template;
        $this->zones = $template->getZones()
            ->sortByZoneType()->indexByZoneType()
        ;

        return $this;
    }
543638
public function setTemplate($template)
    {
        $this->templatePath = $this->getTemplatesDirectory() . '/' . ltrim($template, '/');
        if (!file_exists($this->templatePath)) {
            throw new \RuntimeException('View cannot render template `' . $this->templatePath . '`. Template does not exist.');
        }
    }
977605
public function template($template = null)
    {
        if (is_null($template)) {
            return $this->template;
        } else {
            $this->template = $template;
        }
    }
140358
protected function parsePanel(Contao2BackendViewDefinitionInterface $view)
    {
        $layout = $view->getPanelLayout();
        $rows   = $layout->getRows();

        foreach (\explode(';', (string) $this->getFromDca('list/sorting/panelLayout')) as $rowNo => $elementRow) {
            if ($rows->getRowCount() < ($rowNo + 1)) {
                $row = $rows->addRow();
            } else {
                $row = $rows->getRow($rowNo);
            }

            $this->parsePanelRow($row, $elementRow);

            if (0 === $row->getCount()) {
                $rows->deleteRow($rowNo);
            }
        }

        if (!$this->hasSubmit($rows) && $rows->getRowCount()) {
            $row = $rows->getRow($rows->getRowCount() - 1);
            $row->addElement(new DefaultSubmitElementInformation(), 0);
        }
    }
560558
protected function renderTemplate($template, array $context = [])
    {
        $app = $this->getContainer();

        if ($this->pathAdded === false) {
            $this->addTwigPath('templates');
            $this->pathAdded = true;
        }

        return $app['twig']->render($template, $context);
    }
568936
public function renderMenu(\Twig_Environment $environment, $template = 'DarvinAdminBundle::menu.html.twig')
    {
        return $environment->render($template, [
            'items' => $this->menu->getItems(),
        ]);
    }
689121
public static function template(
        $template,
        $parameters,
        $startChar = '%',
        $endChar = '%'
    ) {
        foreach ($parameters as $key => $value) {
            $template = str_replace($startChar . $key . $endChar, $value, $template);
        }
        return $template;
    }
34208
private function loadStringTemplate(\Twig_Environment $environment, $template)
    {
        $existingLoader = $environment->getLoader();
        $environment->setLoader($this->stringLoader);

        try {
            $template = $environment->loadTemplate($template);
        } catch (\Exception $e) {
            $environment->setLoader($existingLoader);
            
            throw $e;
        }

        $environment->setLoader($existingLoader);

        return $template;
    }
147988
protected function _setPlaceholderTemplate($template)
    {
        if (!is_null($template)) {
            $template = $this->_normalizeStringable($template);
        }

        $this->placeholderTemplate = $template;
    }
1099061
public function setThemeTemplate($template)
    {
        $this->_themeTemplate = $template;
        if ($this->getTheme() != null) {
            $this->getTheme()->setTemplate($this->_themeTemplate);
        }
    }
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);
	}
1297018
protected function initializeFromTemplate($template, $languages)
    {
        $results = array();
        $target = dirname($template);
        if (!file_exists($template)) {
            throw new ResourceNotFoundException("Template not found in: $template\n\nRun 'app/console gettext:bundle:extract' first.");
        }
        $results[$this->relative($template)] = 'Scanned';
        $languages = explode(',', trim($languages));
        foreach ($languages as $lang) {
            $lang = trim($lang);
            $file = "$target/locale/$lang/LC_MESSAGES/messages.po";
            if (file_exists($file)) {
                $results[$this->relative($file)] = 'Skipped';
                continue;
            }
            if (!file_exists(dirname($file))) {
                mkdir(dirname($file), 0755, true);
            }
            $data = file_get_contents($template);
            $version = $this->relative($target . '/../..') . '@' . date('YmdHis');
            $data = preg_replace('/Project-Id-Version: PACKAGE VERSION\\\n/', 'Project-Id-Version: ' . $version . '\n', $data, 1);
            $data = preg_replace('/Language: \\\n/','Language: ' . $lang . '\n', $data, 1);
            $data = preg_replace('/charset=CHARSET/', 'charset=UTF-8', $data, 1);
            $status = file_put_contents($file, $data) ? 'Created' : 'Failed';
            $results[$this->relative($file)] = $status;
        }

        return $results;
    }
1175952
public function setTemplate(Template $template = null)
	{
		if ($this->writeOnce($this->template, $template)) {
			$this->template->addTemplateLayout($this);
		}
	}
148502
private function prepareTemplate()
    {
        $template = new \BackendTemplate('be_iconwizard');

        $template->headline          = $GLOBALS['TL_LANG']['MSC']['iconWizard'][1];
        $template->searchLabel       = $GLOBALS['TL_LANG']['MSC']['iconWizardSearch'][0];
        $template->searchPlaceholder = $GLOBALS['TL_LANG']['MSC']['iconWizardSearch'][1];
        $template->reset             = $GLOBALS['TL_LANG']['MSC']['iconWizardReset'][0];
        $template->resetTitle        = $GLOBALS['TL_LANG']['MSC']['iconWizardReset'][1];
        $template->theme             = $this->getTheme();
        $template->base              = $this->Environment->base;
        $template->language          = $GLOBALS['TL_LANGUAGE'];
        $template->title             = $GLOBALS['TL_CONFIG']['websiteTitle'];
        $template->charset           = $GLOBALS['TL_CONFIG']['characterSet'];
        $template->pageOffset        = \Input::cookie('BE_PAGE_OFFSET');
        $template->error             = (\Input::get('act') == 'error') ? $GLOBALS['TL_LANG']['ERR']['general'] : '';
        $template->skipNavigation    = $GLOBALS['TL_LANG']['MSC']['skipNavigation'];
        $template->request           = ampersand($this->Environment->request);
        $template->top               = $GLOBALS['TL_LANG']['MSC']['backToTop'];
        $template->expandNode        = $GLOBALS['TL_LANG']['MSC']['expandNode'];
        $template->collapseNode      = $GLOBALS['TL_LANG']['MSC']['collapseNode'];
        
        return $template;
    }