From 52c05f2301e853b2ecf2e10450bd665e7eba6ca8 Mon Sep 17 00:00:00 2001 From: Jill Stingray Date: Wed, 10 Jun 2020 15:12:46 +0300 Subject: [PATCH] Simplify template overrides --- chandler/MVC/Routing/Router.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/chandler/MVC/Routing/Router.php b/chandler/MVC/Routing/Router.php index d5cc0eb..d9f2ffa 100644 --- a/chandler/MVC/Routing/Router.php +++ b/chandler/MVC/Routing/Router.php @@ -130,11 +130,13 @@ class Router $this->scope += array_merge_recursive($presenter->getTemplateScope(), []); #TODO: add default parameters #TODO: move this to delegateView - $output = $this->delegateView( - $this->scope["_template"] ?? CHANDLER_EXTENSIONS_ENABLED . "/$namespace/Web/Presenters/templates/$presenterName/$action.xml", - $presenter - ); - + + $tpl = $this->scope["_template"] ?? "$presenterName/$action.xml"; + if($tpl[0] !== "/") + $tpl = CHANDLER_EXTENSIONS_ENABLED . "/$namespace/Web/Presenters/templates/$tpl"; + + $output = $this->delegateView($tpl, $presenter); + $presenter->onAfterRender(); } catch(InterruptedException $ex) {}