mirror of
https://github.com/openvk/chandler.git
synced 2025-01-22 15:24:15 +03:00
Fix logic error in view delegation thing
This commit is contained in:
parent
624359f3f5
commit
5f839e1bb6
1 changed files with 11 additions and 15 deletions
|
@ -141,21 +141,17 @@ class Router
|
||||||
$this->scope += array_merge_recursive($presenter->getTemplateScope(), []); #TODO: add default parameters
|
$this->scope += array_merge_recursive($presenter->getTemplateScope(), []); #TODO: add default parameters
|
||||||
#TODO: move this to delegateView
|
#TODO: move this to delegateView
|
||||||
|
|
||||||
$tpl = "$presenterName/$action.xml";
|
$tpl = $this->scope["_template"] ?? "$presenterName/$action.xml";
|
||||||
if(!is_null($this->scope["_template"])) {
|
if($tpl[0] !== "/") {
|
||||||
$tplCandidate = $this->scope["_template"];
|
|
||||||
if($tplCandidate[0] !== "/") {
|
|
||||||
$dir = CHANDLER_EXTENSIONS_ENABLED . "/$namespace/Web/Presenters/templates";
|
$dir = CHANDLER_EXTENSIONS_ENABLED . "/$namespace/Web/Presenters/templates";
|
||||||
$tplCandidate = "$dir/$tplCandidate";
|
$tpl = "$dir/$tplCandidate";
|
||||||
if(isset($this->scope["_templatePath"]))
|
if(isset($this->scope["_templatePath"]))
|
||||||
$tplCandidate = str_replace($dir, $this->scope["_templatePath"], $tplCandidate);
|
$tpl = str_replace($dir, $this->scope["_templatePath"], $tpl);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(file_exists($tplCandidate)) {
|
if(!file_exists($tpl)) {
|
||||||
$tpl = $tplCandidate;
|
trigger_error("Could not open $tpl as template, falling back.", E_USER_NOTICE);
|
||||||
} else {
|
$tpl = "$presenterName/$action.xml";
|
||||||
trigger_error("Could not open $tplCandidate as template, falling back to $tpl", E_USER_NOTICE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$output = $this->delegateView($tpl, $presenter);
|
$output = $this->delegateView($tpl, $presenter);
|
||||||
|
|
Loading…
Reference in a new issue