mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-29 16:54:04 +02:00
Navigation: Add method load()
Supports currently only module menus. refs #5600
This commit is contained in:
parent
27a6b5bb75
commit
63f8f34c15
@ -354,6 +354,30 @@ class Navigation implements ArrayAccess, Countable, IteratorAggregate
|
||||
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
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user