Files
Twig/doc/filters/invoke.rst
Fabien Potencier 3e93e91f59 Finish the work
2025-01-12 18:48:43 +01:00

17 lines
363 B
ReStructuredText

``invoke``
==========
.. versionadded:: 3.19
The ``invoke`` filter has been added in Twig 3.19.
The ``invoke`` filter invokes an arrow function with the given arguments:
.. code-block:: twig
{% set person = { first: "Bob", last: "Smith" } %}
{% set func = p => "#{p.first} #{p.last}" %}
{{ func|invoke(person) }}
{# outputs Bob Smith #}