Automatically load all built-in templates

refs #57
This commit is contained in:
Alexander A. Klimov 2017-09-29 15:37:44 +02:00
parent 8f11f64c45
commit a41f6fb882

View file

@ -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)) {