基本上,我正在寻找与attribute()
对象和数组函数等效的过滤器。我希望能够应用一个过滤器,其名称存储在一个变量中。
{#
This works and is really useful
prints object.someVar
#}
{% set varName = 'someVar' %}
{{ attribute(object,varName) }}
{#
The function "filter" does not exist
#}
{% set filterName = 'somefilter' %}
{{ filter(object,filterName) }}