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
What is the way to provide query parameters or other route options for entries in links.menu.yml?
my_module.csv_export:
title: 'CSV Export'
enabled: 1
route_name: view.csv_export.rest_export_1
options:
query:
'_format': csv
Proposed resolution
Document in menu.api.php, specificaly section on @section sec_links
how to add options such as query strings.
Remaining tasks
Write a patch.
User interface changes
n/a
API changes
n/a
Data model changes
n/a
Comment | File | Size | Author |
---|---|---|---|
#29 | interdiff-19-29.txt | 774 bytes | msankhala |
#29 | document-route-option-menu-link-2998772-29.patch | 978 bytes | msankhala |
#19 | interdiff-7-19.txt | 809 bytes | msankhala |
#19 | document-route-option-menu-link-2998772-19.patch | 975 bytes | msankhala |
#7 | enhance_documentation-2998772-7.patch | 866 bytes | hazong |
Comments
Comment #2
heddnUpdated IS. I was missing a query parameter. After I added that, it worked. Looks like this is now a novice task to document in menu.api.php how to pass things beside just route_parameters.
Comment #3
heddnComment #4
heddnSomething like this would work, along with an explanation of how to add options.
Comment #5
dpacassiComment #6
hazong CreditAttribution: hazong as a volunteer commentedThanks for the proposal, I'm working on it!
Comment #7
hazong CreditAttribution: hazong as a volunteer commentedAttached is the patch with the proposed solution.
Comment #8
hazong CreditAttribution: hazong as a volunteer commentedComment #9
heddnGreat. We have both things needed for these docs updates. A good example, plus some explanatory text of the example.
Comment #11
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commentedTestbot hickup. moving back to RTBC.
Comment #12
Wim LeersThanks for this! Refined issue metadata, otherwise committers may not look at this.
Comment #13
hazong CreditAttribution: hazong commentedSo means, I have to look at it again?
Comment #14
heddnre #13: no, its that committers don't look at support requests. So moving this to a task is a good idea for this to get committed. No more work now it is in the right queue.
Comment #15
Wim LeersYep! Thanks again, @hazong!
Comment #16
alexpottsuch as e.g
seems to be repeating itself. We only needsuch as
. It would be nice to link off to somewhere that describes the full scope of what can go in here.Comment #17
hazong CreditAttribution: hazong commentedComment #18
heddnI think linking to the url parameter docs would be appropriate.
Comment #19
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commentedHere is the updated patch.
Comment #20
heddnThis doesn't really talk about URL parameters to a link. Just how to define a route. Perhaps https://www.drupal.org/docs/8/api/routing-system/routing-related-objects... is more better?
Comment #21
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commentedThis also does not explicitly explains about query parameter neither does Add a menu link doc. I think we can add query option in Add a menu link doc and link it here. Thought?
Comment #22
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commentedAny thoughts?
Comment #23
heddnYeah, I like https://www.drupal.org/docs/8/creating-custom-modules/add-a-menu-link
Comment #24
kalyansamanta CreditAttribution: kalyansamanta commentedParameter converters are services so you should add an entry to your example.services.yml for your custom ParamConverter:
services:
example.param_converter:
class: Drupal\example\Routing\ParamConverter
tags:
- { name: paramconverter }
Comment #25
Pasqualleone more doc page about links.menu.yml, but no mention of the query parameter..
https://www.drupal.org/docs/8/api/menu-api/providing-module-defined-menu...
Comment #26
volkswagenchickTagging for upcoming contribution days.
Comment #27
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commentedComment #28
volkswagenchickComment #29
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commentedThanks @Pasqualle for providing the link to correct doc. Here is the updated patch.
Comment #30
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commentedComment #31
heddnI think this looks good now. All feedback is addressed and the link points to a generally useful docs page.
Comment #33
heddnComment #35
Mixologicdispatcher/testbot issue. back to rtbc
Comment #37
larowlanUpdating issue credits
Comment #40
larowlanCommitted 16afb5c and pushed to 8.8.x. Thanks!
c/p as eb0b595e62 to 8.7.x