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 @@ -33,7 +33,9 @@ public static function _init()
33
33
protected function process_file ($ file_override = false )
34
34
{
35
35
$ file = $ file_override ?: $ this ->file_name ;
36
- $ data = $ this ->get_data ();
36
+
37
+ $ local_data = $ this ->get_data ('local ' );
38
+ $ global_data = $ this ->get_data ('global ' );
37
39
38
40
// Extract View name/extension (ex. "template.twig")
39
41
$ view_name = pathinfo ($ file , PATHINFO_BASENAME );
@@ -43,9 +45,17 @@ protected function process_file($file_override = false)
43
45
array_unshift ($ views_paths , pathinfo ($ file , PATHINFO_DIRNAME ));
44
46
static ::$ _parser_loader = new Twig_Loader_Filesystem ($ views_paths );
45
47
48
+ if ( ! empty ($ global_data ))
49
+ {
50
+ foreach ($ global_data as $ key => $ value )
51
+ {
52
+ static ::parser ()->addGlobal ($ key , $ value );
53
+ }
54
+ }
55
+
46
56
try
47
57
{
48
- return static ::parser ()->loadTemplate ($ view_name )->render ($ data );
58
+ return static ::parser ()->loadTemplate ($ view_name )->render ($ local_data );
49
59
}
50
60
catch (\Exception $ e )
51
61
{
You can’t perform that action at this time.
0 commit comments