diff --git a/library/Icinga/Application/Modules/Module.php b/library/Icinga/Application/Modules/Module.php index ad1ec1f5d..58a3f7929 100644 --- a/library/Icinga/Application/Modules/Module.php +++ b/library/Icinga/Application/Modules/Module.php @@ -162,6 +162,13 @@ class Module */ private $app; + /** + * The CSS/LESS files this module provides + * + * @var array + */ + protected $cssFiles = array(); + /** * Routes to add to the route chain * @@ -388,6 +395,19 @@ class Module return $manager->getModule($name); } + /** + * Provide an additional CSS/LESS file + * + * @param string $path The path to the file, relative to self::$cssdir + * + * @return $this + */ + protected function provideCssFile($path) + { + $this->cssFiles[] = $this->cssdir . DIRECTORY_SEPARATOR . $path; + return $this; + } + /** * Test if module provides css * @@ -395,7 +415,12 @@ class Module */ public function hasCss() { - return file_exists($this->getCssFilename()); + if (file_exists($this->getCssFilename())) { + return true; + } + + $this->launchConfigScript(); + return !empty($this->cssFiles); } /** @@ -408,6 +433,18 @@ class Module return $this->cssdir . '/module.less'; } + /** + * Return the CSS/LESS files this module provides + * + * @return array + */ + public function getCssFiles() + { + $files = $this->cssFiles; + $files[] = $this->getCssFilename(); + return $files; + } + /** * Test if module provides js *