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 records to be rendered while enabling other extensions to modify the output via PSR-14 event listeners.
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 event listeners
can listen to the
Modify 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 render not only
tt_ records, but any database record by
defining 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 event listeners.