Navigation: Add method load()

Supports currently only module menus.

refs #5600
This commit is contained in:
Johannes Meyer 2015-09-04 13:55:31 +02:00
parent 27a6b5bb75
commit 63f8f34c15
1 changed files with 24 additions and 0 deletions

View File

@ -354,6 +354,30 @@ class Navigation implements ArrayAccess, Countable, IteratorAggregate
return $this; return $this;
} }
/**
* Extend this navigation set with all additional items of the given type
*
* This will fetch navigation items from the following sources:
* * User Shareables
* * User Preferences
* * Modules
* Any existing entry will be overwritten by one that is coming later in order.
*
* @param string $type
*
* @return $this
*/
public function load($type)
{
foreach (Icinga::app()->getModuleManager()->getLoadedModules() as $module) {
if ($type === 'menu-item') {
$this->merge($module->getMenu());
}
}
return $this;
}
/** /**
* Create and return a new set of navigation items for the given configuration * Create and return a new set of navigation items for the given configuration
* *