icingaweb2/library/Icinga/Application/Modules/MenuItemContainer.php
Eric Lippmann 662de28f85 License source files as GPL-3.0-or-later
Add SPDX license headers and mark source files as GPL-3.0-or-later to
preserve the option to relicense under later GPL versions.
2026-03-26 17:49:26 +01:00

57 lines
1.2 KiB
PHP

<?php
// SPDX-FileCopyrightText: 2018 Icinga GmbH <https://icinga.com>
// SPDX-License-Identifier: GPL-3.0-or-later
namespace Icinga\Application\Modules;
/**
* Container for module menu items
*/
class MenuItemContainer extends NavigationItemContainer
{
/**
* This menu item's children
*
* @var MenuItemContainer[]
*/
protected $children;
/**
* Set this menu item's children
*
* @param MenuItemContainer[] $children
*
* @return $this
*/
public function setChildren(array $children)
{
$this->children = $children;
return $this;
}
/**
* Return this menu item's children
*
* @return array
*/
public function getChildren()
{
return $this->children ?: array();
}
/**
* Add a new sub menu
*
* @param string $name
* @param array $properties
*
* @return MenuItemContainer The newly added sub menu
*/
public function add($name, array $properties = array())
{
$child = new MenuItemContainer($name, $properties);
$this->children[] = $child;
return $child;
}
}