Twig Components / Methods / striptags
striptags(allowable_tags)
is a Twig filter to strip SGML/XML tags and replace adjacent whitespace by one space.
{{ some_html|striptags }}
You can also provide tags which should not be stripped:
{{ some_html|striptags('<br><p>') }}
In this example, the
,
,
, and
tags won't be removed from the string.Note:Internally, Twig uses the PHP strip_tags function.
ArgumentsΒΆ
allowable_tags
: Tags which should not be stripped
Source: Twig
Edit this page on GitHub
Couldn't find what you were looking for? We are happy to help you in the forum, on Slack or on Github.
Couldn't find what you were looking for? We are happy to help you in the forum, on Slack or on Github.