[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 <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
This commit is contained in:
Benni Mack 2017-11-24 23:30:11 +01:00 committed by Susanne Moog
parent 721e2a4455
commit 37984b4c68

View file

@ -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
. '</span>';
$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)) {