Deprecation: #84993 - Deprecate some TSconfig related methods¶
See forge#84993
Description¶
Some user TSconfig related methods have been deprecated:
TYPO3\
CMS\ core\ Authentication\ Backend User Authentication->get TSConfig Val () TYPO3\
CMS\ core\ Authentication\ Backend User Authentication->get TSConfig Prop ()
Changed method signatures:
TYPO3\
, no argument allowed any longerCMS\ core\ Authentication\ Backend User Authentication->get TSConfig ()
Some page TSconfig related methods have been marked as deprecated:
TYPO3\
CMS\ backend\ Utility\ Backend Utility:: get Mod TSconfig () TYPO3\
CMS\ backend\ Utility\ Backend Utility:: unset Menu Items () TYPO3\
CMS\ backend\ Tree\ View\ Page Position Map->get Mod Config () TYPO3\
CMS\ core\ Data Handling\ Data Handler->get TCEMAIN_ TSconfig ()
These properties have been set to protected, should not be used any longer and trigger a deprecation error on access:
TYPO3\
CMS\ backend\ Tree\ View\ Page Position Map->get Mod Config Cache TYPO3\
CMS\ backend\ Tree\ View\ Page Position Map->mod Config Str
Impact¶
Calling the above methods will trigger a PHP E_
error.
Affected Installations¶
Extensions with backend modules may call these methods. The extension scanner will find affected code occurrences in extensions.
Migration¶
Change user TSconfig related calls to use Backend
instead, it comes with a slightly changed return syntax.
get
without arguments simply returns the entire user TSconfig as array, similar to other
methods that return parsed TypoScript arrays. The examples below show some imaginary user TSConfig,
the full parsed array returned by get
and some typical access patterns with fallback. Note
it's almost always useful to use the null coalescence ??
operator for a fallback value to suppress
PHP notice level warnings:
// Incoming user TSconfig:
// options.someToggle = 1
// options.somePartWithSubToggles = foo
// options.somePartWithSubToggles.aValue = bar
// Parsed array returned by getTSConfig(), note the dot if a property has sub keys:
// [
// 'options.' => [
// 'someToggle' => '1',
// 'somePartWithSubToggles' => 'foo',
// 'somePartWithSubToggles.' => [
// 'aValue' => 'bar',
// ],
// ],
// ],
$userTsConfig = $backendUserAuthentication->getTSConfig():
// Typical call to retrieve a sanitized value:
$isToggleEnabled = (bool)($userTsConfig['options.']['someToggle'] ?? false);
// And to retrieve a sub set, note the dot at the end:
$subArray = $userTsConfig['options.']['somePartWithSubToggles.'] ?? [];
// Switch an old getTSConfigVal() to getTSConfig(), note the parenthesis:
$value = (bool)$backendUser->getTSConfigVal('options.someToggle');
$value = (bool)($backendUser->getTSConfig()['options.']['someToggle'] ?? false);
// Switch an old getTSConfigProp() to getTSConfig(), note the parenthesis and the trailing dot:
$value = (array)$backendUser->getTSConfigProp('options.somePartWithSubToggles');
$value = (array)($backendUser->getTSConfig()['options.']['somePartWithSubToggles.'] ?? []);
Change Backend
related calls to use Backend
instead.
Note this method does not return the 'properties' and 'value' sub array as ->get
did:
// Switch an old getModTSconfig() to getPagesTSConfig() for array of properties:
$configArray = BackendUtility::getModTSconfig($pid, 'mod.web_list');
$configArray['properties'] = BackendUtility::getPagesTSconfig($pid)['mod.']['web_list.'] ?? [];
// Switch an old getModTSconfig() to getPagesTSConfig() for single value:
$configArray = BackendUtility::getModTSconfig($pid, 'TCEFORM.sys_dmail_group.select_categories.PAGE_TSCONFIG_IDLIST');
$configArray['value'] = BackendUtility::getPagesTSconfig($pid)['TCEFORM.']['sys_dmail_group.']['select_categories.']['PAGE_TSCONFIG_IDLIST'] ?? null;
Methods Backend
and Data
have been rarely used
and are dropped without substitution. Copy the code into consuming methods if you really need them.