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/TCA/$table.php
or Configuration/TCA/Overrides/$table.php
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_myextension_domain_model_mytable
:
$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_content.list_type
) 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
$subType
is the value of the list_type
field when the
type of plugin you want to target is selected as plugin type.