/** * Scan all controllers with given name in the application and (loaded) module folders and collects their provided * tabs * * @param string $controllerName The name of the controllers to use for tab collection * * @return Tabs A {@link Tabs} instance containing the application tabs first followed by the * tabs provided from the modules */ public static function collectControllerTabs($controllerName) { $controller = '\\Icinga\\' . Dispatcher::CONTROLLER_NAMESPACE . '\\' . $controllerName; $applicationTabs = $controller::createProvidedTabs(); $moduleTabs = self::collectModuleTabs($controllerName); $tabs = new Tabs(); foreach ($applicationTabs as $name => $tab) { $tabs->add($name, $tab); } foreach ($moduleTabs as $name => $tab) { // Don't overwrite application tabs if the module wants to if ($tabs->has($name)) { continue; } $tabs->add($name, $tab); } return $tabs; }
/** * Scan all controllers with the provided name * in the application and (loaded) module folders and collects their provided tabs * * @param string $controller The name of the controllers to use for tab collection * * @return Tabs A @see Tabs instance containing the application tabs first * followed by the tabs provided from the modules */ public static function collectControllerTabs($controller) { require_once Icinga::app()->getApplicationDir('/controllers/' . $controller . '.php'); $applicationTabs = $controller::createProvidedTabs(); $moduleTabs = self::collectModuleTabs($controller); $tabs = new Tabs(); foreach ($applicationTabs as $name => $tab) { $tabs->add($name, $tab); } foreach ($moduleTabs as $name => $tab) { // don't overwrite application tabs if the module wants to if ($tabs->has($name)) { continue; } $tabs->add($name, $tab); } return $tabs; }