Feature: #108581 - Record type specific label configuration
See forge#108581
Description
Previously, the TCA label configuration (ctrl, ctrl,
and ctrl) applied globally to all record types in a
table. This meant that all content elements in
tt_, regardless of
their CType, displayed the same field(s) as their label in the backend.
It is now possible to define type-specific label configuration in the
TCA types section. These settings override global ctrl label
configuration for a record type:
label- Primary field used for the record titlelabel_- Alternative field(s) used when label is empty (or as additional fields)alt label_- Force display of alternative fields alongside the primary labelalt_ force
This is especially useful for tables like
tt_ where different
content element types may benefit from showing different fields. For example, an
"Image" content element could display the image caption, while a "Text" element
would show the header field.
Examples
return [
'ctrl' => [
'label' => 'header',
'type' => 'record_type',
// ... other ctrl configuration
],
'types' => [
'article' => [
'label_alt' => 'teaser',
],
'event' => [
'label_alt' => 'event_date,location',
'label_alt_force' => true,
],
],
// ... columns configuration
];
In this example:
- All types use
headeras the primary label field (fromctrl).['label'] - The
articletype displays theteaserfield ifheaderis empty. - The
eventtype displaysheadertogether withevent_anddate location(sincelabel_is enabled).alt_ force
When adding a new record type to a table, label configuration can
be provided as the third argument $additional of
\TYPO3\.
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
ExtensionManagementUtility::addRecordType(
[
'label' => 'LLL:frontend.ttc:CType.shortcut',
'value' => 'my-type',
'icon' => 'my-icon',
'group' => 'special',
],
'my-header',
[
'label' => 'header',
'label_alt' => 'records',
]
);
Impact
Tables with multiple record types can now define more specific and descriptive labels for each type in the backend user interface. This improves usability and clarity for editors by making it immediately obvious which type of record is being displayed.
This feature is especially useful for:
- Content element tables such as
tt_with differentcontent CTypevalues - Tables with different record types serving different purposes
- Plugin records with varying functionality for each type
- Any table where the record type changes the record's purpose or meaning
All occurrences of
\TYPO3\ in TYPO3
automatically benefit from this feature without any code changes. This includes
record lists, page trees, history views, workspaces, and similar backend
modules.
Functionality such as FormEngine records cannot benefit from this option yet, as FormEngine does not support the Schema API yet.