mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-27 07:44:04 +02:00
parent
518cdad1a8
commit
ed875b5297
@ -376,6 +376,8 @@ class NavigationConfigForm extends ConfigForm
|
|||||||
* @param string $name
|
* @param string $name
|
||||||
*
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
|
*
|
||||||
|
* @throws IcingaException In case the navigation item has still children
|
||||||
*/
|
*/
|
||||||
public function delete($name)
|
public function delete($name)
|
||||||
{
|
{
|
||||||
@ -384,6 +386,15 @@ class NavigationConfigForm extends ConfigForm
|
|||||||
throw new NotFoundError('No navigation item called "%s" found', $name);
|
throw new NotFoundError('No navigation item called "%s" found', $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$children = $this->getFlattenedChildren($name);
|
||||||
|
if (! empty($children)) {
|
||||||
|
throw new IcingaException(
|
||||||
|
'Unable to delete navigation item "%s". There are other items dependent from it: %s',
|
||||||
|
$name,
|
||||||
|
join(', ', $children)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$config->removeSection($name);
|
$config->removeSection($name);
|
||||||
$this->setIniConfig($config);
|
$this->setIniConfig($config);
|
||||||
return $this;
|
return $this;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user