File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,11 @@ class TwigView extends Slim_View {
5151 */
5252 public static $ twigOptions = array ();
5353
54+ /**
55+ * @var TwigExtension The Twig extensions you want to load
56+ */
57+ public static $ twigExtensions = array ();
58+
5459 /**
5560 * @var TwigEnvironment The Twig environment for rendering templates.
5661 */
@@ -85,11 +90,14 @@ public function getEnvironment() {
8590 self ::$ twigOptions
8691 );
8792
88- require_once dirname (__FILE__ ) . '/Extension/TwigAutoloader.php ' ;
89- Twig_Extensions_Autoloader::register ();
93+ $ extension_autoloader = dirname (__FILE__ ) . '/Extension/TwigAutoloader.php ' ;
94+ if (file_exists ($ extension_autoloader )) {
95+ require_once $ extension_autoloader ;
96+ Twig_Extensions_Autoloader::register ();
9097
91- foreach (self ::$ twigExtensions as $ ext ) {
92- $ this ->twigEnvironment ->addExtension (new $ ext );
98+ foreach (self ::$ twigExtensions as $ ext ) {
99+ $ this ->twigEnvironment ->addExtension (new $ ext );
100+ }
93101 }
94102 }
95103 return $ this ->twigEnvironment ;
You can’t perform that action at this time.
0 commit comments