Updated: Comment #N
Problem/Motivation
menu.inc still contains menu_link-specific code.
Proposed resolution
Move it to menu_link.module
Remaining tasks
Decide if more of the menu tree functions should move as well.
User interface changes
N/A
API changes
menu_load_links() and menu_delete_links() were renamed to menu_link_load_links_by_menu() and menu_link_delete_links_by_menu()
Original report by @pwolanin
Follow-up from #2047633: Move definition of menu links to hook_menu_link_defaults(), decouple key name from path, and make 'parent' explicit.
The code in menu.inc already has a check as to whether the menu_link module is enabled. It would be logically better to simply move all the code for finding/saving/resetting default menu links to this module and out of menu.inc.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | menu_link-2178697-4.patch | 23.08 KB | tim.plunkett |
Comments
Comment #1
pwolanin commentedComment #2
xjmI'm assuming this would involve API changes as the functions were renamed to the
menu_linknamespace? Can we document the list of any API changes here in the summary and make sure to get a maintainer's +1? Presumably it should be pretty straightforward. Thanks!Comment #3
tim.plunkettSadly enough, these are in menu.inc still:
menu_link_get_preferred()
menu_link_get_defaults()
menu_link_rebuild_defaults()
So they don't need renaming :)
Not sure what else we'd want to move.
Comment #4
tim.plunkettOkay, since the menu_router patch went in, I took a look at this.
I moved the 3 functions I mentioned already, which doesn't actually affect anything since menu_link is required.
The other two that were specifically about menu links were menu_load_links() and menu_delete_links(), which I renamed to menu_link_load_links_by_menu() and menu_link_delete_links_by_menu(), since that's what they do.
Comment #5
tim.plunkettComment #6
dawehnerLet's not get crazy with more changes, given that this just would need more time.
Comment #7
dawehner#2207893: Convert menu tree building to a service. works on moving many other bits to menu_link.
Comment #8
xjmCreated draft change record:
https://drupal.org/node/2208411
I also checked and found no references to
menu_load_links()ormenu_delete_links()in existing change records.Comment #9
catchhttps://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21EventSubs...
This calls menu_link_rebuild_defaults() and others. It's slightly worse calling a function in module than one in /includes.
Feels like menu_link module should have its own subscriber that calls its own methods.
Comment #10
pwolanin commentedLet's postpone (and possible close) this issue until we resolve: #2256521: [META] New plan, Phase 2: Implement menu links as plugins, including static admin links and views, and custom links with menu_link_content entity, all managed via menu_ui module
Comment #11
mgiffordThat's issue's in #2256521: [META] New plan, Phase 2: Implement menu links as plugins, including static admin links and views, and custom links with menu_link_content entity, all managed via menu_ui module
Comment #14
pwolanin commentedI think this is outdated or already fixed by the menu link API changes