From 56025b0ad31a962b29c0e2330649cbe80bbf1286 Mon Sep 17 00:00:00 2001 From: Yen-Chi Chen Date: Wed, 24 Jan 2018 17:13:48 +0800 Subject: [PATCH] employ templateDir in the config when loading template files --- src/Preview.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Preview.php b/src/Preview.php index eb451de..00116a0 100644 --- a/src/Preview.php +++ b/src/Preview.php @@ -49,6 +49,10 @@ public function getTwigEnvironmentByPath($pathinfo, $options = array()) $pathinfo->getPath(), getcwd(), ); + if (isset($this->config['TemplateDir']) && count($this->config['TemplateDir'])) { + $dirs = array_merge($dirs, (array) $this->config['TemplateDir']); + } + $dirs = array_unique(array_map('realpath', $dirs)); return TwigEnvironmentFactory::create($dirs, $options); }