File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 1010
1111class Twig
1212{
13+ private $ config = [
14+ 'paths ' => [VIEWPATH ],
15+ ];
16+
1317 private $ functions_asis = [
1418 'base_url ' , 'site_url '
1519 ];
@@ -20,6 +24,11 @@ class Twig
2024 private $ twig ;
2125 private $ loader ;
2226
27+ public function __construct ($ params = [])
28+ {
29+ $ this ->config = array_merge ($ this ->config , $ params );
30+ }
31+
2332 public function createTwig ()
2433 {
2534 if (ENVIRONMENT === 'production ' )
@@ -31,8 +40,9 @@ public function createTwig()
3140 $ debug = TRUE ;
3241 }
3342
34- if ($ this ->loader === null ) {
35- $ this ->loader = new \Twig_Loader_Filesystem ([VIEWPATH ]);
43+ if ($ this ->loader === null )
44+ {
45+ $ this ->loader = new \Twig_Loader_Filesystem ($ this ->config ['paths ' ]);
3646 }
3747
3848 $ twig = new \Twig_Environment ($ this ->loader , [
You can’t perform that action at this time.
0 commit comments