File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change 22
33namespace KodiCMS \CMS \Navigation ;
44
5+ use KodiComponents \Navigation \Contracts \PageInterface ;
6+
57class Navigation extends \KodiComponents \Navigation \Navigation
68{
79
@@ -18,4 +20,28 @@ public function render()
1820 'pages ' => $ this ->toArray (),
1921 ])->render ();
2022 }
23+
24+ /**
25+ * @param array $data
26+ *
27+ * @return PageInterface
28+ */
29+ protected function createPageFromArray (array $ data )
30+ {
31+ $ page = app (PageInterface::class);
32+
33+ foreach ($ data as $ key => $ value ) {
34+ if ($ key != 'children ' and method_exists ($ page , $ method = 'set ' .ucfirst ($ key ))) {
35+ $ page ->{$ method }($ value );
36+ }
37+ }
38+
39+ if (isset ($ data ['children ' ]) and is_array ($ data ['children ' ])) {
40+ foreach ($ data ['children ' ] as $ child ) {
41+ $ page ->addPage ($ child );
42+ }
43+ }
44+
45+ return $ page ;
46+ }
2147}
Original file line number Diff line number Diff line change 55use KodiCMS \CMS \CMS ;
66use Collective \Html \FormFacade ;
77use Collective \Html \HtmlFacade ;
8- use KodiCMS \CMS \Navigation \Navigation ;
98use KodiCMS \CMS \Navigation \Page ;
109use KodiCMS \Support \Facades \Wysiwyg ;
1110use KodiCMS \Support \Helpers \Profiler ;
1211use Illuminate \Foundation \AliasLoader ;
12+ use KodiCMS \CMS \Navigation \Navigation ;
1313use KodiCMS \Support \Facades \KeysHelper ;
1414use KodiCMS \Assets \AssetsServiceProvider ;
1515use KodiCMS \Support \Loader \ModulesLoader ;
You can’t perform that action at this time.
0 commit comments