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
There was an incorrect change made in #2294157: Switch getOptions() and getRouteParameters() within LocalActionInterface and LocalTaskInterface to use RouteMatch, and now LocalTaskDefault and LocalActionDefault no longer check the actual parameters.
They currently check the raw parameters twice :)
Proposed resolution
Change it
Refactor to remove usage of RouteProvider? Maybe out of scope, but it's how I found the bug.
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#14 | 2912363-local-tasks-14.patch | 6.44 KB | tim.plunkett |
#14 | 2912363-local-tasks-14-interdiff.txt | 2.15 KB | tim.plunkett |
#13 | 2912363-local-tasks-12.patch | 6.36 KB | tim.plunkett |
#13 | 2912363-local-tasks-12-interdiff.txt | 4.74 KB | tim.plunkett |
#7 | 2912363-local-tasks-7.patch | 5.28 KB | tim.plunkett |
Comments
Comment #2
tim.plunkettComment #5
tim.plunkettRemoving less code keeps the tests passing
Comment #7
tim.plunkettI misunderstood this code completely, whoops!
The RouteMatch passed in is the current route match, not one corresponding to the route being processed.
Without changing the APIs, we can't resolve this confusion. Just fixing the bug now, all other out-of-scope changes should be gone.
Comment #9
tim.plunkettComment #12
pwolanin CreditAttribution: pwolanin as a volunteer and at SciShield commentedOverall looks like a good fix, but a few small fixes would make this great.
Let's rename the variables in the method something like:
Also it would be really helpful to have a code comment explaining when and how it's possible to have a parameter (the upcast value) that's not present in the raw parameters. Tim Plunkett helpfully explained in person that the parameter (variable/slug name) could be in the route defaults and empty, or could be an optional (trailing) slug in the path and in either case the value was populated by a route enhancer.
Comment #13
tim.plunkettIt makes the patch much less clear, but the resulting code benefits greatly! Thanks for the suggestion
Comment #14
tim.plunkettAfter further in-person discussion, I improved the docs.
Also to prevent any future accidental divergence in these two, I opened #2995138: Refactor duplicate code from LocalActionDefault/LocalTaskDefault and their interfaces into a shared trait/interface
Comment #15
pwolanin CreditAttribution: pwolanin as a volunteer and at SciShield commentedLooks great, thanks for adding to the code comments and creating the refactor issue.
Since this breaks layouts, making major.
Comment #16
tim.plunkett#2988970: Layout Builder should make it easier to modify the default layout for an entity type when viewing an entity is the layout issue that is soft-blocked by this issue (we have a hacky workaround for now).
Comment #17
alexpottCommitted and pushed a4cedd8c75 to 8.7.x and b53b0daabd to 8.6.x. Thanks!
As a bug fix backported to 8.6.x.
Looks like we need to update the code in the comments too. Fixed on commit.