Files
Twig/tests/Fixtures/macros/arrow_as_arg.test
2024-10-07 23:04:29 +02:00

20 lines
349 B
Plaintext

--TEST--
macro
--TEMPLATE--
{% set people = [
{first: "Bob", last: "Smith"},
{first: "Alice", last: "Dupond"},
] %}
{% set first_name_fn = (p) => p.first %}
{{ _self.display_people(people, first_name_fn) }}
{% macro display_people(people, fn) %}
{{ people|map(fn)|join(', ') }}
{% endmacro %}
--DATA--
return []
--EXPECT--
Bob, Alice