From eb3e677eb319929afd23f85874c859cedfd11513 Mon Sep 17 00:00:00 2001 From: Garvin Hicking <gh@faktor-e.de> Date: Wed, 12 Jun 2024 13:33:34 +0200 Subject: [PATCH] [DOCS] Note about reserved keywords for Extbase arguments ("format") Extbase reserves a couple of keywords for internal use: * action * controller * format (resolving fluid templates for HTML, json, ...) * __trustedProperties * __referrer The notiation "__" (and "@" for sub-arrays) is indiciative of being reserved keywords, however action/controller/format are not. These are now mentioned specifically in the Fluid ViewHelper "arguments" parameter, so that they can show up in the auto-generated documentation. This should help to prevent integrators and developers from advertly using an argument like "format" as a custom variable/property name. Efforts have been made to document this also here: https://github.com/TYPO3-Documentation/TYPO3CMS-Reference-CoreApi/pull/4525 https://github.com/TYPO3-Documentation/TYPO3CMS-Exceptions/pull/155 Resolves: #102246 Releases: main, 12.4, 11.5 Change-Id: I55a306aaa0ba783f9202350d198c9fdf08f5a997 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/84673 Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> Tested-by: core-ci <typo3@b13.com> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> --- typo3/sysext/fluid/Classes/ViewHelpers/FormViewHelper.php | 2 +- .../sysext/fluid/Classes/ViewHelpers/Link/ActionViewHelper.php | 2 +- typo3/sysext/fluid/Classes/ViewHelpers/Uri/ActionViewHelper.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/typo3/sysext/fluid/Classes/ViewHelpers/FormViewHelper.php b/typo3/sysext/fluid/Classes/ViewHelpers/FormViewHelper.php index e426c22c6bcc..08562fd78905 100644 --- a/typo3/sysext/fluid/Classes/ViewHelpers/FormViewHelper.php +++ b/typo3/sysext/fluid/Classes/ViewHelpers/FormViewHelper.php @@ -109,7 +109,7 @@ class FormViewHelper extends AbstractFormViewHelper { parent::initializeArguments(); $this->registerArgument('action', 'string', 'Target action'); - $this->registerArgument('arguments', 'array', 'Arguments', false, []); + $this->registerArgument('arguments', 'array', 'Arguments (do not use reserved keywords "action", "controller" or "format" if not referring to these internal variables specifically)', false, []); $this->registerArgument('controller', 'string', 'Target controller'); $this->registerArgument('extensionName', 'string', 'Target Extension Name (without `tx_` prefix and no underscores). If NULL the current extension name is used'); $this->registerArgument('pluginName', 'string', 'Target plugin. If empty, the current plugin name is used'); diff --git a/typo3/sysext/fluid/Classes/ViewHelpers/Link/ActionViewHelper.php b/typo3/sysext/fluid/Classes/ViewHelpers/Link/ActionViewHelper.php index d93f1b625dc6..20be113700f3 100644 --- a/typo3/sysext/fluid/Classes/ViewHelpers/Link/ActionViewHelper.php +++ b/typo3/sysext/fluid/Classes/ViewHelpers/Link/ActionViewHelper.php @@ -76,7 +76,7 @@ final class ActionViewHelper extends AbstractTagBasedViewHelper $this->registerArgument('absolute', 'bool', 'If set, the URI of the rendered link is absolute'); $this->registerArgument('addQueryString', 'string', 'If set, the current query parameters will be kept in the URL. If set to "untrusted", then ALL query parameters will be added. Be aware, that this might lead to problems when the generated link is cached.', false, false); $this->registerArgument('argumentsToBeExcludedFromQueryString', 'array', 'Arguments to be removed from the URI. Only active if $addQueryString = TRUE'); - $this->registerArgument('arguments', 'array', 'Arguments for the controller action, associative array'); + $this->registerArgument('arguments', 'array', 'Arguments for the controller action, associative array (do not use reserved keywords "action", "controller" or "format" if not referring to these internal variables specifically)'); } public function render(): string diff --git a/typo3/sysext/fluid/Classes/ViewHelpers/Uri/ActionViewHelper.php b/typo3/sysext/fluid/Classes/ViewHelpers/Uri/ActionViewHelper.php index 7e95bf7ce169..ec2bf37a8add 100644 --- a/typo3/sysext/fluid/Classes/ViewHelpers/Uri/ActionViewHelper.php +++ b/typo3/sysext/fluid/Classes/ViewHelpers/Uri/ActionViewHelper.php @@ -52,7 +52,7 @@ final class ActionViewHelper extends AbstractViewHelper public function initializeArguments(): void { $this->registerArgument('action', 'string', 'Target action'); - $this->registerArgument('arguments', 'array', 'Arguments', false, []); + $this->registerArgument('arguments', 'array', 'Arguments (do not use reserved keywords "action", "controller" or "format" if not referring to these internal variables specifically)', false, []); $this->registerArgument('controller', 'string', 'Target controller. If NULL current controllerName is used'); $this->registerArgument('extensionName', 'string', 'Target Extension Name (without `tx_` prefix and no underscores). If NULL the current extension name is used'); $this->registerArgument('pluginName', 'string', 'Target plugin. If empty, the current plugin name is used'); -- GitLab