[TASK] Replace EditRecordViewHelper of EXT:redirects with ModuleLinkViewHelper 84/59584/4
authorGeorg Ringer <georg.ringer@gmail.com>
Wed, 30 Jan 2019 08:47:01 +0000 (09:47 +0100)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Fri, 1 Feb 2019 18:17:55 +0000 (19:17 +0100)
Resolves: #87580
Releases: master
Change-Id: I5a384707d0c0ecd9b797ce89dced25f0738942c6
Reviewed-on: https://review.typo3.org/59584
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Mona Muzaffar <mona.muzaffar@gmx.de>
Tested-by: Mona Muzaffar <mona.muzaffar@gmx.de>
Tested-by: TYPO3com <noreply@typo3.com>
Reviewed-by: Björn Jacob <bjoern.jacob@tritum.de>
Tested-by: Björn Jacob <bjoern.jacob@tritum.de>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
typo3/sysext/redirects/Classes/ViewHelpers/EditRecordViewHelper.php [deleted file]
typo3/sysext/redirects/Resources/Private/Templates/Management/Overview.html

diff --git a/typo3/sysext/redirects/Classes/ViewHelpers/EditRecordViewHelper.php b/typo3/sysext/redirects/Classes/ViewHelpers/EditRecordViewHelper.php
deleted file mode 100644 (file)
index 5d1e763..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-<?php
-declare(strict_types = 1);
-namespace TYPO3\CMS\Redirects\ViewHelpers;
-
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-use TYPO3\CMS\Backend\Routing\UriBuilder;
-use TYPO3\CMS\Core\Utility\GeneralUtility;
-use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
-use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
-use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
-
-/**
- * Edit Record ViewHelper
- * @internal
- * @todo remove once general edit view helper exists
- */
-class EditRecordViewHelper extends AbstractViewHelper
-{
-    use CompileWithRenderStatic;
-
-    /**
-     * Initializes the arguments
-     */
-    public function initializeArguments()
-    {
-        $this->registerArgument('command', 'string', 'New, Edit or Remove a Record.', true);
-        $this->registerArgument('uid', 'int', 'UID of the Record to edit.', true);
-    }
-
-    /**
-     * Render link
-     *
-     * @param array $arguments
-     * @param \Closure $renderChildrenClosure
-     * @param RenderingContextInterface $renderingContext
-     *
-     * @return string
-     * @throws \TYPO3\CMS\Backend\Routing\Exception\RouteNotFoundException
-     */
-    public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext): string
-    {
-        $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
-
-        switch ($arguments['command']) {
-            case 'delete':
-                $urlParameters = [
-                    'cmd[sys_redirect][' . $arguments['uid'] . '][delete]' => 1,
-                    'redirect' => GeneralUtility::getIndpEnv('REQUEST_URI'),
-                ];
-                $route = 'tce_db';
-                break;
-            case 'unhide':
-                $urlParameters = [
-                    'data[sys_redirect][' . $arguments['uid'] . '][disabled]' => 0,
-                    'redirect' => GeneralUtility::getIndpEnv('REQUEST_URI'),
-                ];
-                $route = 'tce_db';
-                break;
-            case 'hide':
-                $urlParameters = [
-                    'data[sys_redirect][' . $arguments['uid'] . '][disabled]' => 1,
-                    'redirect' => GeneralUtility::getIndpEnv('REQUEST_URI'),
-                ];
-                $route= 'tce_db';
-                break;
-            case 'resetcounter':
-                $urlParameters = [
-                    'data[sys_redirect][' . $arguments['uid'] . '][hitcount]' => 0,
-                    'redirect' => GeneralUtility::getIndpEnv('REQUEST_URI'),
-                ];
-                $route = 'tce_db';
-                break;
-            default:
-                throw new \InvalidArgumentException('Invalid command given to EditRecordViewhelper.', 1516708789);
-        }
-        return (string)$uriBuilder->buildUriFromRoute($route, $urlParameters);
-    }
-}
index 8b50cc8..a068896 100644 (file)
@@ -92,7 +92,7 @@
                                                                                <f:translate key="LLL:EXT:redirects/Resources/Private/Language/locallang_module_redirect.xlf:hit{f:if(condition:'{redirect.hitcount} > 1',then:'s')}_text" arguments="{0:redirect.hitcount}"/>
                                                                                <f:if condition="{redirect.hitcount} != 0">
                                                                                <a class="t3js-modal-trigger"
-                                                                                        href="{rd:editRecord(command: 'resetcounter', uid: redirect.uid)}"
+                                                                                    href="{be:moduleLink(route:'tce_db', query:'data[sys_redirect][{redirect.uid}][hitcount]=0', currentUrlParameterName:'redirect')}"
                                                                                         title="{f:translate(key: 'LLL:EXT:redirects/Resources/Private/Language/locallang_module_redirect.xlf:hit_reset')}"
                                                                                         data-title="{f:translate(key: 'LLL:EXT:redirects/Resources/Private/Language/locallang_module_redirect.xlf:hit_reset.confirm.title')}"
                                                                                         data-content="{f:translate(key: 'LLL:EXT:redirects/Resources/Private/Language/locallang_module_redirect.xlf:hit_reset.confirm.content')}"
                                                                </be:link.editRecord>
                                                                <f:if condition="{redirect.disabled} == 1">
                                                                        <f:then>
-                                                                               <a class="btn btn-default" href="{rd:editRecord(command: 'unhide', uid: redirect.uid)}" title="{f:translate(key:'LLL:EXT:core/Resources/Private/Language/locallang_mod_web_list.xlf:unHide')}"><core:icon identifier="actions-edit-unhide" /></a>
+                                                                               <a class="btn btn-default" href="{be:moduleLink(route:'tce_db', query:'data[sys_redirect][{redirect.uid}][disabled]=0', currentUrlParameterName:'redirect')}" title="{f:translate(key:'LLL:EXT:core/Resources/Private/Language/locallang_mod_web_list.xlf:unHide')}"><core:icon identifier="actions-edit-unhide" /></a>
                                                                        </f:then>
                                                                        <f:else>
-                                                                               <a class="btn btn-default" href="{rd:editRecord(command: 'hide', uid: redirect.uid)}" title="{f:translate(key:'LLL:EXT:core/Resources/Private/Language/locallang_mod_web_list.xlf:hide')}"><core:icon identifier="actions-edit-hide" /></a>
+                                                                               <a class="btn btn-default" href="{be:moduleLink(route:'tce_db', query:'data[sys_redirect][{redirect.uid}][disabled]=1', currentUrlParameterName:'redirect')}" title="{f:translate(key:'LLL:EXT:core/Resources/Private/Language/locallang_mod_web_list.xlf:hide')}"><core:icon identifier="actions-edit-hide" /></a>
                                                                        </f:else>
                                                                </f:if>
                                                                <a class="btn btn-default t3js-modal-trigger"
-                                                                        href="{rd:editRecord(command: 'delete', uid: redirect.uid)}"
+                                                                        href="{be:moduleLink(route:'tce_db', query:'cmd[sys_redirect][{redirect.uid}][delete]=1', currentUrlParameterName:'redirect')}"
                                                                         title="{f:translate(key: 'LLL:EXT:core/Resources/Private/Language/locallang_mod_web_list.xlf:delete')}"
                                                                         data-severity="warning"
                                                                         data-title="{f:translate(key: 'LLL:EXT:backend/Resources/Private/Language/locallang_alt_doc.xlf:label.confirm.delete_record.title')}"