format.html ViewHelper <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 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 <f:sanitize.html /> to secure a given HTML string or <f:transform.html /> to parse links in HTML.

Examples

Default parameters

<f:format.html>{$myConstant.project} is a cool <b>CMS</b> (<a href="https://www.typo3.org">TYPO3</a>).</f:format.html>
Copied!

Output:

<p class="bodytext">TYPO3 is a cool <strong>CMS</strong> (<a href="https://www.typo3.org" target="_blank">TYPO3</a>).</p>
Copied!

Depending on TYPO3 constants.

Custom parseFunc

<f:format.html parseFuncTSPath="lib.parseFunc">TYPO3 is a cool <b>CMS</b> (<a href="https://www.typo3.org">TYPO3</a>).</f:format.html>
Copied!

Output:

TYPO3 is a cool <strong>CMS</strong> (<a href="https://www.typo3.org" target="_blank">TYPO3</a>).
Copied!

Data argument

If you work with 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>
Copied!

After "dataWrap = |<strong>{FIELD:title}</strong>" you may have this Output:

News title: <strong>TYPO3, greatest CMS ever</strong>
Copied!

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>
Copied!

After setContentToCurrent = 1 you may have this output:

Thanks Kasper for this great CMS
Copied!

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>
Copied!

After dataWrap = |{CURRENT:1} you may have this Output:

Content: How to install TYPO3 in under 2 minutes ;-)
Copied!

Inline notation

{someText -> f:format.html(parseFuncTSPath: 'lib.parseFunc')}
Copied!

Output:

TYPO3 is a cool <strong>CMS</strong> (<a href="https://www.typo3.org" target="_blank">TYPO3</a>).
Copied!

Arguments

parseFuncTSPath

DataType
string
Default
'lib.parseFunc_RTE'
Required
false
Description
Path to the TypoScript parseFunc setup.

data

DataType
mixed
Required
false
Description
Initialize the content object with this set of data. Either an array or object.

current

DataType
string
Required
false
Description
Initialize the content object with this value for current property.

currentValueKey

DataType
string
Required
false
Description
Define the value key, used to locate the current value for the content object

table

DataType
string
Required
false
Description
The table name associated with the "data" argument.