From a41f6fb882f0a6a6611232cd20adc21838b5fbd9 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Fri, 29 Sep 2017 15:37:44 +0200 Subject: [PATCH] Automatically load all built-in templates refs #57 --- library/Graphite/Graphing/GraphingTrait.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/library/Graphite/Graphing/GraphingTrait.php b/library/Graphite/Graphing/GraphingTrait.php index c6cca41..0d74a9d 100644 --- a/library/Graphite/Graphing/GraphingTrait.php +++ b/library/Graphite/Graphing/GraphingTrait.php @@ -3,6 +3,7 @@ namespace Icinga\Module\Graphite\Graphing; use Icinga\Application\Config; +use Icinga\Application\Icinga; use Icinga\Exception\ConfigurationError; use Icinga\Web\Url; @@ -30,7 +31,12 @@ trait GraphingTrait protected static function getAllTemplates() { if (static::$allTemplates === null) { - $allTemplates = new Templates(); + $allTemplates = (new Templates())->loadDir( + Icinga::app() + ->getModuleManager() + ->getModule('graphite') + ->getBaseDir() . DIRECTORY_SEPARATOR . 'templates' + ); $path = Config::resolvePath('modules/graphite/templates'); if (file_exists($path)) {