#106802Allow custom group labels and icons for groupName in TCA ctrl configuration
Description
I would like to define custom icons and labels for each groupName used in the TCA ctrl configuration,
so that I can organize multiple distinct groups of records within a single extension in the “New Record” wizard, each with its own meaningful visual identity.
Current Behavior
Currently, TYPO3 allows grouping records in the “New Record” wizard using the TCA configuration:
$GLOBALS['TCA']['my_table']['ctrl']['groupName'] = 'my_extension_key';
However:The label for the group is derived automatically in 1 of 2 ways:
- from LLL:EXT:my_extension/Resources/Private/Language/locallang_db.xlf:extension.title
- the extension’s composer metadata if TYPO3 can figure out the extension key from the LLL string in the table’s TCA ctrl title. (described here: https://docs.typo3.org/m/typo3/reference-tca/main/en-us/Ctrl/Index.html#confval-ctrl-groupname)
The icon for the group is always taken from the extension icon (ext_icon.svg).
There is no way to override the group label or icon per groupName.
Although you technically can define multiple groups, all of the groups will have the same title and icon.
This logically limits developers to only one visual group per extension, even if they want to logically separate different types of records (e.g. content types vs. configurations) under the same extension.
Desired behaviour
Add support for:- Custom group label localization, e.g. via a dedicated label key (e.g. group.[groupName].title)
- Custom group icons, e.g. via EXT:my_extension/Resources/Public/Icons/GroupMyGroup.svg or iconIdentifier tx-myext-mygroupicon
Configuration option (example):
$GLOBALS['TCA']['my_table']['ctrl'] = [
'groupName' => 'custom_group_1',
'groupLabel' => 'LLL:EXT:my_extension/Resources/Private/Language/locallang_db.xlf:group.custom_group_1.title',
'groupIcon' => 'EXT:my_extension/Resources/Public/Icons/GroupCustomGroup1.svg', // or 'tx-myIconIdentifier'
];
But since we don’t want to redefine groupLabel and groupIcon for each individual table, we would need something like a group metadata.
We could use, for example
$GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['my_extension']['groupMetadata'] = [
'custom_group_1' => [
'label' => 'LLL:EXT:your_extension/Resources/Private/Language/locallang_db.xlf:group.news',
'icon' => 'EXT:your_extension/Resources/Public/Icons/group-news.svg',
],
'custom_group_2' => [
'label' => 'LLL:EXT:your_extension/Resources/Private/Language/locallang_db.xlf:group.events',
'icon' => 'tx-myext-iconIdentifier',
],
];
Maybe add an API function that populates that config, e.g. ExtensionManagementUtility::addTcaCtrlGroup($extkey, $groupName, $label, $icon)
If no group metadata exists we can still use the mechanic we have today
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.
Fix this issue
Start the commit message of your patch with this. Add what the patch does, and the versions it goes to in "Releases:". How to create a patch
- Commit message
-
[FEATURE] Allow custom group labels and icons for groupName in TCA ctrl configuration Resolves: #106802 Releases: main