Matthias Andreas Benkard | 12a5735 | 2021-12-28 18:02:04 +0100 | [diff] [blame^] | 1 | ``apply`` |
2 | ========= | ||||
3 | |||||
4 | The ``apply`` tag allows you to apply Twig filters on a block of template data: | ||||
5 | |||||
6 | .. code-block:: twig | ||||
7 | |||||
8 | {% apply upper %} | ||||
9 | This text becomes uppercase | ||||
10 | {% endapply %} | ||||
11 | |||||
12 | You can also chain filters and pass arguments to them: | ||||
13 | |||||
14 | .. code-block:: html+twig | ||||
15 | |||||
16 | {% apply lower|escape('html') %} | ||||
17 | <strong>SOME TEXT</strong> | ||||
18 | {% endapply %} | ||||
19 | |||||
20 | {# outputs "<strong>some text</strong>" #} |