Sanitize.html ViewHelper <f:sanitize.html>
ViewHelper to pass a given content through typo3/ to mitigate potential cross-site scripting occurrences. The build option by default uses the class TYPO3\, which declares allowed HTML tags, attributes and their values.
Go to the source code of this ViewHelper: Sanitize\HtmlViewHelper.php (GitHub).
Table of contents
Examples
Default parameters
packages/my_extension/Resources/Private/Templates/Content/Text.fluid.html
<f:sanitize.html>
<img src="/img.png" class="image" onmouseover="alert(document.location)">
</f:sanitize.html>
Copied!
Output
<img src="/img.png" class="image">
Copied!
Inline notation
packages/my_extension/Resources/Private/Templates/Content/Text.fluid.html
{richTextFieldContent -> f:sanitize.html(build: 'default')}
Copied!
Arguments of the <f:sanitize.html> ViewHelper
build
-
- Type
- string
- Default
- 'default'
preset name or class-like name of sanitization builder