From 01338ff6ec86279ababa8293a5a8b34a6a414502 Mon Sep 17 00:00:00 2001 From: Celestora Date: Thu, 16 Sep 2021 20:02:35 +0300 Subject: [PATCH] Add ability to change template search path Signed-off-by: Celestora --- chandler/MVC/Routing/Router.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/chandler/MVC/Routing/Router.php b/chandler/MVC/Routing/Router.php index 860dfa5..050db3a 100644 --- a/chandler/MVC/Routing/Router.php +++ b/chandler/MVC/Routing/Router.php @@ -142,8 +142,12 @@ class Router #TODO: move this to delegateView $tpl = $this->scope["_template"] ?? "$presenterName/$action.xml"; - if($tpl[0] !== "/") - $tpl = CHANDLER_EXTENSIONS_ENABLED . "/$namespace/Web/Presenters/templates/$tpl"; + if($tpl[0] !== "/") { + $dir = CHANDLER_EXTENSIONS_ENABLED . "/$namespace/Web/Presenters/templates"; + $tpl = "$dir/$tpl"; + if(isset($this->scope["_templatePath"])) + $tpl = str_replace($dir, $this->scope["_templatePath"], $tpl); + } $output = $this->delegateView($tpl, $presenter);