HtmlViewHelper extends AbstractViewHelper uses CompileWithRenderStatic

ViewHelper

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>foo bar. Some <LINK 1>link</LINK>.</f:format.html>

Output::

foo bar. Some link.

Depending on TYPO3 setup.

Custom parseFunc

::

<f:format.html parseFuncTSPath="lib.parseFunc">foo bar. Some <LINK 1>link</LINK>.</f:format.html>

Output::

foo bar. Some link.

Inline notation

::

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

Output::

foo bar. Some link.

.. _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
$tsfeBackup  : TypoScriptFrontendController

Methods

initializeArguments()  : mixed
Initialize arguments.
renderStatic()  : string
resetFrontendEnvironment()  : mixed
Resets $GLOBALS['TSFE'] if it was previously changed by simulateFrontendEnvironment()
simulateFrontendEnvironment()  : mixed
Copies the specified parseFunc configuration to $GLOBALS['TSFE']->tmpl->setup in Backend mode This somewhat hacky work around is currently needed because the parseFunc() function of \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer relies on those variables to be set

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()

Initialize arguments.

public initializeArguments() : mixed
Tags
throws
Exception

renderStatic()

public static renderStatic(array<string|int, mixed> $arguments, Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) : string
Parameters
$arguments : array<string|int, mixed>
$renderChildrenClosure : Closure
$renderingContext : RenderingContextInterface
Return values
string

the parsed string.

resetFrontendEnvironment()

Resets $GLOBALS['TSFE'] if it was previously changed by simulateFrontendEnvironment()

protected static resetFrontendEnvironment() : mixed
Tags
see
simulateFrontendEnvironment()

simulateFrontendEnvironment()

Copies the specified parseFunc configuration to $GLOBALS['TSFE']->tmpl->setup in Backend mode This somewhat hacky work around is currently needed because the parseFunc() function of \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer relies on those variables to be set

protected static simulateFrontendEnvironment() : mixed

        
On this page

Search results