From 4d11d9fdff7e12345bcd8eb7cd7d1b5efa15239a Mon Sep 17 00:00:00 2001 From: Benni Mack <benni@typo3.org> Date: Wed, 13 Jan 2016 08:54:07 +0100 Subject: [PATCH] [TASK] Remove usage of $GLOBALS[SOBE] The page position map for web_layout uses a simple linkThisScript method and calls the global variable. The change includes the tiny adaptions in the own class as well, to remove the dependency on $GLOBALS[SOBE] for this use case. Resolves: #72670 Releases: master Change-Id: I797d1073abc0cd63f9c4434632cc2dc1b78f8ba7 Reviewed-on: https://review.typo3.org/45859 Reviewed-by: Georg Ringer <georg.ringer@gmail.com> Tested-by: Georg Ringer <georg.ringer@gmail.com> Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl> Tested-by: Wouter Wolters <typo3@wouterwolters.nl> --- .../View/ContentLayoutPagePositionMap.php | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/typo3/sysext/backend/Classes/Tree/View/ContentLayoutPagePositionMap.php b/typo3/sysext/backend/Classes/Tree/View/ContentLayoutPagePositionMap.php index dd1527b56c57..867d18939bd7 100644 --- a/typo3/sysext/backend/Classes/Tree/View/ContentLayoutPagePositionMap.php +++ b/typo3/sysext/backend/Classes/Tree/View/ContentLayoutPagePositionMap.php @@ -42,7 +42,7 @@ class ContentLayoutPagePositionMap extends PagePositionMap */ public function wrapRecordTitle($str, $row) { - $aOnClick = 'jumpToUrl(' . GeneralUtility::quoteJSvalue($GLOBALS['SOBE']->local_linkThisScript(array('edit_record' => ('tt_content:' . $row['uid'])))) . ');return false;'; + $aOnClick = 'jumpToUrl(' . GeneralUtility::quoteJSvalue($this->linkToCurrentModule(['edit_record' => 'tt_content:' . $row['uid']])) . ');return false;'; return '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . $str . '</a>'; } @@ -56,7 +56,7 @@ class ContentLayoutPagePositionMap extends PagePositionMap */ public function wrapColumnHeader($str, $vv) { - $aOnClick = 'jumpToUrl(' . GeneralUtility::quoteJSvalue($GLOBALS['SOBE']->local_linkThisScript(array('edit_record' => ('_EDIT_COL:' . $vv)))) . ');return false;'; + $aOnClick = 'jumpToUrl(' . GeneralUtility::quoteJSvalue($this->linkToCurrentModule(['edit_record' => '_EDIT_COL:' . $vv])) . ');return false;'; return '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . $str . '</a>'; } @@ -73,10 +73,11 @@ class ContentLayoutPagePositionMap extends PagePositionMap public function onClickInsertRecord($row, $vv, $moveUid, $pid, $sys_lang = 0) { if (is_array($row)) { - $location = $GLOBALS['SOBE']->local_linkThisScript(array('edit_record' => 'tt_content:new/-' . $row['uid'] . '/' . $row['colPos'])); + $linkInformation = 'tt_content:new/-' . $row['uid'] . '/' . $row['colPos']; } else { - $location = $GLOBALS['SOBE']->local_linkThisScript(array('edit_record' => 'tt_content:new/' . $pid . '/' . $vv)); + $linkInformation = 'tt_content:new/' . $pid . '/' . $vv; } + $location = $this->linkToCurrentModule(['edit_record' => $linkInformation]); return 'jumpToUrl(' . GeneralUtility::quoteJSvalue($location) . ');return false;'; } @@ -97,4 +98,19 @@ class ContentLayoutPagePositionMap extends PagePositionMap return $str; } } + + /** + * Returns URL to the current script. + * In particular the "popView" and "new_unique_uid" Get vars are unset. + * + * @param array $params Parameters array, merged with global GET vars. + * @return string URL + */ + protected function linkToCurrentModule($params) + { + unset($params['popView']); + unset($params['new_unique_uid']); + return GeneralUtility::linkThisScript($params); + } + } -- GitLab