@@ -13,7 +13,7 @@ class Registrar {
1313 /**
1414 * the laravel backend version
1515 */
16- const VERSION = '1.0.18 ' ;
16+ const VERSION = '1.0.19 ' ;
1717 const VERSION_NAME = 'Alpha ' ;
1818
1919 /**
@@ -56,6 +56,20 @@ class Registrar {
5656 */
5757 protected $ routes = array ();
5858
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+
5973 public function __construct ()
6074 {
6175 //
@@ -102,6 +116,8 @@ public function addWidget($widget)
102116 else
103117 {
104118 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 ());
105121 }
106122
107123 return $ this ;
@@ -157,6 +173,28 @@ public function initViews()
157173 }
158174 }
159175
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+
160198 /**
161199 * get navigations
162200 *
@@ -229,4 +267,24 @@ public function getVersion()
229267 'name ' => self ::VERSION_NAME ,
230268 );
231269 }
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+ }
232290}
0 commit comments