Feature: #92749 - Improve content object initialization in HtmlViewHelper¶
See forge#92749
Description¶
New options are available for the f:format.html
ViewHelper,
related to the initialization of the underlying content object. The options
are similar to the ones, available for the f:cObject
ViewHelper.
With the data
argument an integrator can pass an array or an object (e.g. a
domain model), which will be used as data record on initialization.
With the currentValueKey
argument, one can specify the array key of the
provided data record, which should be used as the current value.
Alternatively, one can use the new current
argument to set a static value
as current value for the content object.
Additionally, with the table
argument, the ContentObjectRenderer
receives the table name, the given data record is from.
Example¶
Access a news record title with CURRENT:1
and resolve a marker:
<f:format.html
parseFuncTSPath="lib.news"
data="{uid: 1, title: \'Great news\'}"
currentValueKey="title">
###PROJECT### news:
</f:format.html>
constants.PROJECT = TYPO3
lib.news {
htmlSanitize = 1
constants = 1
plainTextStdWrap.noTrimWrap = || |
plainTextStdWrap.dataWrap = |{CURRENT:1}
}
This will result in:
TYPO3 news: Great news
Impact¶
The f:format.html
ViewHelper can now be utilized in more customized use cases.