Problem/Motivation
I have ~190 menu config entities and menu_ui_form_node_form_alter() calls menu_ui_form_node_form_alter() even though it actually has a fixed list of ID's and only needs those.
We also don't need them to be sorted as the order isn't actually used (maybe it should be, but it isn't).
Proposed resolution
Just do a Menu::loadMultiple($type_menus) and loop over that and use $menu->id()/$menu_label() as key/value.
$type_menus can also be empty, so we can probably already do a early return there?
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#11 | core-2998802-11.patch | 1.13 KB | Quentin Massez |
#6 | core-2998802-6.patch | 1.09 KB | Quentin Massez |
Comments
Comment #2
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commentedDo you mean menu_ui_form_node_form_alter() calls menu_ui_get_menus() ?
Comment #3
BerdirYes, that's what I mean.
Comment #4
Quentin Massez CreditAttribution: Quentin Massez at Insite commentedI'm working on it as part of Drupal Europe sprint
Comment #5
GaëlGAnd I'm mentoring Quentin :)
Comment #6
Quentin Massez CreditAttribution: Quentin Massez at Insite commentedComment #7
GaëlGComment #8
Sutharsan CreditAttribution: Sutharsan at LimoenGroen commentedI'm at DrupalEurope and going to review this patch.
Comment #9
Berdiryou no longer use $menu_names now, but the call is still there.
If we do add a @var then it should probably be on MenuInterface.
Not sure what the guidelines in core about this is now whether it should be here at all or not.
Comment #10
Sutharsan CreditAttribution: Sutharsan at LimoenGroen commented... stepping down.
Comment #11
Quentin Massez CreditAttribution: Quentin Massez as a volunteer and at Insite commentedHere's the new patch.
I did the @var on MenuInterface.
I kept it because there are others in the file and I didn't find any documentation about it.
I found a documentation but only for classes
https://www.drupal.org/docs/develop/standards/api-documentation-and-comm...
Comment #12
Quentin Massez CreditAttribution: Quentin Massez as a volunteer and at Insite commentedComment #13
tstoecklerLooks good to me, thanks!
Comment #16
catchCommitted/pushed to 8.7.x and cherry-picked to 8.6.x. Thanks!
After this, menu_ui_get_menus() is only used twice in core. We could deprecate it, and also menu_list_system_menus() which is only called by that function.
https://api.drupal.org/api/drupal/core%21modules%21menu_ui%21menu_ui.mod...
Opened a follow-up #3000242: Deprecate menu_ui_get_menus() and menu_list_system_menus().