3
基本上,我正在尋找與對象和數組的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) }}
你可以添加applyFilter實現嗎? – vishal