I pass a variable to my twig template in Symfony2, this variable may contain
html tags, I have tried to create an extension (function), but the variabl
{{ var|striptags('
')|raw }}
works fine, but I don't know how to pass an array to the strip_tags php function with this twig filter.
both
{{ var|striptags(['
', ''])|raw }}
and
{% set allow = ['
', ''] %}
{{ var|striptags(allow)|raw }}
throw an "Array to string conversion" exception during the rendering of a template.
Be also carefull that strip_tags php function doesn't escape html attribute like "onclick".