Attention
TYPO3 v11 has reached end-of-life as of October 31th 2024 and is no longer being maintained. Use the version switcher on the top left of this page to select documentation for a supported version of TYPO3.
Need more time before upgrading? You can purchase Extended Long Term Support (ELTS) for TYPO3 v10 here: TYPO3 ELTS.
previewRenderer
previewRenderer
-
- Type
- string
- Path
- $GLOBALS['TCA'][$table]['ctrl']
- Scope
- Display
Configures a backend preview for a content element.
Examples
Have also a look at Configure custom backend preview for content element for more details.
Note
The recommended location of the preview renderer configuration is in the
ctrl
array in your extension's Configuration/
or Configuration/
file. The former is used
when your extension is the one that creates the table, the latter is used
when you need to override TCA properties of tables added by the Core or
other extensions.
Use for any record in a table
This specifies the preview renderer to be used for any record in
tx_
:
$GLOBALS['TCA']['tx_myextension_domain_model_mytable']['ctrl']['previewRenderer']
= \MyVendor\MyExtension\Preview\PreviewRenderer::class;
Table has a type
field/attribute
This specifies the preview renderer only for records of type $type
as
determined by the type field of your table.
$GLOBALS['TCA']['tx_myextension_domain_model_mytable']['types'][$type]['previewRenderer']
= \MyVendor\MyExtension\Preview\PreviewRenderer::class;
Table has a subtype_value_field
setting
If your table and field have a
subtype_value_field TCA setting
(like tt_
) and you want to register a preview renderer
that applies only when that value is selected (for example, when a certain
plugin type is selected and you can not match it with the type of the record
alone):
$GLOBALS['TCA'][tx_myextension_domain_model_mytable]['types'][$type]['previewRenderer'][$subType]
= \MyVendor\MyExtension\Preview\PreviewRenderer::class;
Where $type
is for example list
(indicating a plugin) and
$sub
is the value of the list_
field when the
type of plugin you want to target is selected as plugin type.