Add ability to change template search path

Signed-off-by: Celestora <kitsuruko@gmail.com>
This commit is contained in:
Celestora 2021-09-16 20:02:35 +03:00
parent 5855601d59
commit 01338ff6ec
1 changed files with 6 additions and 2 deletions

View File

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