File tree Expand file tree Collapse file tree 3 files changed +8
-1
lines changed
src/PatternLab/PatternEngine/Twig/Loaders Expand file tree Collapse file tree 3 files changed +8
-1
lines changed Original file line number Diff line number Diff line change 1212
1313namespace PatternLab \PatternEngine \Twig \Loaders ;
1414
15+ use \PatternLab \Config ;
1516use \PatternLab \PatternEngine \Loader ;
17+ use \PatternLab \PatternEngine \Twig \TwigUtil ;
1618
1719class FilesystemLoader extends Loader {
1820
@@ -23,6 +25,7 @@ public function __construct($options = array()) {
2325
2426 $ twigLoader = new \Twig_Loader_Filesystem (array ($ options ["templatePath " ],$ options ["partialsPath " ]));
2527 $ this ->instance = new \Twig_Environment ($ twigLoader );
28+ $ this ->instance = TwigUtil::loadMacros ($ this ->instance , "filesystem " );
2629
2730 }
2831
@@ -34,7 +37,7 @@ public function __construct($options = array()) {
3437 */
3538 public function render ($ options = array ()) {
3639
37- return $ this ->instance ->render ($ options ["template " ].".twig " , $ options ["data " ]);
40+ return $ this ->instance ->render ($ options ["template " ].". " .Config:: getOption ( " patternExtension " ) , $ options ["data " ]);
3841
3942 }
4043
Original file line number Diff line number Diff line change 1717use \PatternLab \PatternEngine \Twig \Loaders \Twig \PatternPartialLoader as Twig_Loader_PatternPartialLoader ;
1818use \PatternLab \PatternEngine \Twig \Loaders \Twig \PatternStringLoader as Twig_Loader_PatternStringLoader ;
1919use \PatternLab \PatternEngine \Loader ;
20+ use \PatternLab \PatternEngine \Twig \TwigUtil ;
2021
2122class PatternLoader extends Loader {
2223
@@ -31,6 +32,7 @@ public function __construct($options = array()) {
3132 $ patternStringLoader = new \Twig_Loader_String ();
3233 $ twigLoader = new \Twig_Loader_Chain (array ($ patternPartialLoader , $ patternStringLoader ));
3334 $ this ->instance = new \Twig_Environment ($ twigLoader );
35+ $ this ->instance = TwigUtil::loadMacros ($ this ->instance , "pattern " );
3436
3537 }
3638
Original file line number Diff line number Diff line change 1313namespace PatternLab \PatternEngine \Twig \Loaders ;
1414
1515use \PatternLab \PatternEngine \Loader ;
16+ use \PatternLab \PatternEngine \Twig \TwigUtil ;
1617
1718class StringLoader extends Loader {
1819
@@ -23,6 +24,7 @@ public function __construct($options = array()) {
2324
2425 $ twigLoader = new \Twig_Loader_String ();
2526 $ this ->instance = new \Twig_Environment ($ twigLoader );
27+ $ this ->instance = TwigUtil::loadMacros ($ this ->instance , "string " );
2628
2729 }
2830
You can’t perform that action at this time.
0 commit comments