icingaweb2/library/Icinga/Application/Modules/MenuItemContainer.php

56 lines
1.1 KiB
PHP
Raw Normal View History

2015-09-04 13:54:23 +02:00
<?php
/* Icinga Web 2 | (c) 2015 Icinga Development Team | GPLv2+ */
2015-09-04 13:54:23 +02:00
namespace Icinga\Application\Modules;
/**
* Container for module menu items
2015-09-04 13:54:23 +02:00
*/
class MenuItemContainer extends NavigationItemContainer
2015-09-04 13:54:23 +02:00
{
/**
* 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();
2015-09-04 13:54:23 +02:00
}
/**
* Add a new sub menu
2015-09-04 13:54:23 +02:00
*
* @param string $name
* @param array $properties
*
* @return MenuItemContainer The newly added sub menu
2015-09-04 13:54:23 +02:00
*/
public function add($name, array $properties = array())
2015-09-04 13:54:23 +02:00
{
$child = new MenuItemContainer($name, $properties);
2015-09-04 13:54:23 +02:00
$this->children[] = $child;
return $child;
}
}