NavigationConfigForm: Update a parent's name on all childrens as well
refs #5600
This commit is contained in:
parent
ed875b5297
commit
c077dbd15a
|
@ -349,15 +349,26 @@ class NavigationConfigForm extends ConfigForm
|
|||
$shared = true;
|
||||
}
|
||||
|
||||
$oldName = null;
|
||||
if (isset($data['name'])) {
|
||||
if ($data['name'] !== $name) {
|
||||
$config->removeSection($name);
|
||||
$oldName = $name;
|
||||
$name = $data['name'];
|
||||
}
|
||||
|
||||
unset($data['name']);
|
||||
}
|
||||
|
||||
if ($oldName) {
|
||||
// Update the parent name on all direct children
|
||||
foreach ($config as $sectionConfig) {
|
||||
if ($sectionConfig->parent === $oldName) {
|
||||
$sectionConfig->parent = $name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$itemConfig->merge($data);
|
||||
foreach ($itemConfig->toArray() as $k => $v) {
|
||||
if ($v === null) {
|
||||
|
|
Loading…
Reference in New Issue