@@ -13,7 +13,7 @@ class Registrar {
13
13
/**
14
14
* the laravel backend version
15
15
*/
16
- const VERSION = '1.0.18 ' ;
16
+ const VERSION = '1.0.19 ' ;
17
17
const VERSION_NAME = 'Alpha ' ;
18
18
19
19
/**
@@ -56,6 +56,20 @@ class Registrar {
56
56
*/
57
57
protected $ routes = array ();
58
58
59
+ /**
60
+ * the header scripts
61
+ *
62
+ * @var array
63
+ */
64
+ protected $ headerScripts = array ();
65
+
66
+ /**
67
+ * the footer scripts
68
+ *
69
+ * @var array
70
+ */
71
+ protected $ footerScripts = array ();
72
+
59
73
public function __construct ()
60
74
{
61
75
//
@@ -102,6 +116,8 @@ public function addWidget($widget)
102
116
else
103
117
{
104
118
array_push ($ this ->activeWidgets , $ widget );
119
+ if (count ($ widget ->getHeaderScripts ()) > 0 ) array_push ($ this ->headerScripts , $ widget ->getHeaderScripts ());
120
+ if (count ($ widget ->getFooterScripts ()) > 0 ) array_push ($ this ->footerScripts , $ widget ->getFooterScripts ());
105
121
}
106
122
107
123
return $ this ;
@@ -157,6 +173,28 @@ public function initViews()
157
173
}
158
174
}
159
175
176
+ /**
177
+ * init added header scripts
178
+ */
179
+ public function initAddHeaderScripts ()
180
+ {
181
+ foreach ($ this ->activeComponents as $ component )
182
+ {
183
+ if (count ($ component ->getHeaderScripts ()) > 0 ) array_push ($ this ->headerScripts , $ component ->getHeaderScripts ());
184
+ }
185
+ }
186
+
187
+ /**
188
+ * init added footer scripts
189
+ */
190
+ public function initAddFooterScripts ()
191
+ {
192
+ foreach ($ this ->activeComponents as $ component )
193
+ {
194
+ if (count ($ component ->getFooterScripts ()) > 0 ) array_push ($ this ->footerScripts , $ component ->getFooterScripts ());
195
+ }
196
+ }
197
+
160
198
/**
161
199
* get navigations
162
200
*
@@ -229,4 +267,24 @@ public function getVersion()
229
267
'name ' => self ::VERSION_NAME ,
230
268
);
231
269
}
270
+
271
+ /**
272
+ * get added header scripts by all active components
273
+ *
274
+ * @return array
275
+ */
276
+ public function getAddedHeaderScripts ()
277
+ {
278
+ return $ this ->headerScripts ;
279
+ }
280
+
281
+ /**
282
+ * get added footer scripts by all active components
283
+ *
284
+ * @return array
285
+ */
286
+ public function getAddedFooterScripts ()
287
+ {
288
+ return $ this ->footerScripts ;
289
+ }
232
290
}
0 commit comments