mirror of
https://github.com/twigphp/Twig.git
synced 2026-08-30 12:06:56 +00:00
docs and changelog
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
# 3.19.0 (2025-XX-XX)
|
||||
|
||||
* Add the `invoke` filter
|
||||
* Make `{}` optional for the `types` tag
|
||||
* Add `LastModifiedExtensionInterface` and implementation in `AbstractExtension` to track modification of runtime classes
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
``invoke``
|
||||
=======
|
||||
|
||||
The ``invoke`` filter invokes an arrow function with the 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 #}
|
||||
|
||||
Note that the arrow function has access to the current context.
|
||||
|
||||
Arguments
|
||||
---------
|
||||
|
||||
All given arguments are passed to the arrow function
|
||||
@@ -1018,6 +1018,12 @@ The following operators don't fit into any of the other categories:
|
||||
Arrow function support for functions, macros, and method calls was added in
|
||||
Twig 3.15 (filters and tests were already supported).
|
||||
|
||||
Arrow functions can be invoked using the ``invoke`` filter.
|
||||
|
||||
.. versionadded:: 3.19
|
||||
|
||||
The ``invoke`` filter has been added in Twig 3.19.
|
||||
|
||||
Operators
|
||||
~~~~~~~~~
|
||||
|
||||
|
||||
Reference in New Issue
Block a user