Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
We kind of discourage people from using the Request object directly, we don't make it easy to get the value into the controllers.
Proposed resolution
Add the possibility to magically get the route match object.
Remaining tasks
User interface changes
API changes
Comment | File | Size | Author |
---|---|---|---|
#12 | interdiff.txt | 4.63 KB | dawehner |
#12 | controller_route_match-2330363-12.patch | 19.72 KB | dawehner |
#10 | controller-2330363-10.patch | 18.71 KB | dawehner |
#10 | interdiff.txt | 4.52 KB | dawehner |
Comments
Comment #1
dawehnerHere is a patch.
Comment #3
dawehnerFixed.
Comment #4
Crell CreditAttribution: Crell commentedThis is the only part being added, correct?
Also, this block should be using Drupal coding standards if it's in one of our classes.
How much of a use case does this have? The most common thing to inject is a parameter, which is already handled. The next most common would be query parameters, but I don't believe that's handled by RouteMatch, is it?
Comment #5
dawehnerYeah the next usecase is to fetch the raw unconverted values. The query parameters aren't part of the route match.
Comment #6
Crell CreditAttribution: Crell commentedHow often are we doing that? The patch doesn't show it as a common thing here.
(Sorry, just trying to avoid loading more features than we need to into something that we could very easily add post-8.0.0.)
Comment #7
dawehnermh, yeah this was primarily to scratch my own itches.
Comment #9
tim.plunkettThere are still places we use the request to get the _raw_variables, they could use this.
Bumping to critical as its part of a critical meta.
Comment #10
dawehnerBorrowed some of the changes in #2281619: Convert most direct usages within module code of routing related request attributes to use RouteMatchInterface instead
Comment #12
dawehnerFixes the failures.
Comment #13
tim.plunkettMuch nicer.
I think this is a welcome improvement. RTBC if it still passes.
Comment #15
alexpottCommitted 86922ac and pushed to 8.0.x. Thanks!
Fixed on commit