StripTagsViewHelper extends AbstractViewHelper uses CompileWithContentArgumentAndRenderStatic

ViewHelper

This class is the implementation of a Fluid ViewHelper.

View this class in the TYPO3 ViewHelper reference: <f:format.striptags>

FinalYes

Removes tags from the given string (applying PHPs :php:`strip_tags()` function) See https://www.php.net/manual/function.strip-tags.php.

Examples

Default notation

::

<f:format.stripTags>Some Text with Tags and an Ümlaut.</f:format.stripTags>

Some Text with Tags and an Ümlaut. :php:strip_tags() applied.

.. note:: Encoded entities are not decoded.

Default notation with allowedTags

::

<f:format.stripTags allowedTags="

<script>">

paragraph

span
divider
<iframe>iframe</iframe><script>script</script> </f:format.stripTags>

Output::

paragraph

span
divider
iframe<script>script</script>

Inline notation

::

{text -> f:format.stripTags()}

Text without tags :php:strip_tags() applied.

Inline notation with allowedTags

::

{text -> f:format.stripTags(allowedTags: "

<script>")}

Text with p, span, div and script Tags inside, all other tags are removed.

Table of Contents

Properties

$escapeChildren  : bool
To ensure all tags are removed, child node's output must not be escaped
$escapeOutput  : bool
No output escaping as some tags may be allowed

Methods

initializeArguments()  : void
renderStatic()  : mixed
Applies strip_tags() on the specified value if it's string-able.
resolveContentArgumentName()  : string
Explicitly set argument name to be used as content.

Properties

$escapeChildren

To ensure all tags are removed, child node's output must not be escaped

protected bool $escapeChildren = false

$escapeOutput

No output escaping as some tags may be allowed

protected bool $escapeOutput = false

Methods

initializeArguments()

public initializeArguments() : void

renderStatic()

Applies strip_tags() on the specified value if it's string-able.

public static renderStatic(array<string|int, mixed> $arguments, Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) : mixed
Parameters
$arguments : array<string|int, mixed>
$renderChildrenClosure : Closure
$renderingContext : RenderingContextInterface
Tags
see
https://www.php.net/manual/function.strip-tags.php

resolveContentArgumentName()

Explicitly set argument name to be used as content.

public resolveContentArgumentName() : string
Return values
string

        
On this page

Search results