We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ca79afa commit ca2dee3Copy full SHA for ca2dee3
src/Mvc/View.php
@@ -13,6 +13,11 @@ class View
13
*/
14
private static $extension = 'phtml';
15
16
+ /**
17
+ * @var array
18
+ */
19
+ private static $globals = [];
20
+
21
/**
22
* @var TemplateEngine
23
@@ -36,6 +41,14 @@ public static function setExtension(string $extension)
36
41
self::$extension = $extension;
37
42
}
38
43
44
45
+ * @param array $globals
46
47
+ public static function setGlobals(array $globals)
48
+ {
49
+ self::$globals = $globals;
50
+ }
51
39
52
40
53
* Draw a template using application defined
54
* template engine.
@@ -56,7 +69,7 @@ public function draw()
56
69
57
70
return $this->templateEngine->draw(
58
71
$file,
59
- $this->data
72
+ array_merge(static::$globals, $this->data)
60
73
);
61
74
62
75
0 commit comments