Skip to content

Commit 471dc6b

Browse files
committed
Add special handling of <container/> config nodes
1 parent 3bd5fa0 commit 471dc6b

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

app/code/Magento/Catalog/Model/Category/DataProvider.php

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -659,14 +659,31 @@ protected function getFieldsMap()
659659
->create(['componentName' => $referenceName])
660660
->get($referenceName);
661661

662+
if (empty($config)) {
663+
return [];
664+
}
665+
662666
$fieldsMap = [];
663667

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;
668680
}
669681
}
682+
683+
// Remove empty groups
684+
if (empty($fieldsMap[$group])) {
685+
unset($fieldsMap[$group]);
686+
}
670687
}
671688

672689
return $fieldsMap;

0 commit comments

Comments
 (0)