Problem/Motivation
The setting 'override children' on the individual menu link page should show/hide based on the admin config setting 'Allow parents to override children'
The form alter hook is simply named wrong.
Steps to reproduce
Disable 'Allow parents to override children' and the setting is still visible on the menu item page.
Proposed resolution
Fix the form alter hook
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | Screenshot 2024-08-12 at 11.25.12.png | 12.64 KB | littlepixiez |
| #2 | menu_item_role_access-3465576-2.patch | 753 bytes | ocastle |
Issue fork menu_item_role_access-3465576
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
ocastle commentedComment #3
littlepixiez commentedHi @ocastle. Could I just ask for the scenario that this is happening for you? On dev-2.x the form ID for me is correct for the form it is altering: "menu_link_content_menu_link_content_form".
Curious if I'm just missing something here! Thank you.
Comment #4
ocastle commentedHi @littlepixiez, For me, I get dynamic form ids based on the current menu.
e.g. "menu_link_content_main_form" for main menu
or "menu_link_content_account_form" for the account menu.
Changing the hook to use "menu_item_role_access_form_menu_link_content_form_alter" uses the base form id and resolves the issue for me.
In your testing does toggling the admin setting "Allow parents to override children" here: /admin/config/menu-item-role-access show/hide the 'Override children" setting on all the menus for you?
Comment #5
littlepixiez commentedHi @ocastle. Ahh, I just found a similar issue here: https://www.drupal.org/project/menu_item_extras/issues/3043305
It looks like Menu Item Extras changes the form IDs - are you using this module? Menu Token have done a similar approach and changed the hook to the base ID: https://www.drupal.org/project/menu_token/issues/3113646
I'm happy your patch works and fixes it not working with Menu Item Extras installed also! Thanks very much. :)
Comment #6
ocastle commentedYes, it just occurred to me that menu item extras might be doing something as we do have that installed as well.
Glad it’s working!
Comment #9
littlepixiez commentedThanks for your contribution @ocastle!
Comment #10
liampower commented