Feature: #108726 - Introduce Fluid f:render.record ViewHelper
See forge#108726
Description
Instead of using the
<f: ViewHelper to render database records,
the new
<f: ViewHelper can be used.
It allows rendering records while enabling other extensions to modify the output via PSR-14 EventListeners.
This is especially useful for adding debugging wrappers or additional HTML structure around content elements.
By default, the ViewHelper renders the record as-is, but EventListeners
can listen to the
\TYPO3\ and modify the output.
Usage with the record- data processor:
dataProcessing {
10 = record-transformation
}
<f:render.record record="{record}"/>
or
{record -> f:render.record()}
You can not only render tt_content records but any database record by defining a the rendering in Typoscript.
# Example Typoscript configuration for rendering custom records
sys_category = FLUIDTEMPLATE
sys_category {
file = EXT:my_extension/Resources/Private/Templates/Category.html
layoutRootPaths.10 = EXT:my_extension/Resources/Private/Layouts/
partialRootPaths.10 = EXT:my_extension/Resources/Private/Partials/
dataProcessing.1421884800 = record-transformation
}
# Example Typoscript configuration for special record types
tx_myextension_domain_model_product = COA
tx_myextension_domain_model_product.default = FLUIDTEMPLATE
tx_myextension_domain_model_product.default {
templateName >
templateName.ifEmpty.cObject = TEXT
templateName.ifEmpty.cObject {
field = record_type
required = 1
case = uppercamelcase
}
# for record_type = 'mainProduct' the template file my_extension/Resources/Private/Templates/Product/MainProduct.html will be used
layoutRootPaths.10 = EXT:my_extension/Resources/Private/Layouts/
partialRootPaths.10 = EXT:my_extension/Resources/Private/Partials/
templateRootPaths.10 = EXT:my_extension/Resources/Private/Templates/Product/
dataProcessing.1421884800 = record-transformation
}
Impact
Theme creators are encouraged to use the
<f: ViewHelper
to allow other extensions to modify the output via EventListeners.