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.
Working on contrib Tour UI running into #2051097: Change "pattern" to "path" in *.routing.yml files I checked for the pattern used by the routing files.
$ find . -name "*.routing.yml" -exec cat {} \; | grep ' path' | cut -c -10 | sort -u
path: "/
path: '/
path: 'a
path: 'c
path: 'm
path: 't
path: 'u
path: aj
path: bl
So we use different quotes or no quote and either use a starting '/' or not.
What should it be?
no quoting
$ find . -name "*.routing.yml" -exec grep -l " path\: [^\'\"]" {} \;
./modules/block/custom_block/custom_block.routing.yml
./modules/system/tests/modules/ajax_test/ajax_test.routing.yml
Double quote
$ find . -name "*.routing.yml" -exec grep -l ' path: "' {} \;
./modules/system/tests/modules/test_page_test/test_page_test.routing.yml
No starting /
Using
$ find . -name "*.routing.yml" -exec grep " path: '" {} \; | cut -c -10 | sort -u
then
$ find . -name "*.routing.yml" -exec grep " path: '[abmtu]" {} \;
path: 'admin/config/system/actions/configure/{action}/delete'
path: 'admin/structure/config_test/add'
path: 'admin/structure/config_test/manage/{config_test}'
path: 'admin/structure/config_test/manage/{config_test}/enable'
path: 'admin/structure/config_test/manage/{config_test}/disable'
path: 'admin/structure/config_test/manage/{config_test}/delete'
path: 'admin/structure/contact/manage/{contact_category}/delete'
path: 'admin/config/regional/content_translation/translatable/{entity_type}/{field_name}'
path: 'admin/reports/event/{event_id}'
path: 'admin/reports/fields'
path: 'admin/help'
path: 'admin/help/{name}'
path: 'admin/config/media/image-styles/manage/{image_style}/delete'
path: 'admin/config/media/image-styles/manage/{image_style}/effects/{image_effect}/delete'
path: 'admin/config/regional/language/detection/browser/delete/{browser_langcode}'
path: 'admin/structure/menu/item/{menu_link}/reset'
path: 'admin/structure/menu/item/{menu_link}/delete'
path: 'admin/structure/menu/manage/{menu}/delete'
path: 'admin/config/search/path/delete/{pid}'
path: 'user/{user}/shortcuts'
path: 'admin/config/regional/date-time/formats/manage/{date_format}/delete'
path: 'admin/config/regional/date-time/locale/{langcode}/reset'
path: 'admin/modules'
path: 'admin/modules/list/confirm'
path: 'admin/index'
path: 'admin/modules/uninstall'
path: 'admin/modules/uninstall/confirm'
path: 'menu_callback_description'
path: 'url-alter-test/foo'
path: 'admin/structure/taxonomy/manage/{taxonomy_vocabulary}'
path: 'tour-test-1'
path: 'tour-test-1/action'
path: 'tour-test-2/subpath'
Comment | File | Size | Author |
---|---|---|---|
#29 | drupal8.routing-system.2095121-29.patch | 18.01 KB | jibran |
#27 | drupal8.forms-system.2071115-1.patch | 6.25 KB | jibran |
#23 | drupal8.routing-system.2095121-23.patch | 16.89 KB | clemens.tolboom |
#19 | drupal8.routing-system.2095121-19.patch | 16.81 KB | clemens.tolboom |
#18 | drupal8.routing-system.2095121-17.patch | 0 bytes | clemens.tolboom |
Comments
Comment #1
clemens.tolboomComment #2
jibranFair enough. Thanks @clemens.tolboom
Comment #3
joachim CreditAttribution: joachim commentedThe docs state that the initial '/' is needed, but if in fact we can dispense with it, we definitely should standardize on not using it.
D7 doesn't use an initial '/ in hook_menu(), so it would be one less change to learn for developers transitioning from D7.
Comment #4
clemens.tolboom@joachim what docs?
I was about to say the l() requires a start '/' (as I thought in the past) but there is only one left in core.
It would be great to have both hook_menu() and the routing inline.
Comment #5
joachim CreditAttribution: joachim commentedThe change record here https://drupal.org/node/1800686 says:
Examples module, presumably based on this, says this as well.
Comment #6
joachim CreditAttribution: joachim commentedSorry, didn't mean to remove the tag.
Though should we file a separate issue for the initial slash thing, as that probably isn't a quick fix -- we'd need input from routing system developers to know whether it's expected behaviour or a glitch that it works without the '/', and then docs would need updating etc etc.
Comment #8
clemens.tolboomAttached patch has the initial '/' removed.
Comment #9
clemens.tolboomI cannot reproduce on local the failures from #1
So let's see what #8 does.
Comment #10
joachim CreditAttribution: joachim commentedOops.
Comment #11
clemens.tolboomA side note about the 'page not found' logic display path including '/' like
Comment #12
tim.plunkettThis is o
This is wrong, AFAIK. We need to *add* all of the slashes, not remove them.
Comment #13
clemens.tolboom@tim.plunkett then we can use #1.
Here is a reroll to make testbot happy again.
Comment #14
clemens.tolboomNo need to be assigned.
Comment #15
jibranAfter applying the patch and runnig this
I still have some routes using
"
can we fix also fix these.IMHO it is not a bug it is simply a task.
Comment #16
joachim CreditAttribution: joachim commented> This is wrong, AFAIK. We need to *add* all of the slashes, not remove them.
But they work without slashes, don't they? Is that unexpected behaviour?
If it works either way, why not standardize on the form that we used in D7?
Comment #17
longwaveI keep mis-parsing the title of this issue :)
Comment #18
clemens.tolboomNot sure what went wrong :-/
Comment #19
clemens.tolboom(sigh)
Comment #20
jibranRTBC if green
Comment #21
tim.plunkett+1
Comment #22
alexpottPatch no longer applies.
Comment #23
clemens.tolboomPseudo diff between #19
Comment #24
jibranBack to RTBC.
Comment #25
mcrittenden CreditAttribution: mcrittenden commentedTags
Comment #26
webchickSorry, once again no longer applies. :(
Comment #27
jibranYay!!
Comment #28
clemens.tolboomThis doesn't look like the correct patch.
Comment #29
jibranarghh
Comment #30
clemens.tolboomAssuming the testbot does not fail this is RTBC
Comment #31
webchickCommitting it while it's hot!
Committed and pushed to 8.x. Thanks!
Comment #32.0
(not verified) CreditAttribution: commentedfind command finds double quotes.
Comment #33
chintukarthi CreditAttribution: chintukarthi commentedHi, I am having a path as below,
path : /drupal/add/new?row=1
Where the number is dynamic.
like,
path : /drupal/add/new?row=2,
path : /drupal/add/new?row=3, etc,
I need to give this in routing file. How to give this one?
I tried as below,
path: /drupal/add/new?row={id},
but it isn't woking. Any ideas?
Thanks.