public function render()
{
$this->prepare();
if ($this->parentName === NULL && isset($this->global->coreParentFinder)) {
$this->parentName = call_user_func($this->global->coreParentFinder, $this);
}
if (isset($this->global->snippetBridge) && !isset($this->global->snippetDriver)) {
$this->global->snippetDriver = new SnippetDriver($this->global->snippetBridge);
}
Filters::$xhtml = (bool) preg_match('#xml|xhtml#', $this->contentType);
if ($this->referenceType === 'import') {
if ($this->parentName) {
$this->createTemplate($this->parentName, [], 'import')->render();
}
return;
} elseif ($this->parentName) {
// extends
ob_start(function () {
});
$params = $this->main();
ob_end_clean();
$this->createTemplate($this->parentName, $params, 'extends')->render();
return;
} elseif (!empty($this->params['_renderblock'])) {
// single block rendering
$tmp = $this;
while (in_array($this->referenceType, ['extends', NULL], TRUE) && ($tmp = $tmp->referringTemplate)) {
}
if (!$tmp) {
$this->renderBlock($this->params['_renderblock'], $this->params);
return;
}
}
// old accumulators for back compatibility
$this->params['_l'] = new \stdClass();
$this->params['_g'] = $this->global;
$this->params['_b'] = (object) ['blocks' => &$this->blockQueue, 'types' => &$this->blockTypes];
if (isset($this->global->snippetDriver) && $this->global->snippetBridge->isSnippetMode()) {
if ($this->global->snippetDriver->renderSnippets($this->blockQueue, $this->params)) {
return;
}
}
$this->main();
}