Skip to content

Commit

Permalink
[TASK] Recordlist: Replace BackendUtility::getLinkToDataHandlerAction
Browse files Browse the repository at this point in the history
Replace BackendUtility::getLinkToDataHandlerAction and use the
uriBuilder instead.

Releases: master
Resolves: #92407
Change-Id: I96b2f1698aa5dcf056fa24fd548c01cc3fb4ce6f
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/65873
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
  • Loading branch information
dawind authored and lolli42 committed Sep 25, 2020
1 parent 137b089 commit 13d6480
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 17 deletions.
Expand Up @@ -450,11 +450,10 @@ protected function languageSelector(int $id): string
'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
];
$redirectUrl = (string)$this->uriBuilder->buildUriFromRoute('record_edit', $parameters);
$targetUrl = BackendUtility::getLinkToDataHandlerAction(
'&cmd[pages][' . $id . '][localize]=' . $languageUid,
$redirectUrl
);

$params = [];
$params['redirect'] = $redirectUrl;
$params['cmd']['pages'][$id]['localize'] = $languageUid;
$targetUrl = (string)$this->uriBuilder->buildUriFromRoute('tce_db', $params);
$output .= '<option value="' . htmlspecialchars($targetUrl) . '">' . htmlspecialchars($languageTitle) . '</option>';
}

Expand Down
32 changes: 20 additions & 12 deletions typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php
Expand Up @@ -1846,8 +1846,10 @@ public function makeControl($table, $row)
if ($permsEdit && $GLOBALS['TCA'][$table]['ctrl']['sortby'] && !$this->sortField && !$this->searchLevels) {
if (!$isL10nOverlay && !$isDeletePlaceHolder && isset($this->currentTable['prev'][$row['uid']])) {
// Up
$params = '&cmd[' . $table . '][' . $row['uid'] . '][move]=' . $this->currentTable['prev'][$row['uid']];
$url = BackendUtility::getLinkToDataHandlerAction($params, $this->listURL());
$params = [];
$params['redirect'] = $this->listURL();
$params['cmd'][$table][$row['uid']]['move'] = $this->currentTable['prev'][$row['uid']];
$url = (string)$this->uriBuilder->buildUriFromRoute('tce_db', $params);
$moveUpAction = '<a class="btn btn-default" href="' . htmlspecialchars($url) . '" title="' . htmlspecialchars($this->getLanguageService()->getLL('moveUp')) . '">'
. $this->iconFactory->getIcon('actions-move-up', Icon::SIZE_SMALL)->render() . '</a>';
} else {
Expand All @@ -1857,8 +1859,10 @@ public function makeControl($table, $row)

if (!$isL10nOverlay && !$isDeletePlaceHolder && $this->currentTable['next'][$row['uid']]) {
// Down
$params = '&cmd[' . $table . '][' . $row['uid'] . '][move]=' . $this->currentTable['next'][$row['uid']];
$url = BackendUtility::getLinkToDataHandlerAction($params, $this->listURL());
$params = [];
$params['redirect'] = $this->listURL();
$params['cmd'][$table][$row['uid']]['move'] = $this->currentTable['next'][$row['uid']];
$url = (string)$this->uriBuilder->buildUriFromRoute('tce_db', $params);
$moveDownAction = '<a class="btn btn-default" href="' . htmlspecialchars($url) . '" title="' . htmlspecialchars($this->getLanguageService()->getLL('moveDown')) . '">'
. $this->iconFactory->getIcon('actions-move-down', Icon::SIZE_SMALL)->render() . '</a>';
} else {
Expand Down Expand Up @@ -1937,8 +1941,10 @@ public function makeControl($table, $row)
// Up (Paste as the page right after the current parent page)
if ($this->calcPerms->createPagePermissionIsGranted()) {
if (!$isDeletePlaceHolder && !$isL10nOverlay) {
$params = '&cmd[' . $table . '][' . $row['uid'] . '][move]=' . -$this->id;
$url = BackendUtility::getLinkToDataHandlerAction($params, $this->listURL());
$params = [];
$params['redirect'] = $this->listURL();
$params['cmd'][$table][$row['uid']]['move'] = -$this->id;
$url = (string)$this->uriBuilder->buildUriFromRoute('tce_db', $params);
$moveLeftAction = '<a class="btn btn-default" href="' . htmlspecialchars($url) . '" title="' . htmlspecialchars($this->getLanguageService()->getLL('prevLevel')) . '">'
. $this->iconFactory->getIcon('actions-move-left', Icon::SIZE_SMALL)->render() . '</a>';
$this->addActionToCellGroup($cells, $moveLeftAction, 'moveLeft');
Expand All @@ -1950,8 +1956,10 @@ public function makeControl($table, $row)
if (!$isL10nOverlay && !$isDeletePlaceHolder && $this->currentTable['prevUid'][$row['uid']]) {
$localCalcPerms = new Permission($backendUser->calcPerms(BackendUtility::getRecord('pages', $this->currentTable['prevUid'][$row['uid']])));
if ($localCalcPerms->createPagePermissionIsGranted()) {
$params = '&cmd[' . $table . '][' . $row['uid'] . '][move]=' . $this->currentTable['prevUid'][$row['uid']];
$url = BackendUtility::getLinkToDataHandlerAction($params, $this->listURL());
$params = [];
$params['redirect'] = $this->listURL();
$params['cmd'][$table][$row['uid']]['move'] = $this->currentTable['prevUid'][$row['uid']];
$url = (string)$this->uriBuilder->buildUriFromRoute('tce_db', $params);
$moveRightAction = '<a class="btn btn-default" href="' . htmlspecialchars($url) . '" title="' . htmlspecialchars($this->getLanguageService()->getLL('nextLevel')) . '">'
. $this->iconFactory->getIcon('actions-move-right', Icon::SIZE_SMALL)->render() . '</a>';
} else {
Expand Down Expand Up @@ -2201,10 +2209,10 @@ public function makeLocalizationPanel($table, $row, array $translations): string
'returnUrl' => $this->listURL()
]
);
$href = BackendUtility::getLinkToDataHandlerAction(
'&cmd[' . $table . '][' . $row['uid'] . '][localize]=' . $lUid_OnPage,
$redirectUrl
);
$params = [];
$params['redirect'] = $redirectUrl;
$params['cmd'][$table][$row['uid']]['localize'] = $lUid_OnPage;
$href = (string)$this->uriBuilder->buildUriFromRoute('tce_db', $params);
$language = BackendUtility::getRecord('sys_language', $lUid_OnPage, 'title');
if ($this->languageIconTitles[$lUid_OnPage]['flagIcon']) {
$lC = $this->iconFactory->getIcon($this->languageIconTitles[$lUid_OnPage]['flagIcon'], Icon::SIZE_SMALL)->render();
Expand Down

0 comments on commit 13d6480

Please sign in to comment.