From 086d29c16bf703bfac7ee1b0c4cfeb9bc7045649 Mon Sep 17 00:00:00 2001 From: Christian Kuhn Date: Sun, 13 May 2018 14:15:40 +0200 Subject: [PATCH] [TASK] Deprecate getTSConfigVal() and getTSConfigProp() The patch deprecates BackendUserAuthentication->getTSConfigVal() and ->getTSConfigProp() and adapts usages to rely on getTSConfig() without arguments. The array nesting is done directly within consuming code and is combined with ?? to a fallback value. Advantages: * Expensive and recursive string operations within getTSConfig() are not used anymore. * The weird 'value' / 'property' based sub array juggling is gone. * Full TSconfig path including fallback can be easily seen within consuming code * Notice free array access using null coalescence operator Change-Id: I6d5777ebd533dcfdc6018e0226bfb3e513cfa652 Resolves: #84993 Related: #84982 Releases: master Reviewed-on: https://review.typo3.org/56953 Reviewed-by: Anja Leichsenring Tested-by: Anja Leichsenring Reviewed-by: Stefan Neufeind Tested-by: Stefan Neufeind Tested-by: TYPO3com Reviewed-by: Wouter Wolters Tested-by: Wouter Wolters --- Classes/FrontendEditPanel.php | 4 ++-- Classes/Middleware/FrontendEditInitiator.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Classes/FrontendEditPanel.php b/Classes/FrontendEditPanel.php index 0133177..1aea7fa 100644 --- a/Classes/FrontendEditPanel.php +++ b/Classes/FrontendEditPanel.php @@ -296,8 +296,8 @@ class FrontendEditPanel */ protected function editPanelLinkWrap_doWrap($string, $url, $additionalClasses = '') { - $width = MathUtility::forceIntegerInRange($this->backendUser->getTSConfigVal('options.feedit.popupWidth'), 690, 5000, 690); - $height = MathUtility::forceIntegerInRange($this->backendUser->getTSConfigVal('options.feedit.popupHeight'), 500, 5000, 500); + $width = MathUtility::forceIntegerInRange($this->backendUser->getTSConfig()['options.']['feedit.']['popupWidth'] ?? 690, 690, 5000, 690); + $height = MathUtility::forceIntegerInRange($this->backendUser->getTSConfig()['options.']['feedit.']['popupHeight'] ?? 500, 500, 5000, 500); $onclick = 'vHWin=window.open(' . GeneralUtility::quoteJSvalue($url . '&returnUrl=' . rawurlencode(PathUtility::getAbsoluteWebPath(GeneralUtility::getFileAbsFileName('EXT:backend/Resources/Public/Html/Close.html')))) . ',\'FEquickEditWindow\',\'width=' . $width . ',height=' . $height . ',status=0,menubar=0,scrollbars=1,resizable=1\');vHWin.focus();return false;'; return ''; } diff --git a/Classes/Middleware/FrontendEditInitiator.php b/Classes/Middleware/FrontendEditInitiator.php index 29b8ade..d2f886b 100644 --- a/Classes/Middleware/FrontendEditInitiator.php +++ b/Classes/Middleware/FrontendEditInitiator.php @@ -42,7 +42,7 @@ class FrontendEditInitiator implements MiddlewareInterface public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface { if (isset($GLOBALS['BE_USER']) && $GLOBALS['BE_USER'] instanceof FrontendBackendUserAuthentication) { - $config = $GLOBALS['BE_USER']->getTSConfigProp('admPanel'); + $config = $GLOBALS['BE_USER']->getTSConfig()['admPanel.'] ?? []; $active = (int)$GLOBALS['TSFE']->displayEditIcons === 1 || (int)$GLOBALS['TSFE']->displayFieldEditIcons === 1; if ($active && isset($config['enable.'])) { foreach ($config['enable.'] as $value) {