mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-26 23:34:08 +02:00
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;
|
$shared = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$oldName = null;
|
||||||
if (isset($data['name'])) {
|
if (isset($data['name'])) {
|
||||||
if ($data['name'] !== $name) {
|
if ($data['name'] !== $name) {
|
||||||
$config->removeSection($name);
|
$config->removeSection($name);
|
||||||
|
$oldName = $name;
|
||||||
$name = $data['name'];
|
$name = $data['name'];
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($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);
|
$itemConfig->merge($data);
|
||||||
foreach ($itemConfig->toArray() as $k => $v) {
|
foreach ($itemConfig->toArray() as $k => $v) {
|
||||||
if ($v === null) {
|
if ($v === null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user