Commit 45c582a8 authored by Christian Kuhn's avatar Christian Kuhn
Browse files

[TASK] Streamline TSconfig API

Final patch to de-mess the user / page TSconfig related API.

Page TSconfig can be overriden in user TSconfig by prefixing the
path with 'page.' in user TSconfig. However, method
BackendUtility::getModTSconfig() violated this principle and
had a special merge strategy that allowed ommitting the 'page.'
prefix. This has been marked as deprecated in the TSconfig docs for
various years and has been lately removed in the docs altogether,
but the code still existed.
The patch moves this merge into BackendUtility::getPagesTSconfig()
and properly deprecates this case. Usages of getModTSconfig() are
changed to use getPagesTSconfig() directly, dropping the artificial
'properties' and 'value' sub arrays and omitting some rather expensive
string operations at the same time.
This obsoletes getModTSconfig() and a couple of related methods.

Additionally, BackendUserAuthentication->getTSConfig() has been
abused frequently to operate on different arrays than it's own userTS.
Those usages are dropped with the patch. Handing over arguments to
getTSConfig() is now deprecated, effectively reducing the method a getter.

This reduces the API down to BackendUtility::getPagesTSconfig($pid)
and BackendUserAuhtentiction->getTSConfig() both just returning the
entire array. This simplified API can now be documented in the docs.

Change-Id: I4bbb066c1d4e2edbc0182f7967897a1558cc3c0d
Resolves: #85016
Related: #84982
Releases: master
Reviewed-on: https://review.typo3.org/56968

Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: Jan Helke's avatarJan Helke <typo3@helke.de>
Tested-by: Jan Helke's avatarJan Helke <typo3@helke.de>
Reviewed-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
parent 28b65ab8
......@@ -33,9 +33,7 @@ class EditToolbarService
$iconFactory = GeneralUtility::makeInstance(IconFactory::class);
$tsfe = $this->getTypoScriptFrontendController();
// If mod.newContentElementWizard.override is set, use that extension's create new content wizard instead:
$tsConfig = BackendUtility::getModTSconfig($tsfe->page['uid'], 'mod');
$moduleName = $tsConfig['properties']['newContentElementWizard.']['override'] ?? 'new_content_element';
/** @var UriBuilder $uriBuilder */
$moduleName = BackendUtility::getPagesTSconfig($tsfe->page['uid'])['mod.']['newContentElementWizard.']['override'] ?? 'new_content_element';
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
$perms = $this->getBackendUser()->calcPerms($tsfe->page);
$langAllowed = $this->getBackendUser()->checkLanguageAccess($tsfe->sys_language_uid);
......@@ -47,7 +45,6 @@ class EditToolbarService
$output[] = ' <div class="typo3-adminPanel-btn-group" role="group">';
// History
/** @var UriBuilder $uriBuilder */
$link = (string)$uriBuilder->buildUriFromRoute(
'record_history',
[
......
......@@ -44,9 +44,8 @@ class TranslationConfigurationProvider
*/
public function getSystemLanguages($pageId = 0)
{
$modSharedTSconfig = BackendUtility::getModTSconfig($pageId, 'mod.SHARED');
// default language and "all languages" are always present
$modSharedTSconfig = BackendUtility::getPagesTSconfig($pageId)['mod.']['SHARED.'] ?? [];
$languages = [
// 0: default language
0 => [
......@@ -230,8 +229,8 @@ class TranslationConfigurationProvider
*/
protected function getDefaultLanguageFlag(array $modSharedTSconfig)
{
if (strlen($modSharedTSconfig['properties']['defaultLanguageFlag'])) {
$defaultLanguageFlag = 'flags-' . $modSharedTSconfig['properties']['defaultLanguageFlag'];
if (strlen($modSharedTSconfig['defaultLanguageFlag'])) {
$defaultLanguageFlag = 'flags-' . $modSharedTSconfig['defaultLanguageFlag'];
} else {
$defaultLanguageFlag = 'empty-empty';
}
......@@ -244,8 +243,8 @@ class TranslationConfigurationProvider
*/
protected function getDefaultLanguageLabel(array $modSharedTSconfig)
{
if (strlen($modSharedTSconfig['properties']['defaultLanguageLabel'])) {
$defaultLanguageLabel = $modSharedTSconfig['properties']['defaultLanguageLabel'] . ' (' . $this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_mod_web_list.xlf:defaultLanguage') . ')';
if (strlen($modSharedTSconfig['defaultLanguageLabel'])) {
$defaultLanguageLabel = $modSharedTSconfig['defaultLanguageLabel'] . ' (' . $this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_mod_web_list.xlf:defaultLanguage') . ')';
} else {
$defaultLanguageLabel = $this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_mod_web_list.xlf:defaultLanguage');
}
......
......@@ -293,8 +293,8 @@ class RecordProvider extends AbstractProvider
$attributes += $this->getViewAdditionalAttributes();
}
if ($itemName === 'newWizard' && $this->table === 'tt_content') {
$tsConfig = BackendUtility::getModTSconfig($this->record['pid'], 'mod');
$moduleName = $tsConfig['properties']['newContentElementWizard.']['override'] ?? 'new_content_element_wizard';
$moduleName = BackendUtility::getPagesTSconfig($this->record['pid'])['mod.']['newContentElementWizard.']['override']
?? 'new_content_element_wizard';
$urlParameters = [
'id' => $this->record['pid'],
'sys_language_uid' => $this->record['sys_language_uid'],
......@@ -504,9 +504,11 @@ class RecordProvider extends AbstractProvider
*/
protected function isDeletionDisabledInTS(): bool
{
$disableDeleteTS = $this->backendUser->getTSConfig('options.disableDelete');
$disableDelete = (bool)trim($disableDeleteTS['properties'][$this->table] ?? (string)$disableDeleteTS['value']);
return $disableDelete;
return (bool)\trim(
$this->backendUser->getTSConfig()['options.']['disableDelete.'][$this->table]
?? $this->backendUser->getTSConfig()['options.']['disableDelete']
?? ''
);
}
/**
......@@ -546,12 +548,9 @@ class RecordProvider extends AbstractProvider
*/
protected function canOpenNewCEWizard(): bool
{
$tsConfig = BackendUtility::getModTSconfig($this->record['pid'], 'mod.web_layout');
$wizardEnabled = true;
if (isset($tsConfig['properties']['disableNewContentElementWizard'])) {
$wizardEnabled = false;
}
return $this->table === 'tt_content' && $wizardEnabled && $this->canBeEdited();
return $this->table === 'tt_content'
&& (bool)(BackendUtility::getPagesTSconfig($this->record['pid'])['mod.']['web_layout.']['disableNewContentElementWizard'] ?? true)
&& $this->canBeEdited();
}
/**
......
......@@ -236,9 +236,6 @@ class MoveElementController
$assigns['ttContent']['pageInfo'] = $pageInfo;
$assigns['ttContent']['recordTooltip'] = BackendUtility::getRecordToolTip($pageInfo, 'pages');
$assigns['ttContent']['recordTitle'] = BackendUtility::getRecordTitle('pages', $pageInfo, true);
// Load SHARED page-TSconfig settings and retrieve column list from there, if applicable:
// SHARED page-TSconfig settings.
// $modTSconfig_SHARED = BackendUtility::getModTSconfig($this->pageId, 'mod.SHARED');
$colPosArray = GeneralUtility::callUserFunction(\TYPO3\CMS\Backend\View\BackendLayoutView::class . '->getColPosListItemsParsed', $this->page_id, $this);
$colPosIds = [];
foreach ($colPosArray as $colPos) {
......
......@@ -204,7 +204,7 @@ class NewContentElementController
$this->colPos = $colPos === null ? null : (int)$colPos;
$this->uid_pid = (int)($parsedBody['uid_pid'] ?? $queryParams['uid_pid'] ?? 0);
$this->MCONF['name'] = 'xMOD_db_new_content_el';
$this->modTSconfig = BackendUtility::getModTSconfig($this->id, 'mod.wizards.newContentElement');
$this->modTSconfig['properties'] = BackendUtility::getPagesTSconfig($this->id)['mod.']['wizards.']['newContentElement.'] ?? [];
$config = BackendUtility::getPagesTSconfig($this->id);
$this->config = $config['mod.']['wizards.']['newContentElement.'];
// Starting the document template object:
......
......@@ -115,7 +115,7 @@ class EditDocumentController
'newC' => 'Using $newC of class EditDocumentTemplate from the outside is discouraged, as this variable is only used for internal storage.',
'viewId' => 'Using $viewId of class EditDocumentTemplate from the outside is discouraged, as this variable is only used for internal storage.',
'viewId_addParams' => 'Using $viewId_addParams of class EditDocumentTemplate from the outside is discouraged, as this variable is only used for internal storage.',
'modTSconfig' => 'Using $modTSconfig of class EditDocumentTemplate from the outside is discouraged, as this variable is only used for internal storage.',
'modTSconfig' => 'Using $modTSconfig of class EditDocumentTemplate from the outside is discouraged, the variable will be removed.',
'dontStoreDocumentRef' => 'Using $dontStoreDocumentRef of class EditDocumentTemplate from the outside is discouraged, as this variable is only used for internal storage.',
];
......@@ -428,11 +428,9 @@ class EditDocumentController
protected $viewId_addParams;
/**
* Module TSconfig, loaded from main() based on the page id value of viewId
*
* @var array
* @deprecated since v9, will be removed in v10, unused
*/
protected $modTSconfig;
protected $modTSconfig = [];
/**
* @var FormResultCompiler
......@@ -959,8 +957,7 @@ class EditDocumentController
$currentPageId = MathUtility::convertToPositiveInteger($this->popViewId);
}
$pageTsConfig = BackendUtility::getPagesTSconfig($currentPageId);
$previewConfiguration = $pageTsConfig['TCEMAIN.']['preview.'][$table . '.'] ?? [];
$previewConfiguration = BackendUtility::getPagesTSconfig($currentPageId)['TCEMAIN.']['preview.'][$table . '.'] ?? [];
$recordArray = BackendUtility::getRecord($table, $recordId);
......@@ -1128,13 +1125,6 @@ class EditDocumentController
$this->getBackendUser()->pushModuleData('FormEngine', [$this->docHandler, $this->storeUrlMd5]);
BackendUtility::setUpdateSignal('OpendocsController::updateNumber', count($this->docHandler));
}
// Module configuration
$this->modTSconfig = $this->viewId
? BackendUtility::getModTSconfig(
$this->viewId,
'mod.xMOD_alt_doc'
)
: [];
$body = $this->formResultCompiler->addCssFiles();
$body .= $this->compileForm($editForm);
$body .= $this->formResultCompiler->printNeededJSFunctions();
......@@ -2144,13 +2134,13 @@ class EditDocumentController
}
$languageService = $this->getLanguageService();
$modSharedTSconfig = BackendUtility::getModTSconfig($id, 'mod.SHARED');
$modPageTsConfig = BackendUtility::getPagesTSconfig($id)['mod.']['SHARED.'] ?? [];
// Fallback non sprite-configuration
if (preg_match('/\\.gif$/', $modSharedTSconfig['properties']['defaultLanguageFlag'] ?? '')) {
$modSharedTSconfig['properties']['defaultLanguageFlag'] = str_replace(
if (preg_match('/\\.gif$/', $modPageTsConfig['defaultLanguageFlag'] ?? '')) {
$modPageTsConfig['defaultLanguageFlag'] = str_replace(
'.gif',
'',
$modSharedTSconfig['properties']['defaultLanguageFlag']
$modPageTsConfig['defaultLanguageFlag']
);
}
$languages = [
......@@ -2158,10 +2148,10 @@ class EditDocumentController
'uid' => 0,
'pid' => 0,
'hidden' => 0,
'title' => $modSharedTSconfig['properties']['defaultLanguageLabel'] !== ''
? $modSharedTSconfig['properties']['defaultLanguageLabel'] . ' (' . $languageService->sL('LLL:EXT:core/Resources/Private/Language/locallang_mod_web_list.xlf:defaultLanguage') . ')'
'title' => $modPageTsConfig['defaultLanguageLabel'] !== ''
? $modPageTsConfig['defaultLanguageLabel'] . ' (' . $languageService->sL('LLL:EXT:core/Resources/Private/Language/locallang_mod_web_list.xlf:defaultLanguage') . ')'
: $languageService->sL('LLL:EXT:core/Resources/Private/Language/locallang_mod_web_list.xlf:defaultLanguage'),
'flag' => $modSharedTSconfig['properties']['defaultLanguageFlag']
'flag' => $modPageTsConfig['defaultLanguageFlag']
]
];
......@@ -2352,8 +2342,11 @@ class EditDocumentController
*/
protected function getTsConfigOption(string $table, string $key): string
{
$TsConfig = $this->getBackendUser()->getTSConfig('options.' . $key);
return trim((string)($TsConfig['properties'][$table] ?? $TsConfig['value']));
return \trim((string)(
$this->getBackendUser()->getTSConfig()['options.'][$key . '.'][$table]
?? $this->getBackendUser()->getTSConfig()['options.'][$key]
?? ''
));
}
/**
......
......@@ -423,29 +423,13 @@ class NewRecordController
$this->moduleTemplate->getDocHeaderComponent()->setMetaInformation($this->pageinfo);
}
// Acquiring TSconfig for this module/current page:
$this->web_list_modTSconfig = BackendUtility::getModTSconfig($this->pageinfo['uid'], 'mod.web_list');
$this->allowedNewTables = GeneralUtility::trimExplode(
',',
$this->web_list_modTSconfig['properties']['allowedNewTables'],
true
);
$this->deniedNewTables = GeneralUtility::trimExplode(
',',
$this->web_list_modTSconfig['properties']['deniedNewTables'],
true
);
$this->web_list_modTSconfig = BackendUtility::getPagesTSconfig($this->pageinfo['uid'])['mod.']['web_list.'] ?? [];
$this->allowedNewTables = GeneralUtility::trimExplode(',', $this->web_list_modTSconfig['allowedNewTables'] ?? '', true);
$this->deniedNewTables = GeneralUtility::trimExplode(',', $this->web_list_modTSconfig['deniedNewTables'] ?? '', true);
// Acquiring TSconfig for this module/parent page:
$this->web_list_modTSconfig_pid = BackendUtility::getModTSconfig($this->pageinfo['pid'], 'mod.web_list');
$this->allowedNewTables_pid = GeneralUtility::trimExplode(
',',
$this->web_list_modTSconfig_pid['properties']['allowedNewTables'],
true
);
$this->deniedNewTables_pid = GeneralUtility::trimExplode(
',',
$this->web_list_modTSconfig_pid['properties']['deniedNewTables'],
true
);
$this->web_list_modTSconfig_pid = BackendUtility::getPagesTSconfig($this->pageinfo['pid'])['mod.']['web_list.'] ?? [];
$this->allowedNewTables_pid = GeneralUtility::trimExplode(',', $this->web_list_modTSconfig_pid['allowedNewTables'] ?? '', true);
$this->deniedNewTables_pid = GeneralUtility::trimExplode(',', $this->web_list_modTSconfig_pid['deniedNewTables'] ?? '', true);
// More init:
if (!$this->isRecordCreationAllowedForTable('pages')) {
$this->newPagesInto = 0;
......@@ -714,8 +698,8 @@ class NewRecordController
. '<strong>' . $lang->getLL('createNewContent') . '</strong>'
. '<ul>';
// If mod.newContentElementWizard.override is set, use that extension's wizard instead:
$tsConfig = BackendUtility::getModTSconfig($this->id, 'mod');
$moduleName = $tsConfig['properties']['newContentElementWizard.']['override'] ?? 'new_content_element_wizard';
$moduleName = BackendUtility::getPagesTSconfig($this->id)['mod.']['newContentElementWizard.']['override']
?? 'new_content_element_wizard';
/** @var \TYPO3\CMS\Core\Http\NormalizedParams */
$normalizedParams = $request->getAttribute('normalizedParams');
$url = (string)$uriBuilder->buildUriFromRoute($moduleName, ['id' => $this->id, 'returnUrl' => $normalizedParams->getRequestUri()]);
......
......@@ -120,14 +120,14 @@ class PageLayoutController
*
* @var array
*/
public $modTSconfig;
public $modTSconfig = [];
/**
* Module shared TSconfig
*
* @var array
*/
public $modSharedTSconfig;
public $modSharedTSconfig = [];
/**
* Current ids page record
......@@ -302,8 +302,9 @@ class PageLayoutController
]
];
// initialize page/be_user TSconfig settings
$this->modSharedTSconfig = BackendUtility::getModTSconfig($this->id, 'mod.SHARED');
$this->modTSconfig = BackendUtility::getModTSconfig($this->id, 'mod.' . $this->moduleName);
$pageTsConfig = BackendUtility::getPagesTSconfig($this->id);
$this->modSharedTSconfig['properties'] = $pageTsConfig['mod.']['SHARED.'] ?? [];
$this->modTSconfig['properties'] = $pageTsConfig['mod.']['web_layout.'] ?? [];
// First, select all localized page records on the current page. Each represents a possibility for a language on the page. Add these to language selector.
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('sys_language');
......@@ -422,8 +423,13 @@ class PageLayoutController
if (!$count) {
unset($actions['2']);
}
// page/be_user TSconfig blinding of menu-items
$actions = BackendUtility::unsetMenuItems($this->modTSconfig['properties'], $actions, 'menu.function');
// Page / user TSconfig blinding of menu-items
$blindActions = $this->modTSconfig['properties']['menu.']['functions.'] ?? [];
foreach ($blindActions as $key => $value) {
if (!$value && array_key_exists($key, $actions)) {
unset($actions[$key]);
}
}
return $actions;
}
......
......@@ -213,10 +213,15 @@ class BaseScriptClass
*/
public function menuConfig()
{
// Page/be_user TSconfig settings and blinding of menu-items
$this->modTSconfig = BackendUtility::getModTSconfig($this->id, 'mod.' . $this->MCONF['name']);
// Page / user TSconfig settings and blinding of menu-items
$this->modTSconfig['properties'] = BackendUtility::getPagesTSconfig($this->id)['mod.'][$this->MCONF['name'] . '.'] ?? [];
$this->MOD_MENU['function'] = $this->mergeExternalItems($this->MCONF['name'], 'function', $this->MOD_MENU['function']);
$this->MOD_MENU['function'] = BackendUtility::unsetMenuItems($this->modTSconfig['properties'], $this->MOD_MENU['function'], 'menu.function');
$blindActions = $this->modTSconfig['properties']['menu.']['function.'] ?? [];
foreach ($blindActions as $key => $value) {
if (!$value && array_key_exists($key, $this->MOD_MENU['function'])) {
unset($this->MOD_MENU['function'][$key]);
}
}
$this->MOD_SETTINGS = BackendUtility::getModuleData($this->MOD_MENU, GeneralUtility::_GP('SET'), $this->MCONF['name'], $this->modMenu_type, $this->modMenu_dontValidateList, $this->modMenu_setDefaultList);
}
......
......@@ -17,6 +17,7 @@ namespace TYPO3\CMS\Backend\Tree\View;
use TYPO3\CMS\Backend\Routing\UriBuilder;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Compatibility\PublicPropertyDeprecationTrait;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Query\Restriction\BackendWorkspaceRestriction;
use TYPO3\CMS\Core\Database\Query\Restriction\EndTimeRestriction;
......@@ -33,6 +34,18 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
*/
class PagePositionMap
{
use PublicPropertyDeprecationTrait;
/**
* Properties which have been moved to protected status from public
*
* @var array
*/
protected $deprecatedPublicProperties = [
'getModConfigCache' => 'Using $getModConfigCache of class PagePositionMap is discouraged. This property will be removed in v10.',
'modConfigStr' => 'Using $$modConfigStr of class PagePositionMap is discouraged. This property will be removed in v10.',
];
// EXTERNAL, static:
/**
* @var string
......@@ -77,9 +90,9 @@ class PagePositionMap
// Caching arrays:
/**
* @var array
* @deprecated since v9, will be removed in v10
*/
public $getModConfigCache = [];
protected $getModConfigCache = [];
/**
* @var array
......@@ -98,9 +111,9 @@ class PagePositionMap
public $l_insertNewRecordHere = 'insertNewRecordHere';
/**
* @var string
* @deprecated since v9, will be removed in v10
*/
public $modConfigStr = 'mod.web_list.newPageWiz';
protected $modConfigStr = 'mod.web_list.newPageWiz';
/**
* Page tree implementation class name
......@@ -278,8 +291,7 @@ class PagePositionMap
*/
public function onClickEvent($pid, $newPagePID)
{
$TSconfig = BackendUtility::getModTSconfig($newPagePID, 'mod.newPageWizard');
$TSconfig = $TSconfig['properties'];
$TSconfig = BackendUtility::getPagesTSconfig($newPagePID)['mod.']['newPageWizard.'] ?? [];
if (isset($TSconfig['override']) && !empty($TSconfig['override'])) {
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
$url = $uriBuilder->buildUriFromRoute(
......@@ -341,12 +353,14 @@ class PagePositionMap
* @param int $pid Page id for which to get the module configuration.
* @return array The properties of the module configuration for the page id.
* @see onClickEvent()
* @deprecated since v9, will be removed in v10
*/
public function getModConfig($pid)
{
trigger_error('Method getModConfig() is deprecated and will be removed in v10', E_USER_DEPRECATED);
if (!isset($this->getModConfigCache[$pid])) {
// Acquiring TSconfig for this PID:
$this->getModConfigCache[$pid] = BackendUtility::getModTSconfig($pid, $this->modConfigStr);
$this->getModConfigCache[$pid]['properties'] = BackendUtility::getPagesTSconfig($pid)['mod.']['web_list.']['newPageWiz.'] ?? [];
}
return $this->getModConfigCache[$pid]['properties'];
}
......
......@@ -824,8 +824,8 @@ class BackendUtility
* Returns the Page TSconfig for page with id, $id
*
* @param int $id Page uid for which to create Page TSconfig
* @param array $rootLine If $rootLine is an array, that is used as rootline, otherwise rootline is just calculated
* @param bool $returnPartArray If $returnPartArray is set, then the array with accumulated Page TSconfig is returned non-parsed. Otherwise the output will be parsed by the TypoScript parser.
* @param array $rootLine @deprecated
* @param bool $returnPartArray @deprecated
* @return array Page TSconfig
* @see \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser
*/
......@@ -865,12 +865,31 @@ class BackendUtility
}
$cacheHash = $res['hash'];
// Get User TSconfig overlay
$userTSconfig = static::getBackendUserAuthentication()->getTSConfig()['page.'] ?? null;
if (is_array($userTSconfig)) {
ArrayUtility::mergeRecursiveWithOverrule($tsConfig, $userTSconfig);
$userTSconfig = static::getBackendUserAuthentication()->getTSConfig() ?? [];
$isCacheHashExtendedWithUserUid = false;
if (is_array($userTSconfig['page.'])) {
ArrayUtility::mergeRecursiveWithOverrule($tsConfig, $userTSconfig['page.']);
$isCacheHashExtendedWithUserUid = true;
$cacheHash .= '_user' . static::getBackendUserAuthentication()->user['uid'];
}
// Overlay page "mod." ts with user ts in a special and deprecated way
if (is_array($userTSconfig['mod.'])) {
// @deprecated This entire "if" and variable $isCacheHashExtendedWithUserUid can be deleted in v10
trigger_error(
'Overriding page TSconfig "mod." with user TSconfig "mod." is deprecated. Use user TSconfig "page.mod." instead',
E_USER_DEPRECATED
);
if (!is_array($tsConfig['mod.'])) {
$tsConfig['mod.'] = [];
}
ArrayUtility::mergeRecursiveWithOverrule($tsConfig['mod.'], $userTSconfig['mod.']);
if (!$isCacheHashExtendedWithUserUid) {
$cacheHash .= '_user' . static::getBackendUserAuthentication()->user['uid'];
}
}
if ($useCacheForCurrentPageId) {
// Many pages end up with the same ts config. To reduce memory usage, the cache
// entries are a linked list: One or more pids point to content hashes which then
......@@ -2784,9 +2803,15 @@ class BackendUtility
* @param int $id Page uid
* @param string $TSref An object string which determines the path of the TSconfig to return.
* @return array
* @deprecated since v9, will be removed in TYPO3 v10, use getPagesTSconfig() instead
*/
public static function getModTSconfig($id, $TSref)
{
trigger_error(
'Method getModTSconfig() is deprecated in v9 and will be removed in v10.'
. ' Use getPagesTSconfig() to retrieve the full page TSconfig array instead.',
E_USER_DEPRECATED
);
$beUser = static::getBackendUserAuthentication();
$pageTS_modOptions = $beUser->getTSConfig($TSref, static::getPagesTSconfig($id));
$BE_USER_modOptions = $beUser->getTSConfig($TSref);
......@@ -2994,9 +3019,11 @@ class BackendUtility
* @param array $itemArray Array of items from which to remove items.
* @param string $TSref $TSref points to the "object string" in $modTSconfig
* @return array The modified $itemArray is returned.
* @deprecated since core v9, will be removed with core v10
*/
public static function unsetMenuItems($modTSconfig, $itemArray, $TSref)
{
trigger_error('Method getPidForModTSconfig() will be removed in TYPO3 v10.', E_USER_DEPRECATED);
// Getting TS-config options for this module for the Backend User:
$conf = static::getBackendUserAuthentication()->getTSConfig($TSref, $modTSconfig);
if (is_array($conf['properties'])) {
......@@ -3341,20 +3368,15 @@ class BackendUtility
// Get main config for the table
list($TScID, $cPid) = self::getTSCpid($table, $row['uid'], $row['pid']);
if ($TScID >= 0) {
$tempConf = static::getBackendUserAuthentication()->getTSConfig(
'TCEFORM.' . $table,
self::getPagesTSconfig($TScID)
);
if (is_array($tempConf['properties'])) {
$typeVal = self::getTCAtypeValue($table, $row);
foreach ($tempConf['properties'] as $key => $val) {
if (is_array($val)) {
$fieldN = substr($key, 0, -1);
$res[$fieldN] = $val;
unset($res[$fieldN]['types.']);
if ((string)$typeVal !== '' && is_array($val['types.'][$typeVal . '.'])) {
ArrayUtility::mergeRecursiveWithOverrule($res[$fieldN], $val['types.'][$typeVal . '.']);
}
$tsConfig = static::getPagesTSconfig($TScID)['TCEFORM.'][$table . '.'] ?? [];
$typeVal = self::getTCAtypeValue($table, $row);
foreach ($tsConfig as $key => $val) {
if (is_array($val)) {
$fieldN = substr($key, 0, -1);
$res[$fieldN] = $val;
unset($res[$fieldN]['types.']);
if ((string)$typeVal !== '' && is_array($val['types.'][$typeVal . '.'])) {
ArrayUtility::mergeRecursiveWithOverrule($res[$fieldN], $val['types.'][$typeVal . '.']);
}
}
}
......
......@@ -273,17 +273,19 @@ class BackendLayoutView implements \TYPO3\CMS\Core\SingletonInterface
*/
public function getColPosListItemsParsed($id)
{
$tsConfig = BackendUtility::getModTSconfig($id, 'TCEFORM.tt_content.colPos');
$tsConfig = BackendUtility::getPagesTSconfig($id)['TCEFORM.']['tt_content.']['colPos.'] ?? [];
$tcaConfig = $GLOBALS['TCA']['tt_content']['columns']['colPos']['config'];
$tcaItems = $tcaConfig['items'];
$tcaItems = $this->addItems($tcaItems, $tsConfig['properties']['addItems.']);
$tcaItems = $this->addItems($tcaItems, $tsConfig['addItems.']);
if (isset($tcaConfig['itemsProcFunc']) && $tcaConfig['itemsProcFunc']) {
$tcaItems = $this->addColPosListLayoutItems($id, $tcaItems);
}
foreach (GeneralUtility::trimExplode(',', $tsConfig['properties']['removeItems'], true) as $removeId) {
foreach ($tcaItems as $key => $item) {
if ($item[1] == $removeId) {
unset($tcaItems[$key]);
if (!empty($tsConfig['removeItems'])) {
foreach (GeneralUtility::trimExplode(',', $tsConfig['removeItems'], true) as $removeId) {
foreach ($tcaItems as $key => $item) {
if ($item[1] == $removeId) {
unset($tcaItems[$key]);
}
}
}
}
......
......@@ -939,8 +939,7 @@ class PageLayoutView implements LoggerAwareInterface
'uid_pid' => $id,
'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
];
$tsConfig = BackendUtility::getModTSconfig($id, 'mod');
$routeName = $tsConfig['properties']['newContentElementWizard.']['override']
$routeName = BackendUtility::getPagesTSconfig($id)['mod.']['newContentElementWizard.']['override']
?? 'new_content_element_wizard';
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
$url = (string)$uriBuilder->buildUriFromRoute($routeName, $urlParameters);
......@@ -1062,8 +1061,7 @@ class PageLayoutView implements LoggerAwareInterface
'uid_pid' => -$row['uid'],
'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
];
$tsConfig = BackendUtility::getModTSconfig($row['pid'], 'mod');
$routeName = $tsConfig['properties']['newContentElementWizard.']['override']
$routeName = BackendUtility::getPagesTSconfig($row['pid'])['mod.']['newContentElementWizard.']['override']
?? 'new_content_element_wizard';
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
$url = (string)$uriBuilder->buildUriFromRoute($routeName, $urlParameters);
......@@ -1164,7 +1162,7 @@ class PageLayoutView implements LoggerAwareInterface
$grid .= '</colgroup>';
// Check how to handle restricted columns
$hideRestrictedCols = (bool)($tsConfig['properties']['web_layout.']['hideRestrictedCols'] ?? false);
$hideRestrictedCols = (bool)(BackendUtility::getPagesTSconfig($id)['mod.']['web_layout.']['hideRestrictedCols'] ?? false);
// Cycle through rows
for ($row = 1; $row <= $rowCount; $row++) {
......@@ -2172,28 +2170,25 @@ class PageLayoutView implements LoggerAwareInterface
// and render it via Fluid. Possible option:
// mod.web_layout.tt_content.preview.media = EXT:site_mysite/Resources/Private/Templates/Preview/Media.html
if ($drawItem) {
$tsConfig = BackendUtility::getModTSconfig($row['pid'], 'mod.web_layout.tt_content.preview');
$tsConfig = BackendUtility::getPagesTSconfig($row['pid'])['mod.']['web_layout.']['tt_content.']['preview.'] ?? [];
$fluidTemplateFile = '';
if (
$row['CType'] === 'list' && !empty($row['list_type'])
&& !empty($tsConfig['properties']['list.'][$row['list_type']])