Code Monkey home page Code Monkey logo

Comments (5)

mhsdesign avatar mhsdesign commented on June 20, 2024 1

I think were talking slightly past each other. addQueryString is a boolean flag:

:addQueryString: (boolean) Whether to keep the query parameters of the current URI
:argumentsToBeExcludedFromQueryString: (array) Query parameters to exclude for addQueryString

That means its yes is separate from the routing - currently handled by Flows uri builder - but might still not be sensible to reimplement.

The flow uribuilder code is obscured due to the nature of subrequests but its current implementation looks like this: https://github.com/neos/flow-development-collection/blob/32055e5c966579509a3ec06a3520b246696bcdc4/Neos.Flow/Classes/Mvc/Routing/UriBuilder.php#L452:

protected function mergeArgumentsWithRequestArguments(array $arguments)
{
    // ... (sub-request stuff) ...
    if ($this->request->isMainRequest() && $this->addQueryString === true) {
        $requestArguments = $this->request->getArguments();
        foreach ($this->argumentsToBeExcludedFromQueryString as $argumentToBeExcluded) {
            unset($requestArguments[$argumentToBeExcluded]);
        }
        if ($requestArguments !== []) {
            $arguments = Arrays::arrayMergeRecursiveOverrule($requestArguments, $arguments);
        }
    }
    return $arguments;
}

That means to archive the same feature without these little helpers, one could write this in Fusion:

- root = Neos.Fusion:NodeUri {
-    addQueryString = true
-    argumentsToBeExcludedFromQueryString = ${['bar']}
- }
+ root = Neos.Fusion:NodeUri {
+    additionalParams = ${request.arguments.filter((value, key) => key != 'bar')}
+ }

Alternatively with a proper introduction of queryParameters as option for fusion that will use the new UriHelper::uriWithAdditionalQueryParameters (neos/flow-development-collection#3316) one could even use queryParameters directly instead of the to be deprecated additionalParams that leverage append exceeding arguments internally. Basically we definitely want #3914 for 9.0. (Or maybe for even back-ported for 8.x)

As it seems to be easier than assumed to offer a b/c layer in Fusion, where we still have the action request at hand, i could reimplement it for 9.0

from neos-development-collection.

mficzel avatar mficzel commented on June 20, 2024 1

This should also be removed from the flow UriBuilder

from neos-development-collection.

kitsunet avatar kitsunet commented on June 20, 2024

I would drop argumentsToBeExcludedFromQueryString for now.
We could make the queryString manipulation for addQuerystring be a part of the fusion implementation instead of passing this down? ala fusion lets the router create an Uri and then just appends a given query string (DataStructure?) to this Uri object? that would be trivial to implement and removes the feature from routing.

from neos-development-collection.

kitsunet avatar kitsunet commented on June 20, 2024

Right yeah the bool is meh it can go I guess

from neos-development-collection.

mhsdesign avatar mhsdesign commented on June 20, 2024

Actually i could imagine implementing it like:

$nodeUriBuilder->uriFor($nodeAddress, Options::create()->withAddedQueryString($actionRequest, excludedArguments: ['bar']);

its just an odd api, but would work and re enable the usecase for the LinkingService, NodeUri in Fusion & Fluid for Neos 9.0

But with the expense of carrying this thing around another time - till Neos 10. I think the additionalParams = ${request.arguments} "hack" is more than enough for people really relying on this dated feature.

from neos-development-collection.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.