Deprecation: #108843 - ExtensionManagementUtility::addFieldsToUserSettings
See forge#108843 See forge#108832
Description
The method
\TYPO3\
has been deprecated in favor of the new
add method.
The legacy method required two separate steps to add a field to user settings:
first adding the field configuration to the columns array, then calling
add to add it to the showitem list. The new method
combines both steps into a single call and uses TCA as the storage location.
Impact
Calling the deprecated method will trigger a deprecation-level log entry. The method will be removed in TYPO3 v15.0.
The extension scanner reports usages as a strong match.
Affected installations
Instances or extensions that use
Extension
or directly modify
$GLOBALS to add custom fields to the
backend user profile settings are affected.
Migration
Replace the two-step approach with the new
add method.
Note that the new method uses TCA-style configuration and should be called from
Configuration/ instead of ext_.
Before
// In ext_tables.php
$GLOBALS['TYPO3_USER_SETTINGS']['columns']['myCustomSetting'] = [
'type' => 'check',
'label' => 'LLL:EXT:my_ext/Resources/Private/Language/locallang.xlf:myCustomSetting',
];
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addFieldsToUserSettings(
'myCustomSetting',
'after:emailMeAtLogin'
);
After
// In 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'
);
Field type mapping
When migrating, use the following type mappings:
| Legacy type | TCA config |
|---|---|
| text |
['type' => 'input'] |
['type' => 'email'] | |
| number |
['type' => 'number'] |
| password |
['type' => 'password'] |
| check |
['type' => 'check', 'render |
| select |
['type' => 'select', 'render |
| language |
['type' => 'language'] |