HtmlentitiesViewHelper extends AbstractEncodingViewHelper uses CompileWithContentArgumentAndRenderStatic
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: &
"
'
<
>
.
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: &
"
'
<
>
.
But encoded as ISO-8859-1.
Table of Contents
Properties
- $defaultEncoding : string
- $escapeChildren : bool
- This prevents double encoding as the whole output gets encoded at the end
- $escapeOutput : bool
- Output gets encoded by this viewhelper
Methods
- initializeArguments() : void
- renderStatic() : mixed
- Escapes special characters with their escaped counterparts as needed using PHPs htmlentities() function.
- resolveContentArgumentName() : string
- Explicitly set argument name to be used as content.
- resolveDefaultEncoding() : string
- Resolve the default encoding. If none is set in Frontend or Backend, uses UTF-8.
Properties
$defaultEncoding
protected
static string
$defaultEncoding
$escapeChildren
This prevents double encoding as the whole output gets encoded at the end
protected
bool
$escapeChildren
= false
$escapeOutput
Output gets encoded by this viewhelper
protected
bool
$escapeOutput
= false
Methods
initializeArguments()
public
initializeArguments() : void
renderStatic()
Escapes special characters with their escaped counterparts as needed using PHPs htmlentities() function.
public
static renderStatic(array<string|int, mixed> $arguments, Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) : mixed
Parameters
- $arguments : array<string|int, mixed>
- $renderChildrenClosure : Closure
- $renderingContext : RenderingContextInterface
Tags
resolveContentArgumentName()
Explicitly set argument name to be used as content.
public
resolveContentArgumentName() : string
Return values
stringresolveDefaultEncoding()
Resolve the default encoding. If none is set in Frontend or Backend, uses UTF-8.
protected
static resolveDefaultEncoding() : string