parent
518cdad1a8
commit
ed875b5297
|
@ -376,6 +376,8 @@ class NavigationConfigForm extends ConfigForm
|
|||
* @param string $name
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @throws IcingaException In case the navigation item has still children
|
||||
*/
|
||||
public function delete($name)
|
||||
{
|
||||
|
@ -384,6 +386,15 @@ class NavigationConfigForm extends ConfigForm
|
|||
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);
|
||||
$this->setIniConfig($config);
|
||||
return $this;
|
||||
|
|
Loading…
Reference in New Issue