#109375ExtensionManagementUtility::addToAllTCAtypes is broken with auto-created system TCA columns
Description
An arbitrary field cannot be properly inserted wherever we like if the position is “before” or “after” an auto-created system TCA column such as “starttime”, “hidden” or “fe_group”.
Works fine:
- Up to TYPO3 v12
Broken in:
- TYPO3 v13
- TYPO3 v14.2.0-dev
This seems related to the introduction of auto-created system TCA columns in #104311.
Sample code to reproduce
Taken from EXT:mfa_protect, use features/TYPO3v14 branch to have sample code to play with in v13 and v14.
From that extension, content of Configuration/TCA/Overrides/tt_content.php (stripped to minimum):
$tempColumns = [
'tx_mfaprotect_enable' => [
'label' => 'LLL:EXT:mfa_protect/Resources/Private/Language/locallang_db.xlf:tt_content.tx_mfaprotect_enable',
'config' => [
'type' => 'check',
'renderType' => 'checkboxToggle',
]
],
];
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('tt_content', $tempColumns);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes(
'tt_content',
'tx_mfaprotect_enable',
'',
'before:starttime'
);
Up to TYPO3 v12, the field is properly inserted between “hidden” and the palette containing “starttime”:
clipboard-202603260941-alco2.png
Since TYPO3 v13, the field is inserted at “random position” at the end of another tab.
Further analysis
Inserted position containing an auto-created system column seems to cause the issue. Inserting before/after any other field (such as “linkToTop” or “pi_flexform”) doesn’t cause this issue.
Adding to a palette seems to work with those system columns:
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addFieldsToPalette(
'tt_content',
'hidden',
'--linebreak--,tx_mfaprotect_enable',
'after:hidden'
);
This effectively inserts my field within the hidden auto-created palette and is visually similar, although not 100% identical:
clipboard-202603260945-4vqvg.png
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
-
[BUGFIX] ExtensionManagementUtility::addToAllTCAtypes is broken with auto-created system TCA columns Resolves: #109375 Releases: main