Skip to content
Snippets Groups Projects
Commit 4d11d9fd authored by Benni Mack's avatar Benni Mack Committed by Wouter Wolters
Browse files

[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: default avatarGeorg Ringer <georg.ringer@gmail.com>
Tested-by: default avatarGeorg Ringer <georg.ringer@gmail.com>
Reviewed-by: default avatarWouter Wolters <typo3@wouterwolters.nl>
Tested-by: default avatarWouter Wolters <typo3@wouterwolters.nl>
parent e4c2f736
......@@ -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);
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment