Problem/Motivation
Currently, routing documentation is still in menu.api.php along with the menu documentation. Problem is, we spent a whole lot of time separating the menu and routing systems! Routing should stand alone.
Proposed resolution
Create a core/lib/Drupal/Core/Routing/routing.api.php file and move all of the routing related docs from menu.api.php to there. Then change the @group definitions if necessary.
Remaining tasks
Do it.
User interface changes
None.
API changes
None.
Data model changes
None.
Beta phase evaluation
| Issue category | Task because nothing is technically broken, just badly organized |
|---|---|
| Unfrozen changes | Unfrozen because it only changes documentation |
| Disruption | No disruption for existing module |
| Comment | File | Size | Author |
|---|---|---|---|
| #37 | split_routing-2547707-36-without-dblog.patch | 16.45 KB | jhodgdon |
| #36 | split_routing-2547707-36.patch | 16.86 KB | kekkis |
| #36 | interdiff-2547707-31-36.txt | 1.34 KB | kekkis |
| #21 | interdiff.txt | 1.5 KB | latikas |
Comments
Comment #2
Crell commentedActually it probably belongs over here...
Comment #3
jhodgdonIt would probably be best if we don't change the @defgroup machine names of the topics, but other than that I have no objection. Also, a number of the .api.php files got moved into appropriate sections of core/lib, so rather than putting this one in core/modules/system, we might consider moving it elsewhere (routing really isn't part of the system module).
Comment #4
Crell commentedI hadn't even noticed those were legal in lib now. Good call.
I think this is Novice-friendly, too.
Comment #5
screon commentedHi,
I was looking for an easy issue that I could help with, so I decided to give it a try.
So here is my first attempt to a patch... I was kinda clueless about what to move and what not, so I could be totally wrong.
Comment #6
joshi.rohit100Comment #8
HeimdallJHM commentedYou took lines only to put them back
same here
Comment #9
screon commentedOh ok, let me try again:
Comment #10
HeimdallJHM commentedComment #12
jhodgdonThanks for the patch(es)!
First off... It appears that something about the way you made the patch is wrong. The routing.api.php file is new, but it's showing up in the patch as being a patch of an existing file (which doesn't exist, hence the "Patch does not apply" error in the test). So, that needs to be fixed so that we can apply the patch.
That aside... looking at the patch, the contents need a bit of attention too, but it's pretty close:
We'll need to change this line so that it doesn't mention "route page requests". Maybe something like:
Define navigation menus, local actions, local tasks, and contextual links.
I don't think we can just leave this paragraph out entirely, because the next paragraph starts with "The menu system uses routes" and doesn't tell what routes are.
Actually, I think we can fix it by adding a link in that next paragraph to the Routing API topic. So it can say something like "The menu system uses routes; see the @link routing Routing API topic @endlink for more information". (where "routing" is the machine name of the new routing topic; see below...)
This section is part of the Menu system, not Routing, so it should stay in menu.api.php
This section is part of the Menu system, not Routing, so it should stay in menu.api.php
This section is part of the Menu system, not Routing, so it should stay in menu.api.php
This section is part of the Menu system, not Routing, so it should stay in menu.api.php
The title of this new topic shouldn't say "Menu". Probably it should be "Routing API".
Also, since it is a new @defgroup topic, it needs a new machine name identifier (not "menu"). Probably "routing" would be good.
See
https://www.drupal.org/node/1354#defgroup
for more about @defgroup if this is confusing.
That needs to be split into two links -- one about Menus to the topic "menu", and one about Routing to the new topic machine name, whatever it is (probably "routing", see item above).
This also needs to not mention menus.
The topic should stop here -- as noted above, the rest of the sections should stay in the Menu topic and not move to the new Routing topic.
Thanks!
Comment #13
hussainwebThanks @screon, @jhodgdon. This addresses all comments in #12.
Comment #14
Crell commentedyay!
Comment #15
screon commentedGreat!
Yeah I don't know what I did wrong with the patch...Anyways, glad I could be of some help :)
Comment #16
hussainweb@screon: Thanks for getting this started. I am not sure what you might have done but I can try guessing. It seems that you added the new routing.api.php file to index and then added all it's contents. You took a normal diff (
git diff) after that. Since the file was already indexed, the patch shows that the file was modified rather than being created. This especially happens if you are using an IDE. I know PHPStorm immediately prompts you to add a file to git index as soon as you create it.This may or may not be what happened in your case but the symptoms indicate so. I hope this helps.
Comment #17
screon commentedYup, sounds like that is exactly what happened. I normally don't allow PHPStorm to add new files to git when I get the prompt, but I guess I accidentally added the file anyways.
Thanks for your help!
Comment #18
jhodgdonThanks -- this is a pretty good patch, but it actually needs a few small fixes:
Page controllers are part of Routing, not Menu
Should not be a , here
This line goes over 80 characters. Shouldn't.
Note that you need to keep @link ... @endlink on one line together, so you'll have to move the whole thing down to the next line, and then rewrap the rest of the paragraph.
"it" needs to be "It".
Comment #19
jhodgdonOh, one other thing I thought of.
On the current "menu" topic page:
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Menu!menu.api.php...
There is a list at the bottom of functions and classes that have @ingroup menu in them.
At least one of them needs to be changed to "@ingroup routing" now (the class ControllerBase). I don't see anything else that needs to be changed there, I guess...
Comment #20
jhodgdonActually it would be nice if, as a bonus, any non-vendor classes mentioned in the Routing topic had
@ingroup routing
added to their class doc headers... could be slightly out of scope for this issue but I think it would only add about 1-5 lines to the patch.
Comment #21
latikas commentedRe-rolled patch according to #18
Comment #22
jhodgdonThanks for the new patch! However, it's still not ready to go:
Um. This is not right. We've lost the link to the menu topic, and instead have two links to the routing topic.
@link ... @endlink all needs to stay on one line. So start @link on the next line.
Comment #23
deepakaryan1988Comment #24
deepakaryan1988Addressed #22 .
Comment #25
jhodgdonThanks!
But... this patch doesn't look good at all actually. We lost routing.api.php entirely, and #19 and #20 are still not addressed.
Also:
This is still not right.
We need:
a) One entry with @link routing
b) One entry with @link menu
c) Both of them to have good link titles.
Right now we have two lines for routing and one for menu, and the menu one doesn't have a good link title. See
https://www.drupal.org/node/1354#link
for syntax if confused.
Comment #26
teemuaro commentedComment #27
teemuaro commentedAs part of Drupal Camp Baltics I created a patch on issues mentioned on comment #22. Hopefully this moves to right direction, this is my first time creating core patches :)
Comment #28
kekkisAdded interdiff for @teemuaro's patch against the one it's done according to its headers.
Comment #29
kekkisThe interdiff in #28 reveals that the patch in #27 is a good starting point. It just needs additions: namely the changes requested by @jhodgdon in #19 and #20.
Comment #30
kekkisI'll try to work on #19 and #20 as noted in the comment above.
Comment #31
kekkisOnly adding patch fixing comment #19 now. Comment #20 includes a mention "non-vendor classes" that I'm not sure how to interpret, so this is gonna be left pending the answer by @jhodgdon (I tried calling after her on #drupal-docs in IRC but she wasn't around at the time).
Comment #32
jhodgdonGreat, we're almost there!
So. "non-vendor classes" means "don't include classes in core/vendor" -- we only want to add "@ingroup routing" to classes that belong to us (things in core/vendor come from outside projects and we don't want to edit their documentation blocks). So, setting this back to Needs Work for #20.
I also took a look at the current patch. It looks good! One minor thing to update:
Can we give this a longer link title, maybe:
Menu entries, local tasks, and other links
Comment #33
Crell commentedjhodgdon: Well, there's dozens of classes in the Drupal\Core\Routing namespace and its children. Tagging all of those as @ingroup routing is not hard, but it's definitely more than 1-5 lines. There's also the question of which of those really should be tagged, as many of them are fairly internal. Since that has the potential for lots of subjective discussion I'd prefer to punt that to another issue and keep this one focused on the clear task of just splitting the doc topics.
Comment #34
jhodgdon@Crell - I do NOT think we should tag all of those @ingroup. If you look at comment #20, it suggests that any class *mentioned in the @defgroup docs* should be tagged.
Comment #35
kekkisTaking another look into the ingroup additions!
Comment #36
kekkisNew try at addressing #20. I seem only to have found 2 mentions of non-vendor "classes", one of which is an array and the other being used as an example of a BaseController extension.
Also took care of #32.
Comment #37
jhodgdonClasses/interfaces that I see in the routing topic that I think should have @ingroup routing in them:
\Drupal\Core\Controller\ControllerBase
\Drupal\Core\Routing\RouteMatchInterface
Even though the dblog class is mentioned as an example, I don't really think it should have @ingroup routing. Part of the reason is that people tend to copy/paste existing classes when they create new controllers, and we really don't need to have additional examples listed.
So can we get @ingroup routing added to those two classes, and removed from the dblog class? Thanks! The rest looks good to me.
Oh, I guess it is already in RouteMatchInterface. And ControllerBase. So let's just remove dblog... OK I can do that quickly by just dropping that section out of the patch file, and then set it to RTBC. Thanks!!!!
Comment #40
hussainwebThis seems like the failure affecting several issues right now. Retesting and tentatively marking RTBC as per #37.
Comment #43
jhodgdonWhat is with all the random test failures lately???
Comment #46
hussainwebRandom failure again. :)
Comment #47
webchickCommitted and pushed to 8.0.x. Thanks!