Fix function call compilation using {functionname} syntax for in-template defined functions.

This commit is contained in:
Simon Wisselink
2023-01-23 16:56:42 +01:00
parent ecac24d073
commit 2cf658c9c3

View File

@@ -1112,10 +1112,10 @@ class Template extends BaseCompiler {
} }
} }
// template defined by {template} tag // call to function previousely defined by {function} tag
if ($this->canCompileTemplateCall($tag)) { if ($this->canCompileTemplateFunctionCall($tag)) {
$args['_attr']['name'] = "'{$tag}'"; $args['_attr']['name'] = "'{$tag}'";
$tagCompiler = $this->getTagCompiler($tag); $tagCompiler = $this->getTagCompiler('call');
// compile this tag // compile this tag
$_output = $tagCompiler === null ? false : $tagCompiler->compile($args, $this, $parameter); $_output = $tagCompiler === null ? false : $tagCompiler->compile($args, $this, $parameter);
return $this->has_code ? $_output : null; return $this->has_code ? $_output : null;
@@ -1324,7 +1324,7 @@ class Template extends BaseCompiler {
* @return bool * @return bool
* @throws Exception * @throws Exception
*/ */
private function canCompileTemplateCall(string $tag): bool { private function canCompileTemplateFunctionCall(string $tag): bool {
return return
isset($this->parent_compiler->tpl_function[$tag]) isset($this->parent_compiler->tpl_function[$tag])
|| ( || (