/** * Collects the tabs from the createProvidedTabs() method in the configuration controller * * If the module doesn't have the given controller or createProvidedTabs method in the controller * an empty array will be returned * * @param string $controller The name of the controller that provides tabs via createProvidedTabs * @param Module $module The module instance that provides the controller * * @return array */ private static function createModuleConfigurationTabs($controller, Module $module) { $controllerDir = $module->getControllerDir(); $name = $module->getName(); $controllerDir = $controllerDir . '/' . $controller . '.php'; $controllerName = ucfirst($name) . '_' . $controller; if (is_readable($controllerDir)) { require_once realpath($controllerDir); if (!method_exists($controllerName, "createProvidedTabs")) { return array(); } $tab = $controllerName::createProvidedTabs(); if (!is_array($tab)) { $tab = array($name => $tab); } return $tab; } return array(); }
/** * Collects the tabs from the createProvidedTabs() method in the configuration controller * * If the module doesn't have the given controller or createProvidedTabs method in the controller an empty array * will be returned * * @param string $controllerName The name of the controller that provides tabs via createProvidedTabs * @param Module $module The module instance that provides the controller * * @return array */ private static function createModuleConfigurationTabs($controllerName, Module $module) { // TODO(el): Only works for controllers w/o namepsace: https://dev.icinga.org/issues/4149 $controllerDir = $module->getControllerDir(); $name = $module->getName(); $controllerDir = $controllerDir . '/' . $controllerName . '.php'; $controllerName = ucfirst($name) . '_' . $controllerName; if (is_readable($controllerDir)) { require_once realpath($controllerDir); if (!method_exists($controllerName, 'createProvidedTabs')) { return array(); } $tab = $controllerName::createProvidedTabs(); if (!is_array($tab)) { $tab = array($name => $tab); } return $tab; } return array(); }