diff --git a/Classes/ViewHelpers/Uri/EditRecordViewHelper.php b/Classes/ViewHelpers/Uri/EditRecordViewHelper.php deleted file mode 100644 index 521b6d1..0000000 --- a/Classes/ViewHelpers/Uri/EditRecordViewHelper.php +++ /dev/null @@ -1,82 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. - */ - -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; - -/** - * Use this ViewHelper to provide edit links (only the uri) to records. The ViewHelper will - * pass the uid and table to FormEngine. - * - * The uid must be given as a positive integer. - * For new records, use the :ref:` `. - * - * Examples - * ======== - * - * URI to the record-edit action passed to FormEngine:: - * - * - * - * ``/typo3/index.php?route=/record/edit&edit[a_table][42]=edit&returnUrl=foo/bar`` - */ -class EditRecordViewHelper extends AbstractViewHelper -{ - use CompileWithRenderStatic; - - public function initializeArguments() - { - $this->registerArgument('uid', 'int', 'uid of record to be edited, 0 for creation', true); - $this->registerArgument('table', 'string', 'target database table', true); - $this->registerArgument('returnUrl', 'string', '', false, ''); - $this->registerArgument('columns', 'string', 'columns to show', false, ''); - } - - /** - * @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 - { - if ($arguments['uid'] < 1) { - throw new \InvalidArgumentException('Uid must be a positive integer, ' . $arguments['uid'] . ' given.', 1526128259); - } - if (empty($arguments['returnUrl'])) { - $arguments['returnUrl'] = GeneralUtility::getIndpEnv('REQUEST_URI'); - } - - $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); - return (string)$uriBuilder->buildUriFromRoute('record_edit', [ - 'edit' => [$arguments['table'] => [$arguments['uid'] => 'edit']], - 'columnsOnly' => $arguments['columns'], - 'returnUrl' => $arguments['returnUrl'] - ]); - } -} diff --git a/Resources/Private/Templates/Backend/Page/MetaInfo.html b/Resources/Private/Templates/Backend/Page/MetaInfo.html index 07f07eb..10bd88f 100644 --- a/Resources/Private/Templates/Backend/Page/MetaInfo.html +++ b/Resources/Private/Templates/Backend/Page/MetaInfo.html @@ -1,4 +1,5 @@
@@ -49,10 +50,10 @@ - {f:uri.editRecord( + {be:uri.editRecord( uid: recordUid, table: 'pages', - columns: field + fields: field )} diff --git a/ext_localconf.php b/ext_localconf.php index 09c35d2..4fb81d4 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -14,15 +14,6 @@ ], ], ], - 'SYS' => [ - 'fluid' => [ - 'namespaces' => [ - 'f' => [ - $extKey => 'DanielSiepmann\DsSite\ViewHelpers', - ], - ], - ], - ], ]); \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addUserTSConfig( "@import 'EXT:ds_site/Configuration/UserTSconfig/*.tsconfig'"