‪TYPO3CMS  10.4
TYPO3\CMS\Fluid\ViewHelpers\Format\StripTagsViewHelper Class Reference
Inheritance diagram for TYPO3\CMS\Fluid\ViewHelpers\Format\StripTagsViewHelper:

Public Member Functions

 initializeArguments ()
 

Static Public Member Functions

static string renderStatic (array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
 

Protected Attributes

bool $escapeOutput = false
 
bool $escapeChildren = false
 

Detailed Description

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="<p><span><div><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: "<p><span><div><script>")}

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

Definition at line 72 of file StripTagsViewHelper.php.

Member Function Documentation

◆ initializeArguments()

TYPO3\CMS\Fluid\ViewHelpers\Format\StripTagsViewHelper::initializeArguments ( )

Initialize ViewHelper arguments

Exceptions

Definition at line 86 of file StripTagsViewHelper.php.

◆ renderStatic()

static string TYPO3\CMS\Fluid\ViewHelpers\Format\StripTagsViewHelper::renderStatic ( array  $arguments,
\Closure  $renderChildrenClosure,
RenderingContextInterface  $renderingContext 
)
static

Applies strip_tags() on the specified value.

Parameters
array$arguments
\Closure$renderChildrenClosure
\TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface$renderingContext
See also
https://www.php.net/manual/function.strip-tags.php
Returns
‪string

Definition at line 108 of file StripTagsViewHelper.php.

Member Data Documentation

◆ $escapeChildren

bool TYPO3\CMS\Fluid\ViewHelpers\Format\StripTagsViewHelper::$escapeChildren = false
protected

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

Definition at line 97 of file StripTagsViewHelper.php.

◆ $escapeOutput

bool TYPO3\CMS\Fluid\ViewHelpers\Format\StripTagsViewHelper::$escapeOutput = false
protected

No output escaping as some tags may be allowed

Definition at line 79 of file StripTagsViewHelper.php.