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>

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()  : mixed
Initialize ViewHelper arguments
renderStatic()  : string
Applies strip_tags() on the specified value.

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()

Initialize ViewHelper arguments

public initializeArguments() : mixed
Tags
throws
Exception

renderStatic()

Applies strip_tags() on the specified value.

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

        
On this page

Search results