NavigationConfigForm: Update a parent's name on all childrens as well

refs #5600
This commit is contained in:
Johannes Meyer 2015-09-18 16:00:33 +02:00
parent ed875b5297
commit c077dbd15a
1 changed files with 11 additions and 0 deletions

View File

@ -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) {