File tree Expand file tree Collapse file tree 1 file changed +21
-4
lines changed
app/code/Magento/Catalog/Model/Category Expand file tree Collapse file tree 1 file changed +21
-4
lines changed Original file line number Diff line number Diff line change @@ -659,14 +659,31 @@ protected function getFieldsMap()
659
659
->create (['componentName ' => $ referenceName ])
660
660
->get ($ referenceName );
661
661
662
+ if (empty ($ config )) {
663
+ return [];
664
+ }
665
+
662
666
$ fieldsMap = [];
663
667
664
- if (isset ($ config ['children ' ]) && !empty ($ config ['children ' ])) {
665
- foreach ($ config ['children ' ] as $ name => $ child ) {
666
- if (isset ($ child ['children ' ]) && !empty ($ child ['children ' ])) {
667
- $ fieldsMap [$ name ] = array_keys ($ child ['children ' ]);
668
+ foreach ($ config ['children ' ] as $ group => $ node ) {
669
+ $ fieldsMap [$ group ] = [];
670
+
671
+ foreach ($ node ['children ' ] as $ childName => $ childNode ) {
672
+ if (!empty ($ childNode ['children ' ])) {
673
+ // <container/> nodes need special handling
674
+ $ fieldsMap [$ group ] = array_merge (
675
+ $ fieldsMap [$ group ],
676
+ array_keys ($ childNode ['children ' ])
677
+ );
678
+ } else {
679
+ $ fieldsMap [$ group ][] = $ childName ;
668
680
}
669
681
}
682
+
683
+ // Remove empty groups
684
+ if (empty ($ fieldsMap [$ group ])) {
685
+ unset($ fieldsMap [$ group ]);
686
+ }
670
687
}
671
688
672
689
return $ fieldsMap ;
You can’t perform that action at this time.
0 commit comments