[TASK] Use ModuleLinkViewHelper in EXT:sys_note 11/59511/2
authorGeorg Ringer <georg.ringer@gmail.com>
Mon, 21 Jan 2019 13:16:24 +0000 (14:16 +0100)
committerBenni Mack <benni@typo3.org>
Tue, 29 Jan 2019 05:56:37 +0000 (06:56 +0100)
Replace custom VH with the one provided by EXT:backend.

Resolves: #87507
Releases: master
Change-Id: I882d7555654a051e7190d7ffd25ff6e903f16ab1
Reviewed-on: https://review.typo3.org/59511
Tested-by: TYPO3com <noreply@typo3.com>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Fabien Udriot <fabien.udriot@ecodev.ch>
Tested-by: Fabien Udriot <fabien.udriot@ecodev.ch>
Reviewed-by: Josef Glatz <josef.glatz@typo3.org>
Tested-by: Josef Glatz <josef.glatz@typo3.org>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/sys_note/Classes/ViewHelpers/DeleteLinkViewHelper.php [deleted file]
typo3/sysext/sys_note/Resources/Private/Templates/Note/List.html

diff --git a/typo3/sysext/sys_note/Classes/ViewHelpers/DeleteLinkViewHelper.php b/typo3/sysext/sys_note/Classes/ViewHelpers/DeleteLinkViewHelper.php
deleted file mode 100644 (file)
index 1bd5148..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-<?php
-namespace TYPO3\CMS\SysNote\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;
-
-/**
- * ViewHelper to create a link to delete a note
- *
- * @internal
- */
-class DeleteLinkViewHelper extends AbstractViewHelper
-{
-    use CompileWithRenderStatic;
-
-    /**
-     * Initializes the arguments
-     */
-    public function initializeArguments()
-    {
-        $this->registerArgument('id', 'int', 'uid of the note', true);
-    }
-
-    /**
-     * Create link to delete a note
-     *
-     * @param array $arguments
-     * @param \Closure $renderChildrenClosure
-     * @param RenderingContextInterface $renderingContext
-     *
-     * @return string
-     */
-    public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
-    {
-        $urlParameters = [
-            'cmd[sys_note][' . $arguments['id'] . '][delete]' => 1,
-            'redirect' => GeneralUtility::getIndpEnv('REQUEST_URI')
-        ];
-        $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
-        return (string)$uriBuilder->buildUriFromRoute('tce_db', $urlParameters);
-    }
-}
index 520a39c..1fc9f67 100644 (file)
@@ -38,7 +38,7 @@
                                                <be:link.editRecord uid="{note.uid}" table="sys_note" class="btn btn-default btn-sm">
                                                        <core:icon identifier="actions-open" />
                                                </be:link.editRecord>
-                                               <a href="{notes:deleteLink(id:note.uid)}" class="btn btn-default btn-sm t3js-modal-trigger" data-severity="warning" data-title="{f:translate(key: 'LLL:EXT:core/Resources/Private/Language/locallang_common.xlf:delete')}" data-content="{f:translate(key: 'LLL:EXT:backend/Resources/Private/Language/locallang_alt_doc.xlf:deleteWarning')}" data-button-close-text="{f:translate(key: 'LLL:EXT:core/Resources/Private/Language/locallang_common.xlf:cancel')}">
+                                               <a href="{be:moduleLink(route:'tce_db', query:'cmd[sys_note][{note.uid}][delete]=1', currentUrlParameterName:'redirect')}" class="btn btn-default btn-sm t3js-modal-trigger" data-severity="warning" data-title="{f:translate(key: 'LLL:EXT:core/Resources/Private/Language/locallang_common.xlf:delete')}" data-content="{f:translate(key: 'LLL:EXT:backend/Resources/Private/Language/locallang_alt_doc.xlf:deleteWarning')}" data-button-close-text="{f:translate(key: 'LLL:EXT:core/Resources/Private/Language/locallang_common.xlf:cancel')}">
                                                        <core:icon identifier="actions-edit-delete" />
                                                </a>
                                        </div>