From d24f021332c46913993adc99fe53f48ceda9c292 Mon Sep 17 00:00:00 2001 From: Christopher Tombleson Date: Fri, 20 Jun 2014 13:59:22 +1200 Subject: [PATCH] Fixed error when adding functions to twig Moved setLexer call to below registering filters and function to prevent this error "Unable to add function as extensions have already been initialized." --- libraries/Twiggy.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libraries/Twiggy.php b/libraries/Twiggy.php index 7e99355..ca0223d 100644 --- a/libraries/Twiggy.php +++ b/libraries/Twiggy.php @@ -70,7 +70,6 @@ public function __construct() $this->_config['environment']['cache'] = ($this->_config['environment']['cache']) ? $this->_config['twig_cache_dir'] : FALSE; $this->_twig = new Twig_Environment($this->_twig_loader, $this->_config['environment']); - $this->_twig->setLexer(new Twig_Lexer($this->_twig, $this->_config['delimiters'])); // Initialize defaults $this->theme($this->_config['default_theme']) @@ -88,6 +87,8 @@ public function __construct() foreach($this->_config['register_filters'] as $filter) $this->register_filter($filter); } + $this->_twig->setLexer(new Twig_Lexer($this->_twig, $this->_config['delimiters'])); + $this->_globals['title'] = NULL; $this->_globals['meta'] = NULL; } @@ -583,4 +584,4 @@ public function __get($variable) return FALSE; } } -// End Class \ No newline at end of file +// End Class