File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
src/Repositories/Behaviors Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -244,15 +244,17 @@ private function getBlocks($object, $fields)
244
244
{
245
245
$ blocks = Collection::make ();
246
246
if (isset ($ fields ['blocks ' ]) && is_array ($ fields ['blocks ' ])) {
247
- foreach ($ fields ['blocks ' ] as $ index => $ block ) {
248
- $ block = $ this ->buildBlock ($ block , $ object );
247
+ foreach (collect ($ fields ['blocks ' ])->groupBy ('editor_name ' )->values ()->toArray () as $ editorBlocks ) {
248
+ foreach ($ editorBlocks as $ index => $ block ) {
249
+ $ block = $ this ->buildBlock ($ block , $ object );
249
250
250
- $ this ->validateBlockArray ($ block , $ block ['instance ' ], true );
251
+ $ this ->validateBlockArray ($ block , $ block ['instance ' ], true );
251
252
252
- $ block ['position ' ] = $ index + 1 ;
253
- $ block ['blocks ' ] = $ this ->getChildBlocks ($ object , $ block );
253
+ $ block ['position ' ] = $ index + 1 ;
254
+ $ block ['blocks ' ] = $ this ->getChildBlocks ($ object , $ block );
254
255
255
- $ blocks ->push ($ block );
256
+ $ blocks ->push ($ block );
257
+ }
256
258
}
257
259
}
258
260
You can’t perform that action at this time.
0 commit comments