diff --git a/Neos.Fusion/Classes/FusionObjects/ActionUriImplementation.php b/Neos.Fusion/Classes/FusionObjects/ActionUriImplementation.php index 462c150e529..955f5150d20 100644 --- a/Neos.Fusion/Classes/FusionObjects/ActionUriImplementation.php +++ b/Neos.Fusion/Classes/FusionObjects/ActionUriImplementation.php @@ -28,8 +28,6 @@ * * format * * section * * additionalParams - * * addQueryString - * * argumentsToBeExcludedFromQueryString * * absolute * * request * @@ -126,26 +124,6 @@ public function getAdditionalParams(): ?array return $this->fusionValue('additionalParams'); } - /** - * Arguments to be removed from the URI. Only active if addQueryString = true - * - * @return array|null - */ - public function getArgumentsToBeExcludedFromQueryString(): ?array - { - return $this->fusionValue('argumentsToBeExcludedFromQueryString'); - } - - /** - * If true, the current query parameters will be kept in the URI - * - * @return boolean - */ - public function isAddQueryString(): bool - { - return (boolean)$this->fusionValue('addQueryString'); - } - /** * If true, an absolute URI is rendered * @@ -174,11 +152,6 @@ public function evaluate() $uriBuilder->setArguments($additionalParams); } - $argumentsToBeExcludedFromQueryString = $this->getArgumentsToBeExcludedFromQueryString(); - if ($argumentsToBeExcludedFromQueryString !== null) { - $uriBuilder->setArgumentsToBeExcludedFromQueryString($argumentsToBeExcludedFromQueryString); - } - $absolute = $this->isAbsolute(); if ($absolute === true) { $uriBuilder->setCreateAbsoluteUri(true); @@ -189,11 +162,6 @@ public function evaluate() $uriBuilder->setSection($section); } - $addQueryString = $this->isAddQueryString(); - if ($addQueryString === true) { - $uriBuilder->setAddQueryString(true); - } - try { return $uriBuilder->uriFor( $this->getAction(), diff --git a/Neos.Fusion/Classes/FusionObjects/UriBuilderImplementation.php b/Neos.Fusion/Classes/FusionObjects/UriBuilderImplementation.php index f59cdde7359..7b1702a5dd1 100644 --- a/Neos.Fusion/Classes/FusionObjects/UriBuilderImplementation.php +++ b/Neos.Fusion/Classes/FusionObjects/UriBuilderImplementation.php @@ -27,8 +27,6 @@ * * format * * section * * additionalParams - * * addQueryString - * * argumentsToBeExcludedFromQueryString * * absolute * * See respective getters for descriptions @@ -118,26 +116,6 @@ public function getAdditionalParams() return $this->fusionValue('additionalParams'); } - /** - * Arguments to be removed from the URI. Only active if addQueryString = true - * - * @return array - */ - public function getArgumentsToBeExcludedFromQueryString() - { - return $this->fusionValue('argumentsToBeExcludedFromQueryString'); - } - - /** - * If true, the current query parameters will be kept in the URI - * - * @return boolean - */ - public function isAddQueryString() - { - return (boolean)$this->fusionValue('addQueryString'); - } - /** * If true, an absolute URI is rendered * @@ -177,11 +155,6 @@ public function evaluate() $uriBuilder->setArguments($additionalParams); } - $argumentsToBeExcludedFromQueryString = $this->getArgumentsToBeExcludedFromQueryString(); - if ($argumentsToBeExcludedFromQueryString !== null) { - $uriBuilder->setArgumentsToBeExcludedFromQueryString($argumentsToBeExcludedFromQueryString); - } - $absolute = $this->isAbsolute(); if ($absolute === true) { $uriBuilder->setCreateAbsoluteUri(true); @@ -192,11 +165,6 @@ public function evaluate() $uriBuilder->setSection($section); } - $addQueryString = $this->isAddQueryString(); - if ($addQueryString === true) { - $uriBuilder->setAddQueryString(true); - } - try { return $uriBuilder->uriFor( $this->getAction(), diff --git a/Neos.Fusion/Resources/Private/Fusion/Deprecated/UriBuilder.fusion b/Neos.Fusion/Resources/Private/Fusion/Deprecated/UriBuilder.fusion index 1b6568d71c5..f36abea9006 100644 --- a/Neos.Fusion/Resources/Private/Fusion/Deprecated/UriBuilder.fusion +++ b/Neos.Fusion/Resources/Private/Fusion/Deprecated/UriBuilder.fusion @@ -18,11 +18,9 @@ prototype(Neos.Fusion:UriBuilder) { additionalParams = Neos.Fusion:DataStructure { @sortProperties = false } - argumentsToBeExcludedFromQueryString = Neos.Fusion:DataStructure arguments = Neos.Fusion:DataStructure { @sortProperties = false } - addQueryString = false absolute = false @exceptionHandler = 'Neos\\Fusion\\Core\\ExceptionHandlers\\AbsorbingHandler' diff --git a/Neos.Fusion/Resources/Private/Fusion/Prototypes/ActionUri.fusion b/Neos.Fusion/Resources/Private/Fusion/Prototypes/ActionUri.fusion index efc9f263af6..8f9a5e8fca2 100644 --- a/Neos.Fusion/Resources/Private/Fusion/Prototypes/ActionUri.fusion +++ b/Neos.Fusion/Resources/Private/Fusion/Prototypes/ActionUri.fusion @@ -18,8 +18,6 @@ prototype(Neos.Fusion:ActionUri) { section = null additionalParams = Neos.Fusion:DataStructure arguments = Neos.Fusion:DataStructure - argumentsToBeExcludedFromQueryString = Neos.Fusion:DataStructure - addQueryString = false absolute = false @exceptionHandler = 'Neos\\Fusion\\Core\\ExceptionHandlers\\AbsorbingHandler' diff --git a/Neos.Neos/Classes/Fusion/NodeUriImplementation.php b/Neos.Neos/Classes/Fusion/NodeUriImplementation.php index 9afa00aa77f..5086aaef33b 100644 --- a/Neos.Neos/Classes/Fusion/NodeUriImplementation.php +++ b/Neos.Neos/Classes/Fusion/NodeUriImplementation.php @@ -82,26 +82,6 @@ public function getAdditionalParams(): array return array_merge($this->fusionValue('additionalParams'), $this->fusionValue('arguments')); } - /** - * Arguments to be removed from the URI. Only active if addQueryString = true - * - * @return array - */ - public function getArgumentsToBeExcludedFromQueryString(): array - { - return $this->fusionValue('argumentsToBeExcludedFromQueryString'); - } - - /** - * If true, the current query parameters will be kept in the URI - * - * @return boolean - */ - public function getAddQueryString() - { - return (bool)$this->fusionValue('addQueryString'); - } - /** * If true, an absolute URI is rendered * @@ -177,9 +157,7 @@ public function evaluate() ->setFormat($this->getFormat()) ->setCreateAbsoluteUri($this->isAbsolute()) ->setArguments($this->getAdditionalParams()) - ->setSection($this->getSection()) - ->setAddQueryString($this->getAddQueryString()) - ->setArgumentsToBeExcludedFromQueryString($this->getArgumentsToBeExcludedFromQueryString()); + ->setSection($this->getSection()); try { return (string)NodeUriBuilder::fromUriBuilder($uriBuilder)->uriFor($nodeAddress); diff --git a/Neos.Neos/Classes/Service/LinkingService.php b/Neos.Neos/Classes/Service/LinkingService.php index 65780952b11..cd9348a5365 100644 --- a/Neos.Neos/Classes/Service/LinkingService.php +++ b/Neos.Neos/Classes/Service/LinkingService.php @@ -34,8 +34,8 @@ use Neos\Neos\Domain\Repository\SiteRepository; use Neos\Neos\Exception as NeosException; use Neos\Neos\FrontendRouting\NodeAddressFactory; -use Neos\Neos\FrontendRouting\NodeShortcutResolver; use Neos\Neos\FrontendRouting\SiteDetection\SiteDetectionResult; +use Neos\Utility\Arrays; use Psr\Http\Message\UriInterface; use Psr\Log\LoggerInterface; @@ -88,12 +88,6 @@ class LinkingService */ protected $resourceManager; - /** - * @Flow\Inject - * @var NodeShortcutResolver - */ - protected $nodeShortcutResolver; - /** * @Flow\Inject * @var PropertyMapper @@ -260,9 +254,9 @@ public function convertUriToObject($uri, Node $contextNode = null) * @param array $arguments Additional arguments to be passed to the UriBuilder * (e.g. pagination parameters) * @param string $section - * @param boolean $addQueryString If set, the current query parameters will be kept in the URI + * @param boolean $addQueryString If set, the current query parameters will be kept in the URI @deprecated see https://github.com/neos/neos-development-collection/issues/5076 * @param array $argumentsToBeExcludedFromQueryString arguments to be removed from the URI. - * Only active if $addQueryString = true + * Only active if $addQueryString = true @deprecated see https://github.com/neos/neos-development-collection/issues/5076 * @param boolean $resolveShortcuts @deprecated With Neos 7.0 this argument is no longer evaluated * and log a message if set to FALSE * @return string The rendered URI @@ -355,18 +349,27 @@ public function createNodeUri( $workspace = $contentRepository->getWorkspaceFinder()->findOneByName( $node->workspaceName ); - $request = $controllerContext->getRequest()->getMainRequest(); + $mainRequest = $controllerContext->getRequest()->getMainRequest(); $uriBuilder = clone $controllerContext->getUriBuilder(); - $uriBuilder->setRequest($request); + $uriBuilder->setRequest($mainRequest); $action = $workspace && $workspace->isPublicWorkspace() && $node->tags->contain(SubtreeTag::disabled()) ? 'show' : 'preview'; + if ($addQueryString === true) { + // legacy feature see https://github.com/neos/neos-development-collection/issues/5076 + $requestArguments = $mainRequest->getArguments(); + foreach ($argumentsToBeExcludedFromQueryString as $argumentToBeExcluded) { + unset($requestArguments[$argumentToBeExcluded]); + } + if ($requestArguments !== []) { + $arguments = Arrays::arrayMergeRecursiveOverrule($requestArguments, $arguments); + } + } + return $uriBuilder ->reset() ->setSection($section) ->setArguments($arguments) - ->setAddQueryString($addQueryString) - ->setArgumentsToBeExcludedFromQueryString($argumentsToBeExcludedFromQueryString) - ->setFormat($format ?: $request->getFormat()) + ->setFormat($format ?: $mainRequest->getFormat()) ->setCreateAbsoluteUri($absolute) ->uriFor($action, ['node' => $node], 'Frontend\Node', 'Neos.Neos'); } diff --git a/Neos.Neos/Classes/ViewHelpers/Link/ModuleViewHelper.php b/Neos.Neos/Classes/ViewHelpers/Link/ModuleViewHelper.php index 49a8218096b..a3ae7f83ae2 100644 --- a/Neos.Neos/Classes/ViewHelpers/Link/ModuleViewHelper.php +++ b/Neos.Neos/Classes/ViewHelpers/Link/ModuleViewHelper.php @@ -79,14 +79,14 @@ public function initializeArguments() $this->registerArgument( 'addQueryString', 'boolean', - 'If set, the current query parameters will be kept in the URI', + 'Deprecated with Neos 9. If set, the current query parameters will be kept in the URI', false, false ); $this->registerArgument( 'argumentsToBeExcludedFromQueryString', 'array', - 'arguments to be removed from the URI. Only active if $addQueryString = true', + 'Deprecated with Neos 9. arguments to be removed from the URI. Only active if $addQueryString = true', false, [] ); diff --git a/Neos.Neos/Classes/ViewHelpers/Link/NodeViewHelper.php b/Neos.Neos/Classes/ViewHelpers/Link/NodeViewHelper.php index d0786371c7f..341a2566628 100644 --- a/Neos.Neos/Classes/ViewHelpers/Link/NodeViewHelper.php +++ b/Neos.Neos/Classes/ViewHelpers/Link/NodeViewHelper.php @@ -217,20 +217,6 @@ public function initializeArguments() false, '' ); - $this->registerArgument( - 'addQueryString', - 'boolean', - 'If set, the current query parameters will be kept in the URI', - false, - false - ); - $this->registerArgument( - 'argumentsToBeExcludedFromQueryString', - 'array', - 'arguments to be removed from the URI. Only active if $addQueryString = true', - false, - [] - ); $this->registerArgument( 'baseNodeName', 'string', @@ -324,9 +310,7 @@ public function render(): string $uriBuilder->setFormat($this->arguments['format']) ->setCreateAbsoluteUri($this->arguments['absolute']) ->setArguments($this->arguments['arguments']) - ->setSection($this->arguments['section']) - ->setAddQueryString($this->arguments['addQueryString']) - ->setArgumentsToBeExcludedFromQueryString($this->arguments['argumentsToBeExcludedFromQueryString']); + ->setSection($this->arguments['section']); $uri = ''; try { diff --git a/Neos.Neos/Classes/ViewHelpers/Uri/ModuleViewHelper.php b/Neos.Neos/Classes/ViewHelpers/Uri/ModuleViewHelper.php index 31318f186fa..cd1337c8174 100644 --- a/Neos.Neos/Classes/ViewHelpers/Uri/ModuleViewHelper.php +++ b/Neos.Neos/Classes/ViewHelpers/Uri/ModuleViewHelper.php @@ -66,14 +66,14 @@ public function initializeArguments() $this->registerArgument( 'addQueryString', 'string', - 'If set, the current query parameters will be kept in the URI', + 'Deprecated with Neos 9. If set, the current query parameters will be kept in the URI', false, false ); $this->registerArgument( 'argumentsToBeExcludedFromQueryString', 'string', - 'arguments to be removed from the URI. Only active if $addQueryString = true', + 'Deprecated with Neos 9. arguments to be removed from the URI. Only active if $addQueryString = true', false, [] ); diff --git a/Neos.Neos/Classes/ViewHelpers/Uri/NodeViewHelper.php b/Neos.Neos/Classes/ViewHelpers/Uri/NodeViewHelper.php index e7d90c679d4..15739d29ef7 100644 --- a/Neos.Neos/Classes/ViewHelpers/Uri/NodeViewHelper.php +++ b/Neos.Neos/Classes/ViewHelpers/Uri/NodeViewHelper.php @@ -157,20 +157,6 @@ public function initializeArguments() false, '' ); - $this->registerArgument( - 'addQueryString', - 'boolean', - 'If set, the current query parameters will be kept in the URI', - false, - false - ); - $this->registerArgument( - 'argumentsToBeExcludedFromQueryString', - 'array', - 'arguments to be removed from the URI. Only active if $addQueryString = true', - false, - [] - ); $this->registerArgument( 'baseNodeName', 'string', @@ -227,9 +213,7 @@ public function render(): string $uriBuilder->setFormat($this->arguments['format']) ->setCreateAbsoluteUri($this->arguments['absolute']) ->setArguments($this->arguments['arguments']) - ->setSection($this->arguments['section']) - ->setAddQueryString($this->arguments['addQueryString']) - ->setArgumentsToBeExcludedFromQueryString($this->arguments['argumentsToBeExcludedFromQueryString']); + ->setSection($this->arguments['section']); $uri = ''; if (!$nodeAddress) { diff --git a/Neos.Neos/Documentation/References/NeosFusionReference.rst b/Neos.Neos/Documentation/References/NeosFusionReference.rst index bc26a54be82..371c7c0821e 100644 --- a/Neos.Neos/Documentation/References/NeosFusionReference.rst +++ b/Neos.Neos/Documentation/References/NeosFusionReference.rst @@ -570,8 +570,6 @@ Built a URI to a controller action :format: (string) An optional request format (e.g. ``'html'``) :section: (string) An optional fragment (hash) for the URI :additionalParams: (array) Additional URI query parameters by named key -:addQueryString: (boolean) Whether to keep the query parameters of the current URI -:argumentsToBeExcludedFromQueryString: (array) Query parameters to exclude for ``addQueryString`` :absolute: (boolean) Whether to create an absolute URI Example:: @@ -1181,8 +1179,6 @@ Build a URI to a node. Accepts the same arguments as the node link/uri view help :format: (string) An optional request format (e.g. ``'html'``) :section: (string) An optional fragment (hash) for the URI :additionalParams: (array) Additional URI query parameters. -:argumentsToBeExcludedFromQueryString: (array) Query parameters to exclude for ``addQueryString`` -:addQueryString: (boolean) Whether to keep current query parameters, defaults to ``FALSE`` :absolute: (boolean) Whether to create an absolute URI, defaults to ``FALSE`` :baseNodeName: (string) Base node context variable name (for relative paths), defaults to ``'documentNode'`` @@ -1355,8 +1351,6 @@ Built a URI to a controller action :format: (string) An optional request format (e.g. ``'html'``) :section: (string) An optional fragment (hash) for the URI :additionalParams: (array) Additional URI query parameters by named key -:addQueryString: (boolean) Whether to keep the query parameters of the current URI -:argumentsToBeExcludedFromQueryString: (array) Query parameters to exclude for ``addQueryString`` :absolute: (boolean) Whether to create an absolute URI .. note:: The use of ``Neos.Fusion:UriBuilder`` is deprecated. Use :ref:`Neos_Fusion__ActionUri` instead. diff --git a/Neos.Neos/Resources/Private/Fusion/Prototypes/NodeLink.fusion b/Neos.Neos/Resources/Private/Fusion/Prototypes/NodeLink.fusion index c064f1131f5..e4bc0b1eb4a 100644 --- a/Neos.Neos/Resources/Private/Fusion/Prototypes/NodeLink.fusion +++ b/Neos.Neos/Resources/Private/Fusion/Prototypes/NodeLink.fusion @@ -5,8 +5,6 @@ prototype(Neos.Neos:NodeLink) < prototype(Neos.Fusion:Tag) { node = null additionalParams = Neos.Fusion:DataStructure arguments = Neos.Fusion:DataStructure - argumentsToBeExcludedFromQueryString = Neos.Fusion:DataStructure - addQueryString = false absolute = false baseNodeName = 'documentNode' @@ -14,8 +12,6 @@ prototype(Neos.Neos:NodeLink) < prototype(Neos.Fusion:Tag) { node = ${this.node} additionalParams = ${this.additionalParams} arguments = ${this.arguments} - argumentsToBeExcludedFromQueryString = ${this.argumentsToBeExcludedFromQueryString} - addQueryString = ${this.addQueryString} absolute = ${this.absolute} baseNodeName = ${this.baseNodeName} } @@ -26,8 +22,6 @@ prototype(Neos.Neos:NodeLink) < prototype(Neos.Fusion:Tag) { node = ${node} additionalParams = ${additionalParams} arguments = ${arguments} - argumentsToBeExcludedFromQueryString = ${argumentsToBeExcludedFromQueryString} - addQueryString = ${addQueryString} absolute = ${absolute} baseNodeName = ${baseNodeName} } diff --git a/Neos.Neos/Resources/Private/Fusion/Prototypes/NodeUri.fusion b/Neos.Neos/Resources/Private/Fusion/Prototypes/NodeUri.fusion index b6b496f4dc1..6d9a9f5e0f6 100644 --- a/Neos.Neos/Resources/Private/Fusion/Prototypes/NodeUri.fusion +++ b/Neos.Neos/Resources/Private/Fusion/Prototypes/NodeUri.fusion @@ -4,6 +4,5 @@ prototype(Neos.Neos:NodeUri) { @class = 'Neos\\Neos\\Fusion\\NodeUriImplementation' additionalParams = Neos.Fusion:DataStructure arguments = Neos.Fusion:DataStructure - argumentsToBeExcludedFromQueryString = Neos.Fusion:DataStructure @exceptionHandler = 'Neos\\Fusion\\Core\\ExceptionHandlers\\AbsorbingHandler' }