Closed KarelWintersky closed 10 months ago
Smarty 4.3
Please see the documentation on writing plugins. Your plugin handler should accept an array of $params and a Smarty_Internal_Template $template. modifiers do not get passed the Smarty_Internal_Template object.
Why
registerPlugin('modifier', 'size_format', function size_format(int $size, int $decimals = 0, string $decimal_separator = '.', string $thousands_separator = ','):string
is possible too ?
Modifier plugins are a little different: modifiers do not get passed the Smarty_Internal_Template object.
If you do it like this:
and
works correct.
If you try to define a function directly, with a list of arguments:
and
throws FATAL Error like this:
The fact is that in the definition of a “modifier” type plugin, both definitions are possible:
and
Is this a systemic limitation of the template engine and is impossible in principle, or am I doing something wrong?