HtmlentitiesDecodeViewHelper extends AbstractEncodingViewHelper uses CompileWithContentArgumentAndRenderStatic
Applies :php:`html_entity_decode()` to a value.
See https://www.php.net/html_entity_decode.
Examples
Default notation
::
<f:format.htmlentitiesDecode>{text}</f:format.htmlentitiesDecode>
Text containing the following escaped signs: &
"
'
<
>
, will be processed by :php:html_entity_decode()
.
These will result in: &
"
'
<
>
.
Inline notation
::
{text -> f:format.htmlentitiesDecode(encoding: 'ISO-8859-1')}
Text containing the following escaped signs: &
"
'
<
>
, will be processed by :php:html_entity_decode()
.
These will result in: &
"
'
<
>
.
But encoded as ISO-8859-1.
Table of Contents
Properties
- $defaultEncoding : string
- $escapeChildren : bool
- We accept value and children interchangeably, thus we must disable children escaping.
- $escapeOutput : bool
- If we decode, we must not encode again after that.
Methods
- initializeArguments() : mixed
- Initialize ViewHelper arguments
- renderStatic() : string
- Converts all HTML entities to their applicable characters as needed using PHPs html_entity_decode() function.
- resolveDefaultEncoding() : string
- Resolve the default encoding. If none is set in Frontend or Backend, uses UTF-8.
Properties
$defaultEncoding
protected
static string
$defaultEncoding
$escapeChildren
We accept value and children interchangeably, thus we must disable children escaping.
protected
bool
$escapeChildren
= false
$escapeOutput
If we decode, we must not encode again after that.
protected
bool
$escapeOutput
= false
Methods
initializeArguments()
Initialize ViewHelper arguments
public
initializeArguments() : mixed
renderStatic()
Converts all HTML entities to their applicable characters as needed using PHPs html_entity_decode() function.
public
static renderStatic(array<string|int, mixed> $arguments, Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) : string
Parameters
- $arguments : array<string|int, mixed>
- $renderChildrenClosure : Closure
- $renderingContext : RenderingContextInterface
Tags
Return values
stringresolveDefaultEncoding()
Resolve the default encoding. If none is set in Frontend or Backend, uses UTF-8.
protected
static resolveDefaultEncoding() : string
Return values
string —the encoding