modules: Fix that the forms namespace is not registered when the module does not have any library file

This commit is contained in:
Eric Lippmann 2015-01-14 13:24:31 +01:00
parent 4971037b37
commit b983f1901b
1 changed files with 7 additions and 7 deletions

View File

@ -759,15 +759,15 @@ class Module
protected function registerAutoloader() protected function registerAutoloader()
{ {
$moduleName = ucfirst($this->getName()); $moduleName = ucfirst($this->getName());
$moduleLibraryDir = $this->getLibDir(). '/'. $moduleName; $moduleLibraryDir = $this->getLibDir(). '/'. $moduleName;
if (is_dir($this->getBaseDir()) && is_dir($this->getLibDir()) && is_dir($moduleLibraryDir)) { if (is_dir($moduleLibraryDir)) {
$this->app->getLoader()->registerNamespace('Icinga\\Module\\' . $moduleName, $moduleLibraryDir); $this->app->getLoader()->registerNamespace('Icinga\\Module\\' . $moduleName, $moduleLibraryDir);
if (is_dir($this->getFormDir())) {
$this->app->getLoader()->registerNamespace(
'Icinga\\Module\\' . $moduleName. '\\Forms',
$this->getFormDir()
);
} }
$moduleFormDir = $this->getFormDir();
if (is_dir($moduleFormDir)) {
$this->app->getLoader()->registerNamespace('Icinga\\Module\\' . $moduleName. '\\Forms', $moduleFormDir);
} }
return $this; return $this;