mirror of
https://github.com/getformwork/formwork.git
synced 2025-02-25 02:02:57 +01:00
Throw an exception on template helpers called outside rendering context
This commit is contained in:
parent
4c8ca2d69f
commit
f4ee683fb6
@ -257,6 +257,10 @@ class Template
|
|||||||
public function __call($name, $arguments)
|
public function __call($name, $arguments)
|
||||||
{
|
{
|
||||||
if (TemplateHelpers::has($name)) {
|
if (TemplateHelpers::has($name)) {
|
||||||
|
if (!$this->rendering) {
|
||||||
|
throw new RuntimeException(__METHOD__ . ' is allowed only in rendering context');
|
||||||
|
}
|
||||||
|
|
||||||
$helper = TemplateHelpers::get($name);
|
$helper = TemplateHelpers::get($name);
|
||||||
return $helper(...$arguments);
|
return $helper(...$arguments);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user