[TASK] Streamline TSconfig API 68/56968/7
authorChristian Kuhn <lolli@schwarzbu.ch>
Tue, 15 May 2018 12:25:27 +0000 (14:25 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Wed, 16 May 2018 09:37:36 +0000 (11:37 +0200)
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: TYPO3com <no-reply@typo3.com>
Reviewed-by: Jan Helke <typo3@helke.de>
Tested-by: Jan Helke <typo3@helke.de>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
44 files changed:
typo3/sysext/adminpanel/Classes/Service/EditToolbarService.php
typo3/sysext/backend/Classes/Configuration/TranslationConfigurationProvider.php
typo3/sysext/backend/Classes/ContextMenu/ItemProviders/RecordProvider.php
typo3/sysext/backend/Classes/Controller/ContentElement/MoveElementController.php
typo3/sysext/backend/Classes/Controller/ContentElement/NewContentElementController.php
typo3/sysext/backend/Classes/Controller/EditDocumentController.php
typo3/sysext/backend/Classes/Controller/NewRecordController.php
typo3/sysext/backend/Classes/Controller/PageLayoutController.php
typo3/sysext/backend/Classes/Module/BaseScriptClass.php
typo3/sysext/backend/Classes/Tree/View/PagePositionMap.php
typo3/sysext/backend/Classes/Utility/BackendUtility.php
typo3/sysext/backend/Classes/View/BackendLayoutView.php
typo3/sysext/backend/Classes/View/PageLayoutView.php
typo3/sysext/backend/Tests/Unit/Utility/BackendUtilityTest.php
typo3/sysext/backend/Tests/Unit/Utility/Fixtures/BackendUtilityFixture.php [deleted file]
typo3/sysext/backend/Tests/UnitDeprecated/Utility/BackendUtilityTest.php [new file with mode: 0644]
typo3/sysext/backend/Tests/UnitDeprecated/Utility/Fixtures/BackendUtilityFixture.php [new file with mode: 0644]
typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php
typo3/sysext/core/Classes/Configuration/Richtext.php
typo3/sysext/core/Classes/DataHandling/DataHandler.php
typo3/sysext/core/Classes/DataHandling/Localization/DataMapProcessor.php
typo3/sysext/core/Documentation/Changelog/master/Deprecation-84993-DeprecateSomeTSconfigRelatedMethods.rst
typo3/sysext/core/Documentation/Changelog/master/Deprecation-85016-OverridingPageTSconfigModWithUserTSconfigModDeprecated.rst [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Authentication/BackendUserAuthenticationTest.php
typo3/sysext/core/Tests/UnitDeprecated/Authentication/BackendUserAuthenticationTest.php [new file with mode: 0644]
typo3/sysext/filelist/Classes/Configuration/ThumbnailConfiguration.php
typo3/sysext/filelist/Classes/FileList.php
typo3/sysext/info/Classes/Controller/InfoPageTyposcriptConfigController.php
typo3/sysext/info/Classes/Controller/PageInformationController.php
typo3/sysext/info/Classes/Controller/TranslationStatusController.php
typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodArgumentDroppedMatcher.php
typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallMatcher.php
typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallStaticMatcher.php
typo3/sysext/install/Configuration/ExtensionScanner/Php/PropertyProtectedMatcher.php
typo3/sysext/linkvalidator/Classes/Report/LinkValidatorReport.php
typo3/sysext/linkvalidator/Classes/Task/ValidatorTask.php
typo3/sysext/recordlist/Classes/Browser/FileBrowser.php
typo3/sysext/recordlist/Classes/Controller/RecordListController.php
typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php
typo3/sysext/recycler/Classes/Controller/RecyclerAjaxController.php
typo3/sysext/t3editor/Resources/Public/JavaScript/Mode/typoscript/typoscript.js
typo3/sysext/taskcenter/Classes/Controller/TaskModuleController.php
typo3/sysext/viewpage/Classes/Controller/ViewModuleController.php
typo3/sysext/workspaces/Classes/Controller/PreviewController.php

index 7ccb119..8f7647b 100644 (file)
@@ -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',
             [
index cf2b9b5..aff03b4 100644 (file)
@@ -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');
         }
index 51898b1..c2f0ed6 100644 (file)
@@ -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();
     }
 
     /**
index f74c3c3..4b36728 100644 (file)
@@ -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) {
index c117b86..470e6c2 100644 (file)
@@ -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:
index 1293665..88b5e5b 100644 (file)
@@ -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]
+            ?? ''
+        ));
     }
 
     /**
index 76daa15..da8bd7d 100644 (file)
@@ -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()]);
index a2a29db..5baf1c5 100644 (file)
@@ -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;
     }
index 43b9449..187f689 100644 (file)
@@ -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);
     }
 
index 4c26a15..cb2a5e1 100644 (file)
@@ -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'];
     }
index 2c74eee..b6476d9 100644 (file)
@@ -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 . '.']);
                     }
                 }
             }
index ba22886..34deb7e 100644 (file)
@@ -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]);
+                    }
                 }
             }
         }
index ecdb09f..53b80fb 100644 (file)
@@ -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']])
+            if ($row['CType'] === 'list' && !empty($row['list_type'])
+                && !empty($tsConfig['list.'][$row['list_type']])
             ) {
-                $fluidTemplateFile = $tsConfig['properties']['list.'][$row['list_type']];
-            } elseif (!empty($tsConfig['properties'][$row['CType']])) {
-                $fluidTemplateFile = $tsConfig['properties'][$row['CType']];
+                $fluidTemplateFile = $tsConfig['list.'][$row['list_type']];
+            } elseif (!empty($tsConfig[$row['CType']])) {
+                $fluidTemplateFile = $tsConfig[$row['CType']];
             }
 
             if ($fluidTemplateFile) {
                 $fluidTemplateFile = GeneralUtility::getFileAbsFileName($fluidTemplateFile);
                 if ($fluidTemplateFile) {
                     try {
-                        /** @var StandaloneView $view */
                         $view = GeneralUtility::makeInstance(StandaloneView::class);
                         $view->setTemplatePathAndFilename($fluidTemplateFile);
                         $view->assignMultiple($row);
                         if (!empty($row['pi_flexform'])) {
-                            /** @var FlexFormService $flexFormService */
                             $flexFormService = GeneralUtility::makeInstance(FlexFormService::class);
                             $view->assign('pi_flexform_transformed', $flexFormService->convertFlexFormContentToArray($row['pi_flexform']));
                         }
@@ -2413,14 +2408,9 @@ class PageLayoutView implements LoggerAwareInterface
         }
         $theNewButton = '';
 
-        $localizationTsConfig = BackendUtility::getModTSconfig($this->id, 'mod.web_layout.localization');
-        $allowCopy = isset($localizationTsConfig['properties']['enableCopy'])
-            ? (int)$localizationTsConfig['properties']['enableCopy'] === 1
-            : true;
-        $allowTranslate = isset($localizationTsConfig['properties']['enableTranslate'])
-            ? (int)$localizationTsConfig['properties']['enableTranslate'] === 1
-            : true;
-
+        $localizationTsConfig = BackendUtility::getPagesTSconfig($this->id)['mod.']['web_layout.']['localization.'] ?? [];
+        $allowCopy = (bool)($localizationTsConfig['enableCopy'] ?? true);
+        $allowTranslate = (bool)($localizationTsConfig['enableTranslate'] ?? true);
         if (!empty($this->languageHasTranslationsCache[$lP])) {
             if (isset($this->languageHasTranslationsCache[$lP]['hasStandAloneContent'])) {
                 $allowTranslate = false;
@@ -2473,8 +2463,7 @@ class PageLayoutView implements LoggerAwareInterface
     public function newContentElementOnClick($id, $colPos, $sys_language)
     {
         if ($this->option_newWizard) {
-            $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 = $uriBuilder->buildUriFromRoute($routeName, [
@@ -2620,10 +2609,11 @@ class PageLayoutView implements LoggerAwareInterface
                 }
             }
             // Remove disabled languages
-            $modSharedTSconfig = BackendUtility::getModTSconfig($id, 'mod.SHARED');
-            $disableLanguages = isset($modSharedTSconfig['properties']['disableLanguages'])
-                ? GeneralUtility::trimExplode(',', $modSharedTSconfig['properties']['disableLanguages'], true)
-                : [];
+            $disableLanguages = GeneralUtility::trimExplode(
+                ',',
+                BackendUtility::getPagesTSconfig($id)['mod.']['SHARED.']['disableLanguages'] ?? '',
+                true
+            );
             if (!empty($availableTranslations) && !empty($disableLanguages)) {
                 foreach ($disableLanguages as $language) {
                     if ($language != 0 && isset($availableTranslations[$language])) {
@@ -2969,8 +2959,8 @@ class PageLayoutView implements LoggerAwareInterface
         // Also, you may override this strict behavior via user TS Config
         // If you do so, you're on your own and cannot rely on any support by the TYPO3 core
         // We jump out here since we don't need to do the expensive loop operations
-        $allowInconsistentLanguageHandling = BackendUtility::getModTSconfig($this->id, 'mod.web_layout.allowInconsistentLanguageHandling');
-        if ($language === 0 || $allowInconsistentLanguageHandling['value'] === '1') {
+        $allowInconsistentLanguageHandling = (bool)(BackendUtility::getPagesTSconfig($this->id)['mod.']['web_layout.']['allowInconsistentLanguageHandling'] ?? false);
+        if ($language === 0 || $allowInconsistentLanguageHandling) {
             return false;
         }
         /**
index bb5c18c..1f9fbf4 100644 (file)
@@ -16,13 +16,11 @@ namespace TYPO3\CMS\Backend\Tests\Unit\Utility;
 
 use Prophecy\Argument;
 use Prophecy\Prophecy\ObjectProphecy;
-use TYPO3\CMS\Backend\Tests\Unit\Utility\Fixtures\BackendUtilityFixture;
 use TYPO3\CMS\Backend\Tests\Unit\Utility\Fixtures\LabelFromItemListMergedReturnsCorrectFieldsFixture;
 use TYPO3\CMS\Backend\Tests\Unit\Utility\Fixtures\ProcessedValueForGroupWithMultipleAllowedTablesFixture;
 use TYPO3\CMS\Backend\Tests\Unit\Utility\Fixtures\ProcessedValueForGroupWithOneAllowedTableFixture;
 use TYPO3\CMS\Backend\Tests\Unit\Utility\Fixtures\ProcessedValueForSelectWithMMRelationFixture;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
-use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
 use TYPO3\CMS\Core\Database\Connection;
 use TYPO3\CMS\Core\Database\ConnectionPool;
 use TYPO3\CMS\Core\Database\Query\Expression\ExpressionBuilder;
@@ -886,31 +884,6 @@ class BackendUtilityTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     /**
      * @test
      */
-    public function getModTSconfigIgnoresValuesFromUserTsConfigIfNotSet()
-    {
-        $completeConfiguration = [
-            'value' => 'bar',
-            'properties' => [
-                'permissions.' => [
-                    'file.' => [
-                        'default.' => ['readAction' => '1'],
-                        '1.' => ['writeAction' => '1'],
-                        '0.' => ['readAction' => '0'],
-                    ],
-                ]
-            ]
-        ];
-
-        $GLOBALS['BE_USER'] = $this->createMock(BackendUserAuthentication::class);
-        $GLOBALS['BE_USER']->expects($this->at(0))->method('getTSConfig')->will($this->returnValue($completeConfiguration));
-        $GLOBALS['BE_USER']->expects($this->at(1))->method('getTSConfig')->will($this->returnValue(['value' => null, 'properties' => null]));
-
-        $this->assertSame($completeConfiguration, BackendUtilityFixture::getModTSconfig(42, 'notrelevant'));
-    }
-
-    /**
-     * @test
-     */
     public function dateTimeAgeReturnsCorrectValues()
     {
         /** @var ObjectProphecy|LanguageService $languageServiceProphecy */
diff --git a/typo3/sysext/backend/Tests/Unit/Utility/Fixtures/BackendUtilityFixture.php b/typo3/sysext/backend/Tests/Unit/Utility/Fixtures/BackendUtilityFixture.php
deleted file mode 100644 (file)
index d6bf779..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-<?php
-namespace TYPO3\CMS\Backend\Tests\Unit\Utility\Fixtures;
-
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-/**
- * BackendUtility fixture
- */
-class BackendUtilityFixture extends \TYPO3\CMS\Backend\Utility\BackendUtility
-{
-    /**
-     * @param int $id
-     * @param array $rootLine
-     * @param bool $returnPartArray
-     * @return array
-     */
-    public static function getPagesTSconfig($id, $rootLine = null, $returnPartArray = false)
-    {
-        return [];
-    }
-}
diff --git a/typo3/sysext/backend/Tests/UnitDeprecated/Utility/BackendUtilityTest.php b/typo3/sysext/backend/Tests/UnitDeprecated/Utility/BackendUtilityTest.php
new file mode 100644 (file)
index 0000000..db88adf
--- /dev/null
@@ -0,0 +1,50 @@
+<?php
+namespace TYPO3\CMS\Backend\Tests\UnitDeprecated\Utility;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use TYPO3\CMS\Backend\Tests\UnitDeprecated\Utility\Fixtures\BackendUtilityFixture;
+use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
+use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
+
+/**
+ * Test case
+ */
+class BackendUtilityTest extends UnitTestCase
+{
+    /**
+     * @test
+     */
+    public function getModTSconfigIgnoresValuesFromUserTsConfigIfNotSet()
+    {
+        $completeConfiguration = [
+            'value' => 'bar',
+            'properties' => [
+                'permissions.' => [
+                    'file.' => [
+                        'default.' => ['readAction' => '1'],
+                        '1.' => ['writeAction' => '1'],
+                        '0.' => ['readAction' => '0'],
+                    ],
+                ]
+            ]
+        ];
+
+        $GLOBALS['BE_USER'] = $this->createMock(BackendUserAuthentication::class);
+        $GLOBALS['BE_USER']->expects($this->at(0))->method('getTSConfig')->will($this->returnValue($completeConfiguration));
+        $GLOBALS['BE_USER']->expects($this->at(1))->method('getTSConfig')->will($this->returnValue(['value' => null, 'properties' => null]));
+
+        $this->assertSame($completeConfiguration, BackendUtilityFixture::getModTSconfig(42, 'notrelevant'));
+    }
+}
diff --git a/typo3/sysext/backend/Tests/UnitDeprecated/Utility/Fixtures/BackendUtilityFixture.php b/typo3/sysext/backend/Tests/UnitDeprecated/Utility/Fixtures/BackendUtilityFixture.php
new file mode 100644 (file)
index 0000000..3c3cddf
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+namespace TYPO3\CMS\Backend\Tests\UnitDeprecated\Utility\Fixtures;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use TYPO3\CMS\Backend\Utility\BackendUtility;
+
+/**
+ * BackendUtility fixture
+ */
+class BackendUtilityFixture extends BackendUtility
+{
+    /**
+     * @param int $id
+     * @param array $rootLine
+     * @param bool $returnPartArray
+     * @return array
+     */
+    public static function getPagesTSconfig($id, $rootLine = null, $returnPartArray = false)
+    {
+        return [];
+    }
+}
index 9724263..62a831e 100644 (file)
@@ -1201,20 +1201,30 @@ class BackendUserAuthentication extends AbstractUserAuthentication
     }
 
     /**
-     * Returns fully parsed user TSconfig array.
+     * Returns full parsed user TSconfig array, merged with TSconfig from groups.
      *
-     * Returns the value/properties of a TS-object as given by $objectString, eg. 'options.dontMountAdminMounts'
+     * Example:
+     * [
+     *     'options.' => [
+     *         'fooEnabled' => '0',
+     *         'fooEnabled.' => [
+     *             'tt_content' => 1,
+     *         ],
+     *     ],
+     * ]
      *
-     * @param string $objectString Pointer to an "object" in the TypoScript array, fx. 'options.dontMountAdminMounts'
-     * @param array|string $config Optional TSconfig array: If array, then this is used and not $this->userTS. If not array, $this->userTS is used.
-     * @return array An array with two keys, "value" and "properties" where "value" is a string with the value of the object string and "properties" is an array with the properties of the object string.
+     * @param string $objectString @deprecated
+     * @param array|string $config @deprecated
+     * @return array Parsed and merged user TSconfig array
      */
-    public function getTSConfig($objectString = '', $config = '')
+    public function getTSConfig($objectString = null, $config = null)
     {
-        if (empty($objectString) && empty($config)) {
+        if ($objectString === null && $config === null) {
             return $this->userTS;
         }
 
+        trigger_error('Handing over arguments to getTSConfig() is deprecated, they will be removed in v10.', E_USER_DEPRECATED);
+
         if (!is_array($config)) {
             // Getting Root-ts if not sent
             $config = $this->userTS;
index 59085e1..6a48261 100644 (file)
@@ -16,7 +16,6 @@ namespace TYPO3\CMS\Core\Configuration;
  */
 
 use TYPO3\CMS\Backend\Utility\BackendUtility;
-use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
 use TYPO3\CMS\Core\Configuration\Loader\YamlFileLoader;
 use TYPO3\CMS\Core\TypoScript\TypoScriptService;
 use TYPO3\CMS\Core\Utility\ArrayUtility;
@@ -106,9 +105,7 @@ class Richtext
      */
     protected function getRtePageTsConfigOfPid(int $pid): array
     {
-        // Override with pageTs if needed
-        $backendUser = $this->getBackendUser();
-        return $backendUser->getTSConfig('RTE', BackendUtility::getPagesTSconfig($pid));
+        return BackendUtility::getPagesTSconfig($pid)['RTE.'] ?? [];
     }
 
     /**
@@ -136,14 +133,6 @@ class Richtext
     }
 
     /**
-     * @return BackendUserAuthentication
-     */
-    protected function getBackendUser(): BackendUserAuthentication
-    {
-        return $GLOBALS['BE_USER'];
-    }
-
-    /**
      * Add all PageTS.RTE options keys to configuration without dots
      *
      * We need to keep the dotted keys for backwards compatibility like ext:rtehtmlarea
index 49c72db..b9acaa4 100644 (file)
@@ -516,13 +516,6 @@ class DataHandler implements LoggerAwareInterface
     protected $isInWebMount_Cache = [];
 
     /**
-     * Caching for collecting TSconfig for page ids
-     *
-     * @var array
-     */
-    protected $cachedTSconfig = [];
-
-    /**
      * Used for caching page records in pageInfo()
      *
      * @var array
@@ -1178,7 +1171,7 @@ class DataHandler implements LoggerAwareInterface
                 // Here the "pid" is set IF NOT the old pid was a string pointing to a place in the subst-id array.
                 list($tscPID) = BackendUtility::getTSCpid($table, $id, $old_pid_value ? $old_pid_value : $fieldArray['pid']);
                 if ($status === 'new' && $table === 'pages') {
-                    $TSConfig = $this->getTCEMAIN_TSconfig($tscPID);
+                    $TSConfig = BackendUtility::getPagesTSconfig($tscPID)['TCEMAIN.'] ?? [];
                     if (isset($TSConfig['permissions.']) && is_array($TSConfig['permissions.'])) {
                         $fieldArray = $this->setTSconfigPermissions($fieldArray, $TSConfig['permissions.']);
                     }
@@ -3470,7 +3463,7 @@ class DataHandler implements LoggerAwareInterface
         // Page TSconfig related:
         // NOT using \TYPO3\CMS\Backend\Utility\BackendUtility::getTSCpid() because we need the real pid - not the ID of a page, if the input is a page...
         $tscPID = BackendUtility::getTSconfig_pidValue($table, $uid, $destPid);
-        $TSConfig = $this->getTCEMAIN_TSconfig($tscPID);
+        $TSConfig = BackendUtility::getPagesTSconfig($tscPID)['TCEMAIN.'] ?? [];
         $tE = $this->getTableEntries($table, $TSConfig);
         // Traverse ALL fields of the selected record:
         $setDefaultOnCopyArray = array_flip(GeneralUtility::trimExplode(',', $GLOBALS['TCA'][$table]['ctrl']['setToDefaultOnCopy']));
@@ -3531,8 +3524,6 @@ class DataHandler implements LoggerAwareInterface
                 $this->autoVersionIdMap[$table][$theNewSQLID] = $copyTCE->autoVersionIdMap[$table][$theNewSQLID];
             }
         }
-        // Copy back the cached TSconfig
-        $this->cachedTSconfig = $copyTCE->cachedTSconfig;
         $this->errorLog = array_merge($this->errorLog, $copyTCE->errorLog);
         unset($copyTCE);
         if (!$ignoreLocalization && $language == 0) {
@@ -4807,7 +4798,7 @@ class DataHandler implements LoggerAwareInterface
             if ($fCfg['l10n_mode'] === 'prefixLangTitle') {
                 if (($fCfg['config']['type'] === 'text' || $fCfg['config']['type'] === 'input') && (string)$row[$fN] !== '') {
                     list($tscPID) = BackendUtility::getTSCpid($table, $uid, '');
-                    $TSConfig = $this->getTCEMAIN_TSconfig($tscPID);
+                    $TSConfig = BackendUtility::getPagesTSconfig($tscPID)['TCEMAIN.'] ?? [];
                     if (!empty($TSConfig['translateToMessage'])) {
                         $translateToMsg = $this->getLanguageService()->sL($TSConfig['translateToMessage']);
                         $translateToMsg = @sprintf($translateToMsg, $langRec['title']);
@@ -5914,8 +5905,6 @@ class DataHandler implements LoggerAwareInterface
         $copyTCE = GeneralUtility::makeInstance(DataHandler::class);
         $copyTCE->copyTree = $this->copyTree;
         $copyTCE->enableLogging = $this->enableLogging;
-        // Copy forth the cached TSconfig
-        $copyTCE->cachedTSconfig = $this->cachedTSconfig;
         // Transformations should NOT be carried out during copy
         $copyTCE->dontProcessTransformations = true;
         // make sure the isImporting flag is transferred, so all hooks know if
@@ -7876,13 +7865,12 @@ class DataHandler implements LoggerAwareInterface
      *
      * @param int $tscPID Page id (PID) from which to get configuration.
      * @return array TSconfig array, if any
+     * @deprecated since core v9, will be removed with core v10
      */
     public function getTCEMAIN_TSconfig($tscPID)
     {
-        if (!isset($this->cachedTSconfig[$tscPID])) {
-            $this->cachedTSconfig[$tscPID] = $this->BE_USER->getTSConfig('TCEMAIN', BackendUtility::getPagesTSconfig($tscPID));
-        }
-        return $this->cachedTSconfig[$tscPID]['properties'];
+        trigger_error('Method getTCEMAIN_TSconfig() will be removed in TYPO3 v10.', E_USER_DEPRECATED);
+        return BackendUtility::getPagesTSconfig($tscPID)['TCEMAIN.'] ?? [];
     }
 
     /**
@@ -7891,7 +7879,6 @@ class DataHandler implements LoggerAwareInterface
      * @param string $table Table name
      * @param array $TSconfig TSconfig for page
      * @return array TSconfig merged
-     * @see getTCEMAIN_TSconfig()
      */
     public function getTableEntries($table, $TSconfig)
     {
@@ -8430,7 +8417,7 @@ class DataHandler implements LoggerAwareInterface
         $clearCacheCommands = [];
         $pageUid = 0;
         // Get Page TSconfig relevant:
-        $TSConfig = $this->getTCEMAIN_TSconfig($pid);
+        $TSConfig = BackendUtility::getPagesTSconfig($pid)['TCEMAIN.'] ?? [];
         if (empty($TSConfig['clearCache_disable'])) {
             // If table is "pages":
             $pageIdsThatNeedCacheFlush = [];
index 9299ce1..9a6f21d 100644 (file)
@@ -1249,12 +1249,9 @@ class DataMapProcessor
         $languageRecord = BackendUtility::getRecord('sys_language', $language, 'title');
         list($pageId) = BackendUtility::getTSCpid($tableName, $fromId, $data['pid'] ?? null);
 
-        $TSconfig = $this->backendUser->getTSConfig(
-            'TCEMAIN',
-            BackendUtility::getPagesTSconfig($pageId)
-        );
-        if (!empty($TSconfig['translateToMessage'])) {
-            $prefix = $TSconfig['translateToMessage'];
+        $tsConfigTranslateToMessage = BackendUtility::getPagesTSconfig($pageId)['TCEMAIN.']['translateToMessage'] ?? '';
+        if (!empty($tsConfigTranslateToMessage)) {
+            $prefix = $tsConfigTranslateToMessage;
             if ($languageService !== null) {
                 $prefix = $languageService->sL($prefix);
             }
index 6a881f3..444263b 100644 (file)
@@ -14,6 +14,23 @@ Some user TSconfig related methods have been deprecated:
 * :php:`TYPO3\CMS\core\Authentication\BackendUserAuthentication->getTSConfigVal()`
 * :php:`TYPO3\CMS\core\Authentication\BackendUserAuthentication->getTSConfigProp()`
 
+Changed method signatures:
+
+* :php:`TYPO3\CMS\core\Authentication\BackendUserAuthentication->getTSConfig()`, no argument allowed any longer
+
+Some page TSconfig related methods have been deprecated:
+
+* :php:`TYPO3\CMS\backend\Utility\BackendUtility::getModTSconfig()`
+* :php:`TYPO3\CMS\backend\Utility\BackendUtility::unsetMenuItems()`
+* :php:`TYPO3\CMS\backend\Tree\View\PagePositionMap->getModConfig()`
+* :php:`TYPO3\CMS\core\DataHandling\DataHandler->getTCEMAIN_TSconfig()`
+
+These properties have been set to protected, should not be used any longer and log a deprecation message on access:
+
+* :php:`TYPO3\CMS\backend\Tree\View\PagePositionMap->getModConfigCache`
+* :php:`TYPO3\CMS\backend\Tree\View\PagePositionMap->modConfigStr`
+* :php:`TYPO3\CMS\recordlist\Controller\RecordListController->modTSconfig`
+
 
 Impact
 ======
@@ -31,11 +48,11 @@ will find affected code occurrences in extensions.
 Migration
 =========
 
-Change the calls to use :php:`BackendUserAuthentication->getTSConfig()` instead, it
-comes with a slightly changed return syntax.
+Change user TSconfig related calls to use :php:`BackendUserAuthentication->getTSConfig()`
+instead, it comes with a slightly changed return syntax.
 
 :php:`getTSConfig()` 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 TypoScript,
+methods that return parsed TypoScript arrays. The examples below shows some imaginary user TSConfig,
 the full parsed array returned by :php:`getTSConfig()` and some typical access patterns with fallback. Note
 it's almost always useful to use the null coalescence :php:`??` operator for a fallback value to suppress
 PHP notice level warnings::
@@ -71,4 +88,15 @@ PHP notice level warnings::
     $value = (array)$backendUser->getTSConfigProp('options.somePartWithSubToggles');
     $value = (array)($backendUser->getTSConfig()['options.']['somePartWithSubToggles.'] ?? []);
 
+
+Change :php:`BackendUtility->getModTSconfig()` related calls to use :php:`BackendUtility::getPagesTSconfig($pid)` instead.
+Note this method does not return the 'properties' and 'value' sub array as :php:`->getModTSconfig()` did::
+
+    // Switch an old getModTSconfig() to getPagesTSConfig():
+    $configArray = BackendUtility::getModTSconfig($id, 'mod.web_list');
+    $configArray['properties'] = BackendUtility::getPagesTSconfig($pid)['mod.']['web_list.'] ?? [];
+
+Methods :php:`BackendUtility::unsetMenuItems()` and :php:`DataHandler->getTCEMAIN_TSconfig()` have been rarely used
+and are dropped without substitution. Copy the code into consuming methods if you really need them.
+
 .. index:: Backend, PHP-API, TSConfig, FullyScanned
\ No newline at end of file
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-85016-OverridingPageTSconfigModWithUserTSconfigModDeprecated.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-85016-OverridingPageTSconfigModWithUserTSconfigModDeprecated.rst
new file mode 100644 (file)
index 0000000..44a07e1
--- /dev/null
@@ -0,0 +1,47 @@
+.. include:: ../../Includes.txt
+
+======================================================================================
+Deprecation: #84982 - Overriding page TSconfig mod. with user TSconfig mod. deprecated
+======================================================================================
+
+See :issue:`84982`
+
+Description
+===========
+
+Overriding page TSconfig properties on a backend user or group basis is usually
+done by prefixing the page TSconfig path with `page.` in user TSconfig.
+
+As an exception, properties within the page TSconfig top level object `mod.` could
+sometimes also be overriden in user TSconfig using `mod.` and omitting `page.`. This
+has been deprecated: `mod.` now needs to be overriden in user TSconfig by prefixing
+the path with `page.`, too.
+
+
+Impact
+======
+
+User TSconfig paths that start with `mod.` log a deprecation message and will
+stop working with core v10.
+
+
+Affected Installations
+======================
+
+Instances that set TSconfig on backend user or group basis starting with `mod.`.
+
+
+Migration
+=========
+
+Simply prefix the user TSconfig path with `page.` as usual if overriding page TSconfig
+on user TSconfig level. Example:
+
+.. code-block:: typoscript
+
+    // Before
+    mod.web_list.disableSingleTableView = 1
+    // After
+    page.mod.web_list.disableSingleTableView = 1
+
+.. index:: Backend, TSConfig, NotScanned
\ No newline at end of file
index 6fc2e51..362a0c3 100644 (file)
@@ -112,162 +112,6 @@ class BackendUserAuthenticationTest extends UnitTestCase
     /**
      * @return array
      */
-    public function getTSConfigDataProvider(): array
-    {
-        $completeConfiguration = [
-            'value' => 'oneValue',
-            'value.' => ['oneProperty' => 'oneValue'],
-            'permissions.' => [
-                'file.' => [
-                    'default.' => ['readAction' => '1'],
-                    '1.' => ['writeAction' => '1'],
-                    '0.' => ['readAction' => '0'],
-                ],
-            ]
-        ];
-
-        return [
-            'single level string' => [
-                $completeConfiguration,
-                'permissions',
-                [
-                    'value' => null,
-                    'properties' =>
-                    [
-                        'file.' => [
-                            'default.' => ['readAction' => '1'],
-                            '1.' => ['writeAction' => '1'],
-                            '0.' => ['readAction' => '0'],
-                        ],
-                    ],
-                ],
-            ],
-            'two levels string' => [
-                $completeConfiguration,
-                'permissions.file',
-                [
-                    'value' => null,
-                    'properties' =>
-                    [
-                        'default.' => ['readAction' => '1'],
-                        '1.' => ['writeAction' => '1'],
-                        '0.' => ['readAction' => '0'],
-                    ],
-                ],
-            ],
-            'three levels string' => [
-                $completeConfiguration,
-                'permissions.file.default',
-                [
-                    'value' => null,
-                    'properties' =>
-                    ['readAction' => '1'],
-                ],
-            ],
-            'three levels string with integer property' => [
-                $completeConfiguration,
-                'permissions.file.1',
-                [
-                    'value' => null,
-                    'properties' => ['writeAction' => '1'],
-                ],
-            ],
-            'three levels string with integer zero property' => [
-                $completeConfiguration,
-                'permissions.file.0',
-                [
-                    'value' => null,
-                    'properties' => ['readAction' => '0'],
-                ],
-            ],
-            'four levels string with integer zero property, value, no properties' => [
-                $completeConfiguration,
-                'permissions.file.0.readAction',
-                [
-                    'value' => '0',
-                    'properties' => null,
-                ],
-            ],
-            'four levels string with integer property, value, no properties' => [
-                $completeConfiguration,
-                'permissions.file.1.writeAction',
-                [
-                    'value' => '1',
-                    'properties' => null,
-                ],
-            ],
-            'one level, not existent string' => [
-                $completeConfiguration,
-                'foo',
-                [
-                    'value' => null,
-                    'properties' => null,
-                ],
-            ],
-            'two level, not existent string' => [
-                $completeConfiguration,
-                'foo.bar',
-                [
-                    'value' => null,
-                    'properties' => null,
-                ],
-            ],
-            'two level, where second level does not exist' => [
-                $completeConfiguration,
-                'permissions.bar',
-                [
-                    'value' => null,
-                    'properties' => null,
-                ],
-            ],
-            'three level, where third level does not exist' => [
-                $completeConfiguration,
-                'permissions.file.foo',
-                [
-                    'value' => null,
-                    'properties' => null,
-                ],
-            ],
-            'three level, where second and third level does not exist' => [
-                $completeConfiguration,
-                'permissions.foo.bar',
-                [
-                    'value' => null,
-                    'properties' => null,
-                ],
-            ],
-            'value and properties' => [
-                $completeConfiguration,
-                'value',
-                [
-                    'value' => 'oneValue',
-                    'properties' => ['oneProperty' => 'oneValue'],
-                ],
-            ],
-        ];
-    }
-
-    /**
-     * @param array $completeConfiguration
-     * @param string $objectString
-     * @param array $expectedConfiguration
-     * @dataProvider getTSConfigDataProvider
-     * @test
-     */
-    public function getTSConfigReturnsCorrectArrayForGivenObjectString(array $completeConfiguration, $objectString, array $expectedConfiguration): void
-    {
-        /** @var BackendUserAuthentication|\PHPUnit_Framework_MockObject_MockObject $subject */
-        $subject = $this->getAccessibleMock(BackendUserAuthentication::class, ['dummy'], [], '', false);
-        $subject->setLogger(new NullLogger());
-        $subject->_set('userTS', $completeConfiguration);
-
-        $actualConfiguration = $subject->getTSConfig($objectString);
-        $this->assertSame($expectedConfiguration, $actualConfiguration);
-    }
-
-    /**
-     * @return array
-     */
     public function getFilePermissionsTakesUserDefaultAndStoragePermissionsIntoAccountIfUserIsNotAdminDataProvider(): array
     {
         return [
diff --git a/typo3/sysext/core/Tests/UnitDeprecated/Authentication/BackendUserAuthenticationTest.php b/typo3/sysext/core/Tests/UnitDeprecated/Authentication/BackendUserAuthenticationTest.php
new file mode 100644 (file)
index 0000000..e285c15
--- /dev/null
@@ -0,0 +1,182 @@
+<?php
+declare(strict_types = 1);
+namespace TYPO3\CMS\Core\Tests\UnitDeprecated\Authentication;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use Psr\Log\NullLogger;
+use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
+use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
+
+/**
+ * Test case
+ */
+class BackendUserAuthenticationTest extends UnitTestCase
+{
+    /**
+     * @return array
+     */
+    public function getTSConfigDataProvider(): array
+    {
+        $completeConfiguration = [
+            'value' => 'oneValue',
+            'value.' => ['oneProperty' => 'oneValue'],
+            'permissions.' => [
+                'file.' => [
+                    'default.' => ['readAction' => '1'],
+                    '1.' => ['writeAction' => '1'],
+                    '0.' => ['readAction' => '0'],
+                ],
+            ]
+        ];
+
+        return [
+            'single level string' => [
+                $completeConfiguration,
+                'permissions',
+                [
+                    'value' => null,
+                    'properties' =>
+                    [
+                        'file.' => [
+                            'default.' => ['readAction' => '1'],
+                            '1.' => ['writeAction' => '1'],
+                            '0.' => ['readAction' => '0'],
+                        ],
+                    ],
+                ],
+            ],
+            'two levels string' => [
+                $completeConfiguration,
+                'permissions.file',
+                [
+                    'value' => null,
+                    'properties' =>
+                    [
+                        'default.' => ['readAction' => '1'],
+                        '1.' => ['writeAction' => '1'],
+                        '0.' => ['readAction' => '0'],
+                    ],
+                ],
+            ],
+            'three levels string' => [
+                $completeConfiguration,
+                'permissions.file.default',
+                [
+                    'value' => null,
+                    'properties' =>
+                    ['readAction' => '1'],
+                ],
+            ],
+            'three levels string with integer property' => [
+                $completeConfiguration,
+                'permissions.file.1',
+                [
+                    'value' => null,
+                    'properties' => ['writeAction' => '1'],
+                ],
+            ],
+            'three levels string with integer zero property' => [
+                $completeConfiguration,
+                'permissions.file.0',
+                [
+                    'value' => null,
+                    'properties' => ['readAction' => '0'],
+                ],
+            ],
+            'four levels string with integer zero property, value, no properties' => [
+                $completeConfiguration,
+                'permissions.file.0.readAction',
+                [
+                    'value' => '0',
+                    'properties' => null,
+                ],
+            ],
+            'four levels string with integer property, value, no properties' => [
+                $completeConfiguration,
+                'permissions.file.1.writeAction',
+                [
+                    'value' => '1',
+                    'properties' => null,
+                ],
+            ],
+            'one level, not existent string' => [
+                $completeConfiguration,
+                'foo',
+                [
+                    'value' => null,
+                    'properties' => null,
+                ],
+            ],
+            'two level, not existent string' => [
+                $completeConfiguration,
+                'foo.bar',
+                [
+                    'value' => null,
+                    'properties' => null,
+                ],
+            ],
+            'two level, where second level does not exist' => [
+                $completeConfiguration,
+                'permissions.bar',
+                [
+                    'value' => null,
+                    'properties' => null,
+                ],
+            ],
+            'three level, where third level does not exist' => [
+                $completeConfiguration,
+                'permissions.file.foo',
+                [
+                    'value' => null,
+                    'properties' => null,
+                ],
+            ],
+            'three level, where second and third level does not exist' => [
+                $completeConfiguration,
+                'permissions.foo.bar',
+                [
+                    'value' => null,
+                    'properties' => null,
+                ],
+            ],
+            'value and properties' => [
+                $completeConfiguration,
+                'value',
+                [
+                    'value' => 'oneValue',
+                    'properties' => ['oneProperty' => 'oneValue'],
+                ],
+            ],
+        ];
+    }
+
+    /**
+     * @param array $completeConfiguration
+     * @param string $objectString
+     * @param array $expectedConfiguration
+     * @dataProvider getTSConfigDataProvider
+     * @test
+     */
+    public function getTSConfigReturnsCorrectArrayForGivenObjectString(array $completeConfiguration, $objectString, array $expectedConfiguration): void
+    {
+        /** @var BackendUserAuthentication|\PHPUnit_Framework_MockObject_MockObject $subject */
+        $subject = $this->getAccessibleMock(BackendUserAuthentication::class, ['dummy'], [], '', false);
+        $subject->setLogger(new NullLogger());
+        $subject->_set('userTS', $completeConfiguration);
+
+        $actualConfiguration = $subject->getTSConfig($objectString);
+        $this->assertSame($expectedConfiguration, $actualConfiguration);
+    }
+}
index 8df4aae..fecf24d 100644 (file)
@@ -16,9 +16,8 @@ namespace TYPO3\CMS\Filelist\Configuration;
  * The TYPO3 project - inspiring people to share!
  */
 
-use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
 use TYPO3\CMS\Core\SingletonInterface;
-use TYPO3\CMS\Core\Utility\MathUtility;
 
 /**
  * Class TYPO3\CMS\Filelist\Configuration\ThumbnailConfiguration
@@ -37,17 +36,9 @@ class ThumbnailConfiguration implements SingletonInterface
 
     public function __construct()
     {
-        $modTSconfig = BackendUtility::getModTSconfig(0, 'options.file_list');
-        if (isset($modTSconfig['properties']['thumbnail.']['width'])
-            && MathUtility::canBeInterpretedAsInteger($modTSconfig['properties']['thumbnail.']['width'])
-        ) {
-            $this->width = (int)$modTSconfig['properties']['thumbnail.']['width'];
-        }
-        if (isset($modTSconfig['properties']['thumbnail.']['height'])
-            && MathUtility::canBeInterpretedAsInteger($modTSconfig['properties']['thumbnail.']['height'])
-        ) {
-            $this->height = (int)$modTSconfig['properties']['thumbnail.']['height'];
-        }
+        $userTsConfig = $this->getBackendUser()->getTSConfig();
+        $this->width = (int)($userTsConfig['options.']['file_list.']['thumbnail.']['width'] ?? 64);
+        $this->height = (int)($userTsConfig['options.']['file_list.']['thumbnail.']['height'] ?? 64);
     }
 
     /**
@@ -65,4 +56,12 @@ class ThumbnailConfiguration implements SingletonInterface
     {
         return $this->height;
     }
+
+    /**
+     * @return BackendUserAuthentication
+     */
+    protected function getBackendUser()
+    {
+        return $GLOBALS['BE_USER'];
+    }
 }
index 7aa298d..bd36bc0 100644 (file)
@@ -279,20 +279,19 @@ class FileList
      */
     public function __construct(FileListController $fileListController)
     {
-        if (isset($GLOBALS['BE_USER']->uc['titleLen']) && $GLOBALS['BE_USER']->uc['titleLen'] > 0) {
-            $this->fixedL = $GLOBALS['BE_USER']->uc['titleLen'];
+        $backendUser = $this->getBackendUser();
+        if (isset($backendUser->uc['titleLen']) && $backendUser->uc['titleLen'] > 0) {
+            $this->fixedL = $backendUser->uc['titleLen'];
         }
         $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
         $this->getTranslateTools();
         $this->determineScriptUrl();
         $this->fileListController = $fileListController;
-        $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
         $this->thumbnailConfiguration = GeneralUtility::makeInstance(ThumbnailConfiguration::class);
-
-        $modTSconfig = BackendUtility::getModTSconfig(0, 'options.file_list');
-        if (!empty($modTSconfig['properties']['filesPerPage'])) {
-            $this->iLimit = MathUtility::forceIntegerInRange($modTSconfig['properties']['filesPerPage'], 1);
-        }
+        $this->iLimit = MathUtility::forceIntegerInRange(
+            $backendUser->getTSConfig()['options.']['file_list.']['filesPerPage'] ?? 1,
+            1
+        );
     }
 
     /**
index 4f121f1..90e5b5d 100644 (file)
@@ -169,58 +169,53 @@ class InfoPageTyposcriptConfigController extends \TYPO3\CMS\Backend\Module\Abstr
                 $tmpl->ext_expandAllNotes = 1;
                 $tmpl->ext_noPMicons = 1;
 
-                $beUser = $this->getBackendUser();
+                $pageTsConfig = BackendUtility::getPagesTSconfig($this->pObj->id);
                 switch ($this->pObj->MOD_SETTINGS['tsconf_parts']) {
                     case '1':
-                        $modTSconfig = BackendUtility::getModTSconfig($this->pObj->id, 'mod');
+                        $pageTsConfig = $pageTsConfig['mod.'] ?? [];
                         break;
                     case '1a':
-                        $modTSconfig = $beUser->getTSConfig('mod.web_layout', BackendUtility::getPagesTSconfig($this->pObj->id));
+                        $pageTsConfig = $pageTsConfig['mod.']['web_layout.'] ?? [];
                         break;
                     case '1b':
-                        $modTSconfig = $beUser->getTSConfig('mod.web_view', BackendUtility::getPagesTSconfig($this->pObj->id));
+                        $pageTsConfig = $pageTsConfig['mod.']['web_view.'] ?? [];
                         break;
                     case '1c':
-                        $modTSconfig = $beUser->getTSConfig('mod.web_modules', BackendUtility::getPagesTSconfig($this->pObj->id));
+                        $pageTsConfig = $pageTsConfig['mod.']['web_modules.'] ?? [];
                         break;
                     case '1d':
-                        $modTSconfig = $beUser->getTSConfig('mod.web_list', BackendUtility::getPagesTSconfig($this->pObj->id));
+                        $pageTsConfig = $pageTsConfig['mod.']['web_list.'] ?? [];
                         break;
                     case '1e':
-                        $modTSconfig = $beUser->getTSConfig('mod.web_info', BackendUtility::getPagesTSconfig($this->pObj->id));
+                        $pageTsConfig = $pageTsConfig['mod.']['web_info.'] ?? [];
                         break;
                     case '1f':
-                        $modTSconfig = $beUser->getTSConfig('mod.web_func', BackendUtility::getPagesTSconfig($this->pObj->id));
+                        $pageTsConfig = $pageTsConfig['mod.']['web_func.'] ?? [];
                         break;
                     case '1g':
-                        $modTSconfig = $beUser->getTSConfig('mod.web_ts', BackendUtility::getPagesTSconfig($this->pObj->id));
+                        $pageTsConfig = $pageTsConfig['mod.']['web_ts.'] ?? [];
                         break;
                     case '2':
-                        $modTSconfig = $beUser->getTSConfig('RTE', BackendUtility::getPagesTSconfig($this->pObj->id));
+                        $pageTsConfig = $pageTsConfig['RTE.'] ?? [];
                         break;
                     case '5':
-                        $modTSconfig = $beUser->getTSConfig('TCEFORM', BackendUtility::getPagesTSconfig($this->pObj->id));
+                        $pageTsConfig = $pageTsConfig['TCEFORM.'] ?? [];
                         break;
                     case '6':
-                        $modTSconfig = $beUser->getTSConfig('TCEMAIN', BackendUtility::getPagesTSconfig($this->pObj->id));
+                        $pageTsConfig = $pageTsConfig['TCEMAIN.'] ?? [];
                         break;
                     case '3':
-                        $modTSconfig = $beUser->getTSConfig('TSFE', BackendUtility::getPagesTSconfig($this->pObj->id));
+                        $pageTsConfig = $pageTsConfig['TSFE.'] ?? [];
                         break;
                     case '4':
-                        $modTSconfig = $beUser->getTSConfig('user', BackendUtility::getPagesTSconfig($this->pObj->id));
+                        $pageTsConfig = $pageTsConfig['user.'] ?? [];
                         break;
                     default:
-                        $modTSconfig['properties'] = BackendUtility::getPagesTSconfig($this->pObj->id);
-                }
-
-                $modTSconfig = $modTSconfig['properties'];
-                if (!is_array($modTSconfig)) {
-                    $modTSconfig = [];
+                        // Entire array
                 }
 
                 $this->view->assign('csh', BackendUtility::cshItem('_MOD_web_info', 'tsconfig_hierarchy', null, '|'));
-                $this->view->assign('tree', $tmpl->ext_getObjTree($modTSconfig, '', '', '', '', $this->pObj->MOD_SETTINGS['tsconf_alphaSort']));
+                $this->view->assign('tree', $tmpl->ext_getObjTree($pageTsConfig, '', '', '', '', $this->pObj->MOD_SETTINGS['tsconf_alphaSort']));
             }
             $this->view->assign('alphaSort', BackendUtility::getFuncCheck($this->pObj->id, 'SET[tsconf_alphaSort]', $this->pObj->MOD_SETTINGS['tsconf_alphaSort'], '', '', 'id="checkTsconf_alphaSort"'));
             $this->view->assign('dropdownMenu', BackendUtility::getDropdownMenu($this->pObj->id, 'SET[tsconf_parts]', $this->pObj->MOD_SETTINGS['tsconf_parts'], $this->pObj->MOD_MENU['tsconf_parts']));
index 9fbfcc4..c4f4c86 100644 (file)
@@ -139,9 +139,8 @@ class PageInformationController extends \TYPO3\CMS\Backend\Module\AbstractFuncti
      */
     protected function fillFieldConfiguration(int $pageId)
     {
-        $modTSconfig = BackendUtility::getModTSconfig($pageId, 'mod.web_info.fieldDefinitions');
-
-        foreach ($modTSconfig['properties'] as $key => $item) {
+        $modTSconfig = BackendUtility::getPagesTSconfig($pageId)['mod.']['web_info.']['fieldDefinitions.'] ?? [];
+        foreach ($modTSconfig as $key => $item) {
             $fieldList = str_replace('###ALL_TABLES###', $this->cleanTableNames(), $item['fields']);
             $fields = GeneralUtility::trimExplode(',', $fieldList, true);
             $key = trim($key, '.');
index a1fa265..b6b2b27 100644 (file)
@@ -195,8 +195,11 @@ class TranslationStatusController extends \TYPO3\CMS\Backend\Module\AbstractFunc
             $tCells[] = '<td class="' . $status . '" title="' . $lang->sL(
                     'LLL:EXT:info/Resources/Private/Language/locallang_webinfo.xlf:lang_renderl10n_CEcount'
                 ) . '" align="center">' . $this->getContentElementCount($data['row']['uid'], 0) . '</td>';
-            $modSharedTSconfig = BackendUtility::getModTSconfig($data['row']['uid'], 'mod.SHARED');
-            $disableLanguages = isset($modSharedTSconfig['properties']['disableLanguages']) ? GeneralUtility::trimExplode(',', $modSharedTSconfig['properties']['disableLanguages'], true) : [];
+            $disableLanguages = GeneralUtility::trimExplode(
+                ',',
+                BackendUtility::getPagesTSconfig($data['row']['uid'])['mod.']['SHARED.']['disableLanguages'] ?? '',
+                true
+            );
             // Traverse system languages:
             foreach ($languages as $langRow) {
                 if ($this->pObj->MOD_SETTINGS['lang'] == 0 || (int)$this->pObj->MOD_SETTINGS['lang'] === (int)$langRow['uid']) {
index f67d613..1704c15 100644 (file)
@@ -147,4 +147,10 @@ return [
             'Deprecation-83592-ImpexpRemovedMaximumNumberOfRecordsRestriction.rst'
         ],
     ],
+    'TYPO3\CMS\core\Authentication\BackendUserAuthentication->getTSConfig' => [
+        'maximumNumberOfArguments' => 0,
+        'restFiles' => [
+            'Deprecation-84993-DeprecateSomeTSconfigRelatedMethods.rst'
+        ],
+    ],
 ];
index 4dfdc79..b2109fc 100644 (file)
@@ -2200,4 +2200,18 @@ return [
             'Deprecation-84993-DeprecateSomeTSconfigRelatedMethods.rst',
         ],
     ],
+    'TYPO3\CMS\backend\Tree\View\PagePositionMap->getModConfig' => [
+        'numberOfMandatoryArguments' => 1,
+        'maximumNumberOfArguments' => 1,
+        'restFiles' => [
+            'Deprecation-84993-DeprecateSomeTSconfigRelatedMethods.rst',
+        ],
+    ],
+    'TYPO3\CMS\core\DataHandling\DataHandler->getTCEMAIN_TSconfig' => [
+        'numberOfMandatoryArguments' => 1,
+        'maximumNumberOfArguments' => 1,
+        'restFiles' => [
+            'Deprecation-84993-DeprecateSomeTSconfigRelatedMethods.rst',
+        ],
+    ],
 ];
index 1496d50..8e4b641 100644 (file)
@@ -554,4 +554,18 @@ return [
             'Deprecation-84994-BackendUtilitygetPidForModTSconfigDeprecated.rst',
         ],
     ],
+    'TYPO3\CMS\backend\Utility\BackendUtility::getModTSconfig' => [
+        'numberOfMandatoryArguments' => 2,
+        'maximumNumberOfArguments' => 2,
+        'restFiles' => [
+            'Deprecation-84993-DeprecateSomeTSconfigRelatedMethods.rst',
+        ],
+    ],
+    'TYPO3\CMS\backend\Utility\BackendUtility::unsetMenuItems' => [
+        'numberOfMandatoryArguments' => 3,
+        'maximumNumberOfArguments' => 3,
+        'restFiles' => [
+            'Deprecation-84993-DeprecateSomeTSconfigRelatedMethods.rst',
+        ],
+    ],
 ];
index c48695b..64cf4c8 100644 (file)
@@ -577,4 +577,19 @@ return [
             'Deprecation-84984-ProtectedUserTSconfigPropertiesInBackendUserAuthentication.rst'
         ],
     ],
+    'TYPO3\CMS\backend\Tree\View\PagePositionMap->getModConfigCache' => [
+        'restFiles' => [
+            'Deprecation-84984-ProtectedUserTSconfigPropertiesInBackendUserAuthentication.rst'
+        ],
+    ],
+    'TYPO3\CMS\backend\Tree\View\PagePositionMap->modConfigStr' => [
+        'restFiles' => [
+            'Deprecation-84984-ProtectedUserTSconfigPropertiesInBackendUserAuthentication.rst'
+        ],
+    ],
+    'TYPO3\CMS\recordlist\Controller\RecordListController->modTSconfig' => [
+        'restFiles' => [
+            'Deprecation-84984-ProtectedUserTSconfigPropertiesInBackendUserAuthentication.rst'
+        ],
+    ],
 ];
index bbe9ae1..f7523f1 100644 (file)
@@ -153,8 +153,7 @@ class LinkValidatorReport extends \TYPO3\CMS\Backend\Module\AbstractFunctionModu
         // get searchLevel (number of levels of pages to check / show results)
         $this->searchLevel[$prefix] = GeneralUtility::_GP($prefix . '_search_levels');
         if (isset($this->pObj->id)) {
-            $this->modTS = BackendUtility::getModTSconfig($this->pObj->id, 'mod.linkvalidator');
-            $this->modTS = $this->modTS['properties'];
+            $this->modTS = BackendUtility::getPagesTSconfig($this->pObj->id)['mod.']['linkvalidator.'] ?? [];
         }
         if (isset($this->searchLevel[$prefix])) {
             $this->pObj->MOD_SETTINGS[$prefix . '_searchlevel'] = $this->searchLevel[$prefix];
index 0b01b05..b3fb0db 100644 (file)
@@ -362,7 +362,6 @@ class ValidatorTask extends AbstractTask
      */
     protected function loadModTsConfig($page)
     {
-        $modTs = BackendUtility::getModTSconfig($page, 'mod.linkvalidator');
         $parseObj = GeneralUtility::makeInstance(TypoScriptParser::class);
         $parseObj->parse($this->configuration);
         if (!empty($parseObj->errors)) {
@@ -374,8 +373,8 @@ class ValidatorTask extends AbstractTask
             }
             throw new \Exception($parseErrorMessage, '1295476989');
         }
+        $modTs = BackendUtility::getPagesTSconfig($page)['mod.']['linkvalidator.'] ?? [];
         $tsConfig = $parseObj->setup;
-        $modTs = $modTs['properties'];
         $overrideTs = $tsConfig['mod.']['linkvalidator.'];
         if (is_array($overrideTs)) {
             ArrayUtility::mergeRecursiveWithOverrule($modTs, $overrideTs);
index 68ccaf8..39d115d 100644 (file)
@@ -81,16 +81,12 @@ class FileBrowser extends AbstractElementBrowser implements ElementBrowserInterf
         $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Recordlist/BrowseFiles');
         $this->fileRepository = GeneralUtility::makeInstance(FileRepository::class);
 
-        $modTSconfig = BackendUtility::getModTSconfig(0, 'options.file_list');
-        if (isset($modTSconfig['properties']['thumbnail.']['width'])
-            && MathUtility::canBeInterpretedAsInteger($modTSconfig['properties']['thumbnail.']['width'])
-        ) {
-            $this->thumbnailConfiguration['width'] = (int)$modTSconfig['properties']['thumbnail.']['width'];
+        $thumbnailConfig = $this->getBackendUser()->getTSConfig()['options.']['file_list.']['thumbnail.'] ?? [];
+        if (isset($thumbnailConfig['width']) && MathUtility::canBeInterpretedAsInteger($thumbnailConfig['width'])) {
+            $this->thumbnailConfiguration['width'] = (int)$thumbnailConfig['width'];
         }
-        if (isset($modTSconfig['properties']['thumbnail.']['height'])
-            && MathUtility::canBeInterpretedAsInteger($modTSconfig['properties']['thumbnail.']['height'])
-        ) {
-            $this->thumbnailConfiguration['height'] = (int)$modTSconfig['properties']['thumbnail.']['height'];
+        if (isset($thumbnailConfig['height']) && MathUtility::canBeInterpretedAsInteger($thumbnailConfig['height'])) {
+            $this->thumbnailConfiguration['height'] = (int)$thumbnailConfig['height'];
         }
     }
 
index 542245c..fd7ba82 100644 (file)
@@ -23,6 +23,7 @@ use TYPO3\CMS\Backend\Template\DocumentTemplate;
 use TYPO3\CMS\Backend\Template\ModuleTemplate;
 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\HiddenRestriction;
 use TYPO3\CMS\Core\DataHandling\DataHandler;
@@ -44,6 +45,17 @@ use TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList;
  */
 class RecordListController
 {
+    use PublicPropertyDeprecationTrait;
+
+    /**
+     * Properties which have been moved to protected status from public
+     *
+     * @var array
+     */
+    protected $deprecatedPublicProperties = [
+        'modTSconfig' => 'Using $modTSconfig of class RecordListController is discouraged. This property is for class internal use only.',
+    ];
+
     /**
      * Page Id for which to make the listing
      *
@@ -133,7 +145,7 @@ class RecordListController
      *
      * @var array
      */
-    public $modTSconfig;
+    protected $modTSconfig;
 
     /**
      * Current ids page record
@@ -171,13 +183,6 @@ class RecordListController
     public $content;
 
     /**
-     * The name of the module
-     *
-     * @var string
-     */
-    protected $moduleName = 'web_list';
-
-    /**
      * @var string
      */
     public $body = '';
@@ -253,9 +258,9 @@ class RecordListController
             'clipBoard' => '',
         ];
         // Loading module configuration:
-        $this->modTSconfig = BackendUtility::getModTSconfig($this->id, 'mod.' . $this->moduleName);
+        $this->modTSconfig['properties'] = BackendUtility::getPagesTSconfig($this->id)['mod.']['web_list.'] ?? [];
         // Clean up settings:
-        $this->MOD_SETTINGS = BackendUtility::getModuleData($this->MOD_MENU, GeneralUtility::_GP('SET'), $this->moduleName);
+        $this->MOD_SETTINGS = BackendUtility::getModuleData($this->MOD_MENU, GeneralUtility::_GP('SET'), 'web_list');
     }
 
     /**
@@ -699,10 +704,11 @@ class RecordListController
                 }
             }
             // Remove disabled languages
-            $modSharedTSconfig = BackendUtility::getModTSconfig($id, 'mod.SHARED');
-            $disableLanguages = isset($modSharedTSconfig['properties']['disableLanguages'])
-                ? GeneralUtility::trimExplode(',', $modSharedTSconfig['properties']['disableLanguages'], true)
-                : [];
+            $disableLanguages = GeneralUtility::trimExplode(
+                ',',
+                BackendUtility::getPagesTSconfig($id)['mod.']['SHARED.']['disableLanguages'] ?? '',
+                true
+            );
             if (!empty($availableTranslations) && !empty($disableLanguages)) {
                 foreach ($disableLanguages as $language) {
                     if ($language != 0 && isset($availableTranslations[$language])) {
index ca26ba0..e68f7ea 100644 (file)
@@ -1675,8 +1675,8 @@ class DatabaseRecordList
                                 : $this->iconFactory->getIcon('actions-add', Icon::SIZE_SMALL);
                             if ($table === 'tt_content') {
                                 // If mod.newContentElementWizard.override is set, use that extension's create new content wizard instead:
-                                $tmpTSc = BackendUtility::getModTSconfig($this->pageinfo['uid'], 'mod');
-                                $newContentElementWizard = $tmpTSc['properties']['newContentElementWizard.']['override'] ?? 'new_content_element_wizard';
+                                $newContentElementWizard = BackendUtility::getPagesTSconfig($this->pageinfo['uid'])['mod.']['newContentElementWizard.']['override']
+                                    ?? 'new_content_element_wizard';
                                 $url = (string)$uriBuilder->buildUriFromRoute(
                                     $newContentElementWizard,
                                     [
index 4db21ad..57eb2de 100644 (file)
@@ -99,8 +99,8 @@ class RecyclerAjaxController
                 $controller = GeneralUtility::makeInstance(DeletedRecordsController::class);
                 $recordsArray = $controller->transform($deletedRowsArray, $totalDeleted);
 
-                $modTS = $this->getBackendUser()->getTSConfig('mod.recycler');
-                $allowDelete = $this->getBackendUser()->isAdmin() ? true : (bool)$modTS['properties']['allowDelete'];
+                $allowDelete = $this->getBackendUser()->isAdmin()
+                    ?: (bool)($this->getBackendUser()->getTSConfig()['mod.']['recycler.']['allowDelete'] ?? false);
 
                 $view->setTemplatePathAndFilename($extPath . 'Resources/Private/Templates/Ajax/RecordsTable.html');
                 $view->assign('records', $recordsArray['rows']);
index 0bb967b..27dc0d7 100644 (file)
         'disableAllHeaderCode': kw('disableAllHeaderCode'),
         'disableAltText': kw('disableAltText'),
         'disableBodyTag': kw('disableBodyTag'),
-        'disableCacheSelector': kw('disableCacheSelector'),
         'disableCharsetHeader': kw('disableCharsetHeader'),
         'disabled': kw('disabled'),
         'disableDelete': kw('disableDelete'),
index 5a1b5ee..9c6511a 100644 (file)
@@ -71,14 +71,17 @@ class TaskModuleController extends BaseScriptClass
         $this->MOD_MENU = ['mode' => []];
         $this->MOD_MENU['mode']['information'] = $this->getLanguageService()->sL('LLL:EXT:taskcenter/Resources/Private/Language/locallang.xlf:task_overview');
         $this->MOD_MENU['mode']['tasks'] = $this->getLanguageService()->sL('LLL:EXT:taskcenter/Resources/Private/Language/locallang.xlf:task_tasks');
-        /* Copied from parent::menuConfig, because parent is hardcoded to menu.function,
-         * however menu.function is already used for the individual tasks.
-         * Therefore we use menu.mode here.
-         */
+        // Copied from parent::menuConfig, because parent is hardcoded to menu.function,
+        // however menu.function is already used for the individual tasks. Therefore we use menu.mode here.
         // Page/be_user TSconfig settings and blinding of menu-items
-        $this->modTSconfig = BackendUtility::getModTSconfig($this->id, 'mod.' . $this->moduleName);
+        $this->modTSconfig['properties'] = BackendUtility::getPagesTSconfig($this->id)['mod.'][$this->moduleName . '.'] ?? [];
         $this->MOD_MENU['mode'] = $this->mergeExternalItems($this->MCONF['name'], 'mode', $this->MOD_MENU['mode']);
-        $this->MOD_MENU['mode'] = BackendUtility::unsetMenuItems($this->modTSconfig['properties'], $this->MOD_MENU['mode'], 'menu.mode');
+        $blindActions = $this->modTSconfig['properties']['menu.']['mode.'] ?? [];
+        foreach ($blindActions as $key => $value) {
+            if (!$value && array_key_exists($key, $this->MOD_MENU['mode'])) {
+                unset($this->MOD_MENU['mode'][$key]);
+            }
+        }
         parent::menuConfig();
     }
 
index 534a00b..1481861 100644 (file)
@@ -263,8 +263,7 @@ class ViewModuleController
     protected function getTypeParameterIfSet(int $pageId): string
     {
         $typeParameter = '';
-        $modTSconfig = BackendUtility::getModTSconfig($pageId, 'mod.web_view');
-        $typeId = (int)$modTSconfig['properties']['type'];
+        $typeId = (int)(BackendUtility::getPagesTSconfig($pageId)['mod.']['web_view.']['type'] ?? 0);
         if ($typeId > 0) {
             $typeParameter = '&type=' . $typeId;
         }
@@ -291,37 +290,35 @@ class ViewModuleController
      */
     protected function getPreviewPresets(int $pageId): array
     {
-        $modTSconfig = BackendUtility::getModTSconfig($pageId, 'mod.web_view');
         $presetGroups = [
             'desktop' => [],
             'tablet' => [],
             'mobile' => [],
             'unidentified' => []
         ];
-        if (is_array($modTSconfig['properties']['previewFrameWidths.'])) {
-            foreach ($modTSconfig['properties']['previewFrameWidths.'] as $item => $conf) {
-                $data = [
-                    'key' => substr($item, 0, -1),
-                    'label' => $conf['label'] ?? null,
-                    'type' => $conf['type'] ?? 'unknown',
-                    'width' => (isset($conf['width']) && (int)$conf['width'] > 0 && strpos($conf['width'], '%') === false) ? (int)$conf['width'] : null,
-                    'height' => (isset($conf['height']) && (int)$conf['height'] > 0 && strpos($conf['height'], '%') === false) ? (int)$conf['height'] : null,
-                ];
-                $width = (int)substr($item, 0, -1);
-                if (!isset($data['width']) && $width > 0) {
-                    $data['width'] = $width;
-                }
-                if (!isset($data['label'])) {
-                    $data['label'] = $data['key'];
-                } elseif (strpos($data['label'], 'LLL:') === 0) {
-                    $data['label'] = $this->getLanguageService()->sL(trim($data['label']));
-                }
+        $previewFrameWidthConfig = BackendUtility::getPagesTSconfig($pageId)['mod.']['web_view.']['previewFrameWidths.'] ?? [];
+        foreach ($previewFrameWidthConfig as $item => $conf) {
+            $data = [
+                'key' => substr($item, 0, -1),
+                'label' => $conf['label'] ?? null,
+                'type' => $conf['type'] ?? 'unknown',
+                'width' => (isset($conf['width']) && (int)$conf['width'] > 0 && strpos($conf['width'], '%') === false) ? (int)$conf['width'] : null,
+                'height' => (isset($conf['height']) && (int)$conf['height'] > 0 && strpos($conf['height'], '%') === false) ? (int)$conf['height'] : null,
+            ];
+            $width = (int)substr($item, 0, -1);
+            if (!isset($data['width']) && $width > 0) {
+                $data['width'] = $width;
+            }
+            if (!isset($data['label'])) {
+                $data['label'] = $data['key'];
+            } elseif (strpos($data['label'], 'LLL:') === 0) {
+                $data['label'] = $this->getLanguageService()->sL(trim($data['label']));
+            }
 
-                if (array_key_exists($data['type'], $presetGroups)) {
-                    $presetGroups[$data['type']][$data['key']] = $data;
-                } else {
-                    $presetGroups['unidentified'][$data['key']] = $data;
-                }
+            if (array_key_exists($data['type'], $presetGroups)) {
+                $presetGroups[$data['type']][$data['key']] = $data;
+            } else {
+                $presetGroups['unidentified'][$data['key']] = $data;
             }
         }
 
@@ -338,13 +335,13 @@ class ViewModuleController
     {
         $localizationParentField = $GLOBALS['TCA']['pages']['ctrl']['transOrigPointerField'];
         $languageField = $GLOBALS['TCA']['pages']['ctrl']['languageField'];
-        $modSharedTSconfig = BackendUtility::getModTSconfig($pageId, 'mod.SHARED');
-        if ($modSharedTSconfig['properties']['view.']['disableLanguageSelector'] === '1') {
+        $modSharedTSconfig = BackendUtility::getPagesTSconfig($pageId)['mod.']['SHARED.'] ?? [];
+        if ($modSharedTSconfig['view.']['disableLanguageSelector'] === '1') {
             return [];
         }
         $languages = [
-            0 => isset($modSharedTSconfig['properties']['defaultLanguageLabel'])
-                    ? $modSharedTSconfig['properties']['defaultLanguageLabel'] . ' (' . $this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_mod_web_list.xlf:defaultLanguage') . ')'
+            0 => isset($modSharedTSconfig['defaultLanguageLabel'])
+                    ? $modSharedTSconfig['defaultLanguageLabel'] . ' (' . $this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_mod_web_list.xlf:defaultLanguage') . ')'
                     : $this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_mod_web_list.xlf:defaultLanguage')
         ];
         $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('sys_language');
index 17a2478..c915738 100644 (file)
@@ -152,8 +152,11 @@ class PreviewController
         $wsUrl = $previewBaseUrl . '&ADMCMD_prev=IGNORE&ADMCMD_view=1&ADMCMD_editIcons=1';
 
         // Evaluate available preview modes
-        $splitPreviewTsConfig = BackendUtility::getModTSconfig($this->pageId, 'workspaces.splitPreviewModes');
-        $splitPreviewModes = GeneralUtility::trimExplode(',', $splitPreviewTsConfig['value']);
+        $splitPreviewModes = GeneralUtility::trimExplode(
+            ',',
+            BackendUtility::getPagesTSconfig($this->pageId)['workspaces.']['splitPreviewModes'] ?? '',
+            true
+        );
         $allPreviewModes = ['slider', 'vbox', 'hbox'];
         if (!array_intersect($splitPreviewModes, $allPreviewModes)) {
             $splitPreviewModes = $allPreviewModes;