diff options
Diffstat (limited to 'core/View.php')
-rw-r--r-- | core/View.php | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/core/View.php b/core/View.php index e74eae6201..3c90b5f9a7 100644 --- a/core/View.php +++ b/core/View.php @@ -212,10 +212,15 @@ class View implements ViewInterface return isset($this->templateVars[$name]); } + /** @var Twig */ + static $twigCached = null; + private function initializeTwig() { - $piwikTwig = new Twig(); - $this->twig = $piwikTwig->getTwigEnvironment(); + if (empty(static::$twigCached)) { + static::$twigCached = new Twig(); + } + $this->twig = static::$twigCached->getTwigEnvironment(); } /** |