Inspired by #1981368: Convert all routes to 'module_name.foo_bar' naming convention.
Updated: Comment #0
Problem/Motivation
Our plugin IDs local_tasks.yml were using _ as a separator. This does not match the new convention decided for routing.yml in #1981368: Convert all routes to 'module_name.foo_bar' naming convention
To be less confusing, use the same convention for local_tasks.yml files.
Proposed resolution
The proposed local_tasks.yml standard is
module_name.sub_name
where sub_name uses lower-case and underscores only.
However, the plugin ID is an arbitrary string so the important element of the standard is using the leading "module_name." to avoid collisions of IDs provided by different modules. The doc page at https://drupal.org/node/2122253 notes that developers may append ".tab" or ".task" if it helps them to remember that the plugin ID is not actually the same as the route name.
Remaining tasks
1. Agree upon the convention.
2. (done) Document the convention as a coding standard. (optimistically done in https://drupal.org/node/2044515/revisions/view/2847981/2850471 since there was no standard for the plugin ID documented there before now.)
3. Patch core to agree with this convention. (there are only 4 local_tasks.yml files, comments, 2 menu_ui tests, views_ui. views_ui is already using this standard)
User interface changes
None.
API changes
?? (update this) Route machine names would change, so if anyone already has alter hooks or any code that depends on specific machine names, that code would break.
Related Issues
Comment | File | Size | Author |
---|---|---|---|
#9 | local-task-routing-convention-2095613-3-9.interdiff.txt | 742 bytes | grisendo |
#9 | local-task-routing-convention-2095613-9.patch | 7.71 KB | grisendo |
#3 | local-task-routing-convention-2095613-3.patch | 7.81 KB | g.oechsler |
#3 | interdiff.txt | 1.94 KB | g.oechsler |
#1 | local-task-routing-convention-2095613-1.patch | 5.88 KB | juanolalla |
Comments
Comment #1
juanolalla CreditAttribution: juanolalla commentedHere is a patch with the conversion.
Comment #3
g.oechsler CreditAttribution: g.oechsler commentedFixed to tests. The tests in Menu/LocalTasksTest are now using the changed plugin IDs.
Comment #4
g.oechsler CreditAttribution: g.oechsler commentedgna
Comment #5
juanolalla CreditAttribution: juanolalla commentedThank you g.oechsler! I didn't have time yesterday to fix it.
Comment #6
juanolalla CreditAttribution: juanolalla commentedSorry, I changed it to need works without knowing it, while you where commenting at the same time.
Comment #7
YesCT CreditAttribution: YesCT commentedack. this is also changing route names. not just plugin ids.
this is confusing other issues also.
See #2095271: Add default tabs for routes expected by config_translation.
We need another issue to fix route names and take those changes out of this issue.
In the new issue for route names, we need to take out the alter so that it even pays attention to that comment.local_tasks.yml file.
Comment #8
grisendo CreditAttribution: grisendo commentedI take it!
Comment #9
grisendo CreditAttribution: grisendo commentedRemoved lines from route_name lines
Comment #10
pwolanin CreditAttribution: pwolanin commentedFYI, will conflict with #2095117: Menu system should provide a default tab if none exists
Comment #12
grisendo CreditAttribution: grisendo commented#9: local-task-routing-convention-2095613-9.patch queued for re-testing.
Comment #13
grisendo CreditAttribution: grisendo commentedRe-testing because of http://drupalcode.org/project/drupal.git/commitdiff/4bdcb12bf93362242d96...
Comment #14
YesCT CreditAttribution: YesCT commentedrelated to #9: #2100213: take local tasks out of hook_menu so it uses comment.local_tasks.yml with the recommended route naming conventions should help
Comment #15
YesCT CreditAttribution: YesCT commentedlooks like we are within scope now.
Comment #16
webchickNice job. :)
Committed and pushed to 8.x. Thanks!
Comment #18
pwolanin CreditAttribution: pwolanin commentedupdated the summary to reference https://drupal.org/node/2122253 and mention that developers may want to append e.g. '.task to the plugin IDs if it helps them keep straight how the different strings are used.
Comment #19
pwolanin CreditAttribution: pwolanin commented