Feature: #108843 - User settings configuration migrated to TCA
See forge#108843 See forge#108832
Description
The backend user profile settings configuration that was previously stored in
$GLOBALS is now available in TCA at
$GLOBALS.
This allows user settings to benefit from TCA-based tooling and provides a consistent API that extensions already use for other configuration.
A new method
Extension has been introduced to
simplify adding custom fields to user profile settings.
Impact
Extensions can add custom fields to backend user profile settings using
the new
add method in
Configuration/:
// Configuration/TCA/Overrides/be_users.php
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addUserSetting(
'myCustomSetting',
[
'label' => 'LLL:EXT:my_ext/Resources/Private/Language/locallang.xlf:myCustomSetting',
'config' => [
'type' => 'check',
'renderType' => 'checkboxToggle',
],
],
'after:emailMeAtLogin'
);
Alternatively, extensions can directly modify the TCA:
// Configuration/TCA/Overrides/be_users.php
$GLOBALS['TCA']['be_users']['columns']['user_settings']['columns']['myCustomSetting'] = [
'label' => 'LLL:my_extension.messages:myCustomSetting',
'config' => [
'type' => 'check',
'renderType' => 'checkboxToggle',
],
];
// Add to showitem
$GLOBALS['TCA']['be_users']['columns']['user_settings']['showitem'] .= ',myCustomSetting';
Structure
The
user_ TCA column has the following structure:
columns-
Array of field configurations, each containing:
label- The field label (LLL reference or string)
config- Standard TCA config array (type, renderType, items, etc.)
table(optional)- Set to
'be_if the field is stored in ausers' be_table columnusers
showitem- Comma-separated list of fields to display; supports
--for tabsdiv--;
Available field types
input- Text input fieldnumber- Number input fieldemail- Email input fieldpassword- Password input fieldcheckwithrender- Checkbox or toggleType => 'checkbox Toggle' selectwithrender- Select fieldType => 'select Single' language- Language selector
Backward compatibility
For backward compatibility, the legacy
$GLOBALS array is still supported. Third-party
additions are automatically migrated to TCA after all
ext_ files have been loaded. However, this approach is
deprecated, and extensions should migrate to the new TCA-based API.