Format.htmlentities ViewHelper <f:format.htmlentities>
ViewHelper to apply htmlentities escaping to a value, transforming all HTML special characters to entity representations (like " to ").
Go to the source code of this ViewHelper: Format\HtmlentitiesViewHelper.php (GitHub).
Table of contents
Examples
Default notation
packages/my_extension/Resources/Private/Templates/Content/Text.fluid.html
<f:format.htmlentities>{text}</f:format.htmlentities>
Copied!
Text containing the following signs & " ' < > will be processed by
htmlentities.
These will result in: & " ' < >.
Inline notation
packages/my_extension/Resources/Private/Templates/Content/Text.fluid.html
{text -> f:format.htmlentities(encoding: 'ISO-8859-1')}
Copied!
Text containing the following signs & " ' < > will be processed by
htmlentities.
These will result in: & " ' < >.
But encoded as ISO-8859-1.
Arguments of the <f:format.htmlentities> ViewHelper
doubleEncode
-
- Type
- bool
- Default
- true
If FALSE existing html entities won't be encoded, the default is to convert everything.
encoding
-
- Type
- string
Define the encoding used when converting characters (Default: UTF-8
keepQuotes
-
- Type
- bool
- Default
- false
If TRUE, single and double quotes won't be replaced (sets ENT_NOQUOTES flag).
value
-
- Type
- string
string to format