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 within 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 a type-specific label configuration directly in the
TCA
types section. These settings override the global
ctrl label
configuration for the respective 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 shows 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 article type additionally displays the
teaserfield ifheaderis empty. - The event type displays
headertogether withevent_anddate location(sincelabel_is enabled).alt_ force
When adding a new record type to an existing table, the label configuration can be
provided as the 3rd argument
$additional of
\TYPO3\.
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addRecordType(
[
'label' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf: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 distinct record types serving different purposes
- Plugin records with varying functionality per type
- Any table where the record type changes the record's purpose or meaning
All places in TYPO3 that use
\TYPO3\
automatically benefit from this feature without any code changes. This includes
record lists, page trees, history views, workspaces, and similar backend modules.
Functionality like FormEngine records cannot profit yet from this option, as FormEngine does not support Schema API yet.