[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 <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
This commit is contained in:
Christian Kuhn 2018-05-13 14:15:40 +02:00 committed by Wouter Wolters
parent 3ef11d9370
commit 086d29c16b
2 changed files with 3 additions and 3 deletions

View file

@ -296,8 +296,8 @@ class FrontendEditPanel
*/ */
protected function editPanelLinkWrap_doWrap($string, $url, $additionalClasses = '') protected function editPanelLinkWrap_doWrap($string, $url, $additionalClasses = '')
{ {
$width = MathUtility::forceIntegerInRange($this->backendUser->getTSConfigVal('options.feedit.popupWidth'), 690, 5000, 690); $width = MathUtility::forceIntegerInRange($this->backendUser->getTSConfig()['options.']['feedit.']['popupWidth'] ?? 690, 690, 5000, 690);
$height = MathUtility::forceIntegerInRange($this->backendUser->getTSConfigVal('options.feedit.popupHeight'), 500, 5000, 500); $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;'; $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 '<a href="#" class="typo3-editPanel-btn typo3-editPanel-btn-default frontEndEditIconLinks ' . htmlspecialchars($additionalClasses) . '" onclick="' . htmlspecialchars($onclick) . '" style="display: none;">' . $string . '</a>'; return '<a href="#" class="typo3-editPanel-btn typo3-editPanel-btn-default frontEndEditIconLinks ' . htmlspecialchars($additionalClasses) . '" onclick="' . htmlspecialchars($onclick) . '" style="display: none;">' . $string . '</a>';
} }

View file

@ -42,7 +42,7 @@ class FrontendEditInitiator implements MiddlewareInterface
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{ {
if (isset($GLOBALS['BE_USER']) && $GLOBALS['BE_USER'] instanceof FrontendBackendUserAuthentication) { 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; $active = (int)$GLOBALS['TSFE']->displayEditIcons === 1 || (int)$GLOBALS['TSFE']->displayFieldEditIcons === 1;
if ($active && isset($config['enable.'])) { if ($active && isset($config['enable.'])) {
foreach ($config['enable.'] as $value) { foreach ($config['enable.'] as $value) {