apply
¶
这个 apply
标记允许您对模板数据块应用Twig过滤器:
1 2 3 | {% apply upper %}
This text becomes uppercase
{% endapply %}
|
也可以链接筛选器并将参数传递给它们:
1 2 3 4 5 | {% apply lower|escape('html') %}
<strong>SOME TEXT</strong>
{% endapply %}
{# outputs "<strong>some text</strong>" #}
|