As part of #2299715: [meta] Move core hooks from system.api.php to core.api.php or other files, we need to move all the menu-related hooks out of the core/modules/system/system.api.php file.
Since there are a lot of them, I think they should go into their own menu.api.php file.
So the task here is:
a) Create a new file in core/modules/system called menu.api.php
b) At the top of the file, add a @file doc block. Use the one in core/modules/system/file.api.php as a model.
c) Then after that we need the @addtogroup hooks doc block, and at the bottom we need the "End of addtogroup" doc block.
d) In between, cut and paste the following hooks that are currently in system.api.php to this new file:
hook_menu_links_discovered_alter()
hook_menu_local_tasks()
hook_menu_local_tasks_alter()
hook_menu_local_actions_alter()
hook_local_tasks_alter()
hook_contextual_links_alter()
hook_contextual_links_plugins_alter()
hook_system_breadcrumb_alter()
e) I also think we should take the "@defgroup menu" doc block that is currently at the top of core/includes/menu.inc and move it into this file. It should go between the @file doc block and the @addtogroup doc block, near the top of the file. That way the topic and all the related hooks will be in one file.
| Comment | File | Size | Author |
|---|---|---|---|
| #25 | drupal-menu-api-2407933-22.patch | 47.23 KB | sidharrell |
| #22 | drupal-menu-api-2407933-21.patch | 47.1 KB | sidharrell |
| #20 | drupal-menu-api-2407933-20.patch | 9.35 KB | adci_contributor |
| #19 | interdiff-17-19.txt | 14.05 KB | adci_contributor |
| #17 | drupal-menu-api-2407933-17.patch | 19.06 KB | adci_contributor |
Comments
Comment #1
arpit_nnd commentedComment #2
arpit_nnd commentedMoved all the listed hooks:
hook_menu_links_discovered_alter()
hook_menu_local_tasks()
hook_menu_local_tasks_alter()
hook_menu_local_actions_alter()
hook_local_tasks_alter()
hook_contextual_links_alter()
hook_contextual_links_plugins_alter()
hook_system_breadcrumb_alter()
and the topic related to menu from:
to a new file: "core/modules/system called menu.api.php" .
Comment #3
sinniger commentedRemoved whitespace
Comment #8
romina.nayak commentedRemoved white spaces.
Comment #9
chakrapani commentedThere are still couple of white spaces in line 332 and line 347.
And also please provide a interdiff while re-rolling a patch.
Regards,
Chakrapani
Comment #10
romina.nayak commentedSpaces removed & interdiff added.
Comment #11
romina.nayak commentedSpaces removed & interdiff added.
Comment #13
romina.nayak commentedI am sorry I am somewhat new to patching. Above instructions incorporated!
Comment #15
romina.nayak commentedSpaces removed & interdiff added.
Comment #17
adci_contributor commentedJust fixed the corrupted line in patch from #15
Comment #18
jhodgdonPLEASE on this issue do NOT reroll patches. You need to go back to system.api.php and copy/paste the CURRENT hooks and their documentation to the new file.
So can someone please start over from scratch? The problem is that if you just do a "reroll" in a generic way you will miss copying over anything that has changed in the original file.
Comment #19
adci_contributor commentedI'm trying to start over from scratch. Copy/paste hooks from system.api.php in according to #18.
In this patch i'm skipped item e) from issue summary. Please, tell me if it need to do too.
Comment #20
adci_contributor commentedI'm sorry about the 0 bytes patch. Please ignore #19.
Comment #21
jhodgdonYes, please do everything that is in the issue summary. Thanks!
Comment #22
sidharrell commentedFirst patch, so don't laugh.
Comment #23
sidharrell commentedsee, I said don't laugh
Comment #24
jhodgdonThanks for the new patch! I'm not laughing -- even people who have made hundreds of patches occasionally forget to set the status to "needs review" when they upload a patch. ;}
So... I guess there are a few more things that need to be done.
a) There is an error in menu.inc: that separate doc block:
That needs to be combined with the main @defgroup block in the new file -- take out the */, following blank line, and the /**.
b) We need to add an @addtogroup block to menu.inc (and an "end" block at the end of the file), so that the functions in there still are displayed on the topic page. See
https://www.drupal.org/node/1354#defgroup
c) In menu.api.php, end the @defgroup menu block with
* @}.d) Make sure that all the hooks moved into menu.api.php have @ingroup menu in their doc block (near the end).
Comment #25
sidharrell commentedfor (c), there was an enddef block at the end of the file, but I took that out and did (d), per instructions. That has the same effect, yes?
for (a), your diff above has a minus in front of the @section line, but your instructions said just those 3 lines, not the @section line, so I left it in. Also, I noticed that it differed slightly from the @section lines above and below it, in that it those had a machine name for the section (?), I'm just guessing now.
* @section sec_controller Route controllers for simple routesSo I changed the rendering section line to:
* @section sec_rendering Rendering menusComment #26
sidharrell commentedComment #28
jhodgdonExcellent! You did exactly the right things. Thanks for reading my mind. ;}
The only very very minor thing now is a couple of extra blank lines in the new menu.api.php between hook_contextual_links_plugins_alter() and the next hook, but that is not a big deal. I fixed it on commit.
Beta note: This is just documentation and is unfrozen.
Committed to 8.0.x before Core changes again. Thanks!