File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 8
8
use Illuminate \Contracts \View \View ;
9
9
use Illuminate \Support \Collection ;
10
10
use MoonShine \AssetManager \Js ;
11
+ use MoonShine \Contracts \Core \HasComponentsContract ;
11
12
use MoonShine \Contracts \Core \PageContract ;
12
13
use MoonShine \Contracts \Core \ResourceContract ;
13
14
use MoonShine \Contracts \UI \ActionButtonContract ;
15
+ use MoonShine \Contracts \UI \Collection \ComponentsContract ;
14
16
use MoonShine \Contracts \UI \HasFieldsContract ;
15
17
use MoonShine \Layouts \Casts \LayoutItem ;
16
18
use MoonShine \Layouts \Casts \LayoutsCast ;
@@ -169,9 +171,15 @@ public function getFilledLayouts(): LayoutCollection
169
171
return LayoutCollection::make ($ filled );
170
172
}
171
173
172
- private function fillClonedRecursively (Collection $ collection , mixed $ data ): Collection
174
+ private function fillClonedRecursively (ComponentsContract | Collection $ collection , mixed $ data ): Collection
173
175
{
174
176
return $ collection ->map (function (mixed $ item ) use ($ data ) {
177
+ if ($ item instanceof HasComponentsContract) {
178
+ $ item = (clone $ item )->setComponents (
179
+ $ this ->fillClonedRecursively ($ item ->getComponents (), $ data )->toArray ()
180
+ );
181
+ }
182
+
175
183
if ($ item instanceof HasFieldsContract) {
176
184
$ item = (clone $ item )->fields (
177
185
$ this ->fillClonedRecursively ($ item ->getFields (), $ data )->toArray ()
You can’t perform that action at this time.
0 commit comments