HtmlViewHelper extends AbstractViewHelper
This class is the implementation of a Fluid ViewHelper.
View this class in the TYPO3 ViewHelper reference: <f:format.html>
Renders a string by passing it to a TYPO3 `parseFunc`_.
You can either specify a path to the TypoScript setting or set the parseFunc
_ options directly.
By default :typoscript:lib.parseFunc_RTE
is used to parse the string.
The view helper must not be used in backend context, as it triggers frontend logic.
Instead, use :html:<f:sanitize.html />
to secure a given HTML string or :html:<f:transform.html />
to parse links in HTML.
Examples
Default parameters
::
<f:format.html>{$myConstant.project} is a cool CMS (TYPO3).</f:format.html>
Output::
TYPO3 is a cool CMS (TYPO3).
Depending on TYPO3 constants.
Custom parseFunc
::
<f:format.html parseFuncTSPath="lib.parseFunc">TYPO3 is a cool CMS (TYPO3).</f:format.html>
Output::
TYPO3 is a cool CMS (TYPO3).
Data argument
If you work with TypoScript :typoscript:field
property, you should add the current record as data
to the ViewHelper to allow processing the field
and dataWrap
properties correctly.
::
<f:format.html data="{newsRecord}" parseFuncTSPath="lib.news">News title: </f:format.html>
After "dataWrap = |{FIELD:title}" you may have this Output::
News title: TYPO3, greatest CMS ever
Current argument
Use the current
argument to set the current value of the content object.
::
<f:format.html current="{strContent}" parseFuncTSPath="lib.info">I'm gone</f:format.html>
After setContentToCurrent = 1
you may have this output::
Thanks Kasper for this great CMS
CurrentValueKey argument
Use the currentValueKey
argument to define a value of data object as the current value.
::
<f:format.html data="{contentRecord}" currentValueKey="header" parseFuncTSPath="lib.content">Content: </f:format.html>
After dataWrap = |{CURRENT:1}
you may have this Output::
Content: How to install TYPO3 in under 2 minutes ;-)
Inline notation
::
{someText -> f:format.html(parseFuncTSPath: 'lib.parseFunc')}
Output::
TYPO3 is a cool CMS (TYPO3).
.. _parseFunc: https://docs.typo3.org/m/typo3/reference-typoscript/main/en-us/Functions/Parsefunc.html
Table of Contents
Properties
- $escapeChildren : bool
- Children must not be escaped, to be able to pass {bodytext} directly to it
- $escapeOutput : bool
- Plain HTML should be returned, no output escaping allowed
Methods
- initializeArguments() : void
- render() : string
Properties
$escapeChildren
Children must not be escaped, to be able to pass {bodytext} directly to it
protected
bool
$escapeChildren
= false
$escapeOutput
Plain HTML should be returned, no output escaping allowed
protected
bool
$escapeOutput
= false
Methods
initializeArguments()
public
initializeArguments() : void
render()
public
render() : string