mirror of
https://github.com/twigphp/Twig.git
synced 2026-11-01 16:45:50 +00:00
20 lines
349 B
Plaintext
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
|