From 7fb0b63bb53b792e764cdb69441865e86bb212f0 Mon Sep 17 00:00:00 2001 From: Nico Date: Mon, 9 Nov 2020 17:31:15 +0100 Subject: [PATCH] Add new locator schema `templates://` Also see https://github.com/getgrav/grav-learn/issues/851 --- system/src/Grav/Common/Twig/Twig.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/system/src/Grav/Common/Twig/Twig.php b/system/src/Grav/Common/Twig/Twig.php index 5c9008fb92..f3b89ccf40 100644 --- a/system/src/Grav/Common/Twig/Twig.php +++ b/system/src/Grav/Common/Twig/Twig.php @@ -103,6 +103,9 @@ public function init() $this->twig_paths = array_merge($this->twig_paths, $core_templates); $this->loader = new \Twig_Loader_Filesystem($this->twig_paths); + + // Add all template path as schema for locator + $locator->addPath('templates', '', $this->twig_paths); // Register all other prefixes as namespaces in twig foreach ($locator->getPaths('theme') as $prefix => $_) {