From 37984b4c68644d793945ebbc14bd8ce5eee83b63 Mon Sep 17 00:00:00 2001 From: Benni Mack Date: Fri, 24 Nov 2017 23:30:11 +0100 Subject: [PATCH] [TASK] Use BE Routing / PSR-7 instead of BackendUtility::getModuleUrl The new PSR-7-based solution since TYPO3 v7 should be used everywhere instead of "BackendUtility::getModuleUrl()". This is possible because modules can be addressed via the "route" GET parameter instead of the "M" parameter since a few months. The patch changes all occurrences within TYPO3 Core to use the new API. Resolves: #83172 Releases: master Change-Id: Iec40e8ae00f1d900d7479b84a3a62827ddba653b Reviewed-on: https://review.typo3.org/54755 Reviewed-by: Benni Mack Tested-by: Benni Mack Tested-by: TYPO3com Reviewed-by: Susanne Moog Tested-by: Susanne Moog --- Classes/FrontendEditPanel.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Classes/FrontendEditPanel.php b/Classes/FrontendEditPanel.php index e20689d..011873e 100644 --- a/Classes/FrontendEditPanel.php +++ b/Classes/FrontendEditPanel.php @@ -14,7 +14,6 @@ namespace TYPO3\CMS\Feedit; * The TYPO3 project - inspiring people to share! */ use TYPO3\CMS\Backend\FrontendBackendUserAuthentication; -use TYPO3\CMS\Backend\Utility\BackendUtility; use TYPO3\CMS\Core\Imaging\Icon; use TYPO3\CMS\Core\Imaging\IconFactory; use TYPO3\CMS\Core\Type\Bitmask\JsConfirmation; @@ -217,7 +216,8 @@ class FrontendEditPanel . ''; $noView = GeneralUtility::_GP('ADMCMD_view') ? 1 : 0; - $url = BackendUtility::getModuleUrl( + $uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class); + $url = (string)$uriBuilder->buildUriFromRoute( 'record_edit', [ 'edit[' . $table . '][' . $editUid . ']' => 'edit', @@ -258,18 +258,20 @@ class FrontendEditPanel protected function editPanelLinkWrap($string, $formName, $cmd, $currentRecord = '', $confirm = '', $nPid = '') { $noView = GeneralUtility::_GP('ADMCMD_view') ? 1 : 0; + /** @var \TYPO3\CMS\Backend\Routing\UriBuilder $uriBuilder */ + $uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class); if ($cmd === 'edit') { $rParts = explode(':', $currentRecord); - $out = $this->editPanelLinkWrap_doWrap($string, BackendUtility::getModuleUrl('record_edit', ['edit[' . $rParts[0] . '][' . $rParts[1] . ']' => 'edit', 'noView' => $noView, 'feEdit' => 1]), $currentRecord); + $out = $this->editPanelLinkWrap_doWrap($string, (string)$uriBuilder->buildUriFromRoute('record_edit', ['edit[' . $rParts[0] . '][' . $rParts[1] . ']' => 'edit', 'noView' => $noView, 'feEdit' => 1]), $currentRecord); } elseif ($cmd === 'new') { $rParts = explode(':', $currentRecord); if ($rParts[0] === 'pages') { - $out = $this->editPanelLinkWrap_doWrap($string, BackendUtility::getModuleUrl('db_new', ['id' => $rParts[1], 'pagesOnly' => 1]), $currentRecord); + $out = $this->editPanelLinkWrap_doWrap($string, (string)$uriBuilder->buildUriFromRoute('db_new', ['id' => $rParts[1], 'pagesOnly' => 1]), $currentRecord); } else { if (!(int)$nPid) { $nPid = MathUtility::canBeInterpretedAsInteger($rParts[1]) ? -$rParts[1] : $this->frontendController->id; } - $out = $this->editPanelLinkWrap_doWrap($string, BackendUtility::getModuleUrl('record_edit', ['edit[' . $rParts[0] . '][' . $nPid . ']' => 'new', 'noView' => $noView]), $currentRecord); + $out = $this->editPanelLinkWrap_doWrap($string, (string)$uriBuilder->buildUriFromRoute('record_edit', ['edit[' . $rParts[0] . '][' . $nPid . ']' => 'new', 'noView' => $noView]), $currentRecord); } } else { if ($confirm && $this->backendUser->jsConfirmation(JsConfirmation::FE_EDIT)) {