From ead1f8503c0229bb0bca375df49e8bb8490feab6 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Thu, 23 Jun 2016 03:31:23 +0200 Subject: [PATCH] Template::render() snippetDriver is initialized sooner --- src/Latte/Runtime/Template.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Latte/Runtime/Template.php b/src/Latte/Runtime/Template.php index 5aadfff5a..d6a3e3774 100644 --- a/src/Latte/Runtime/Template.php +++ b/src/Latte/Runtime/Template.php @@ -158,6 +158,10 @@ public function render() 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) { @@ -179,11 +183,8 @@ public function render() $this->renderBlock($this->params['_renderblock'], $this->params); return; } - } elseif (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); // old accumulators for back compatibility $this->params['_l'] = new \stdClass; $this->params['_g'] = $this->global;