#107257Allow overriding label fields per record type in TCA
Description
Currently, in TYPO3’s TCA ctrl configuration for a table (e.g. tt_content), it is possible to define a global label field and optional label_alt fields. However, in certain record types, these fields may not be available or appropriate. This leads to incorrect or missing labels in the backend.
Recently, a similar change #106972 was made for the search field configuration, where the global searchFields option was removed and replaced by automatically using all suitable fields unless explicitly excluded.
Proposed solution:
Introduce the possibility to override label and label_alt by record type, while still keeping the global configuration as a fallback.
- Keep the current global
label/label_altdefinitions in ctrl as default. - Add the ability to define
label/label_altwithin the type-specific TCA configuration (types section). - If a type-specific
labelorlabel_altis defined, it overrides the global setting for that record type only. - If no override is defined, the global defaults apply.
Example configuration:
'ctrl' => [
'label' => 'title',
'label_alt' => 'subtitle',
],
'types' => [
'special' => [
'label' => 'special_title',
'label_alt' => 'special_subtitle',
],
],
Benefits:
- More flexibility in defining meaningful labels for different record types.
- Avoids backend display issues where the globally defined label field is not present in certain types.
- Aligns with the approach used in the searchFields refactoring.
- “label_userFunc” and “formattedLabel_userFunc”
- “label” might be empty => Implementation of fallback to label_alt, see #107143
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.