Updated: Comment #16
Problem/Motivation
At the moment we don't pass parameters from the current request to the url generator, so the API does not work really simply for many cases.
Proposed resolution
In order to implement it, we need probably need the following fixes first:
#2031487: When replacing the upcasted values in the request attributes array, retain the original raw value too
#2046737: Add a method to the AccessManager that only needs a route name and parameters
#2047619: Add a link generator service for route-based links
And is/was blocked on:
#2031353: URLgenerator broken for Drupal installed in a subdirectory - doesn't have a way to get a Drupal path
#2046661: Provide a method which renders a path to a certain route with the current request object
Solution:
Once we have a way to readily render URL from route + parameters, we need to change getPath() to a different method that returns the route and parameters and use the new rendering function.
We may want to write a replacement for theme_menu_local_task, or modify it to take the route + params.
closely related: #2048969: LocalActionBase and LocalActionInterface has to work with routes containing parameters
Remaining tasks
User interface changes
API changes
Blocking
Might be blocking getting config_translation into core. See: #2044737: Provide local tasks as plugins
Related Issues
#1984702-59: Convert menu.module's page callbacks to Controllers
#1741498-206: Add a responsive preview bar to Drupal core
#2057155: Add a generateFromRoute() method on the url generator to accept options like url()
Comment | File | Size | Author |
---|---|---|---|
#14 | local_task-2045267-14.patch | 11.41 KB | dawehner |
#14 | interdiff.txt | 1.37 KB | dawehner |
#8 | local_task-2045267-8.patch | 11.36 KB | dawehner |
Comments
Comment #1
pwolanin CreditAttribution: pwolanin commentedI think this may also be blocked on #2031353: URLgenerator broken for Drupal installed in a subdirectory - doesn't have a way to get a Drupal path at the moment.
Comment #2
dawehnerThat is blocked based upon #2046661: Provide a method which renders a path to a certain route with the current request object now. (the method we will be able to use)
Comment #3
pwolanin CreditAttribution: pwolanin commentedI'm not sure we actually need that other fix - I'd rather move away as fast as possible from using system paths to route name + params for rendering links.
Comment #4
dawehnerI kind of agree. Just linking the other issue we want to use: #2047619: Add a link generator service for route-based links
Comment #5
tim.plunkettMy interdiff in #1984702-59: Convert menu.module's page callbacks to Controllers tried to solve this with the least amount of changes.
Comment #6
jessebeach CreditAttribution: jessebeach commentedJust ran smack into this while updating local tasks to plugins for #1741498-206: Add a responsive preview bar to Drupal core.
Comment #6.0
jessebeach CreditAttribution: jessebeach commentedupdate summary to add https://drupal.org/node/2046737
Comment #6.1
pwolanin CreditAttribution: pwolanin commentedUpdated issue summary.
Comment #7
pwolanin CreditAttribution: pwolanin commentedWe'll probably need to adjust the interface a bit
Comment #7.0
pwolanin CreditAttribution: pwolanin commentedUpdated issue summary.
Comment #8
dawehnerAs suggested by peter, this adds a new method on the local task, which uses the idea of #2046661: Provide a method which renders a path to a certain route with the current request object
to dynamically pull information from the request object.
I am actually not sure what to do, when the parameter is missing. It seems to be that the local task is simply not shown.
Comment #9
dawehner#8: local_task-2045267-8.patch queued for re-testing.
Comment #11
dawehner#8: local_task-2045267-8.patch queued for re-testing.
Comment #12
dawehner#8: local_task-2045267-8.patch queued for re-testing.
Comment #13
damiankloip CreditAttribution: damiankloip commentedGets
One line? or to much chaining? :)
I like to wrap ($value == ...). I find it easier to read, but that's just preference.
Can't we also just get the _raw_variables outside of the foreach?
Good question, it seems like an exception might be a bit too strong though?
Comment #14
dawehnerGood points!
Comment #15
pwolanin CreditAttribution: pwolanin commentedI'm still wondering if there is any point until this gets in?
#2057155: Add a generateFromRoute() method on the url generator to accept options like url()
Comment #16
dawehnerFor sure! The complex part of this patch is not to call a single method on the url generator but to pull the needed properties and prepare the call.
This patch does not use $options, so why would we even have to switch to generateFromRoute?
But yes, we need to get the other one in sooner than later.
Comment #16.0
dawehnerUpdated issue summary to add 2048969
Comment #17
tim.plunkett#14: local_task-2045267-14.patch queued for re-testing.
Comment #18
dawehnerEverything got merged in in the meantime anyway: #2076283: Allow local task plugins on paths with a dynamic value (like a node)
Comment #18.0
dawehneradded template and issues mentioned and note about config_translation