‪TYPO3CMS  11.5
TYPO3\CMS\Fluid\ViewHelpers\Format\HtmlentitiesViewHelper Class Reference
Inheritance diagram for TYPO3\CMS\Fluid\ViewHelpers\Format\HtmlentitiesViewHelper:
TYPO3\CMS\Fluid\ViewHelpers\Format\AbstractEncodingViewHelper

Public Member Functions

 initializeArguments ()
 

Static Public Member Functions

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

Protected Attributes

bool $escapeOutput = false
 
bool $escapeChildren = false
 

Additional Inherited Members

- ‪Static Protected Member Functions inherited from ‪TYPO3\CMS\Fluid\ViewHelpers\Format\AbstractEncodingViewHelper
static string resolveDefaultEncoding ()
 
- ‪Static Protected Attributes inherited from ‪TYPO3\CMS\Fluid\ViewHelpers\Format\AbstractEncodingViewHelper
static string $defaultEncoding
 

Detailed Description

Applies :php:htmlentities() escaping to a value. See https://www.php.net/manual/function.htmlentities.php.

Examples

Default notation

::

<f:format.htmlentities>{text}</f:format.htmlentities>

Text containing the following signs & " ' < > will be processed by :php:htmlentities(). These will result in: & " &#039; < >.

Inline notation

::

{text -> f:format.htmlentities(encoding: 'ISO-8859-1')}

Text containing the following signs & " ' < > will be processed by :php:htmlentities(). These will result in: & " &#039; < >.

But encoded as ISO-8859-1.

Definition at line 50 of file HtmlentitiesViewHelper.php.

Member Function Documentation

◆ initializeArguments()

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

Initialize ViewHelper arguments

Definition at line 68 of file HtmlentitiesViewHelper.php.

◆ renderStatic()

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

Escapes special characters with their escaped counterparts as needed using PHPs htmlentities() function.

See also
https://www.php.net/manual/function.htmlentities.php
Parameters
array$arguments
\Closure$renderChildrenClosure
RenderingContextInterface$renderingContext
Returns
‪mixed

Definition at line 85 of file HtmlentitiesViewHelper.php.

References TYPO3\CMS\Fluid\ViewHelpers\Format\AbstractEncodingViewHelper\resolveDefaultEncoding().

Member Data Documentation

◆ $escapeChildren

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

This prevents double encoding as the whole output gets encoded at the end

Definition at line 63 of file HtmlentitiesViewHelper.php.

◆ $escapeOutput

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

Output gets encoded by this viewhelper

Definition at line 57 of file HtmlentitiesViewHelper.php.