menu_hide_parent
No security coverage
Menu Hide Parent automatically hides placeholder parent menu items (such as those using or routes) when they have no visible child links after access checks.
This ensures that top-level items like Create, Manager, or Settings do not appear in navigation menus when users don’t have permission to access any of their sub-items — keeping menus clean, contextual, and role-aware.
Features
- Automatically hides parent menu items using or targets when they have no accessible children.
- Respects role-based and permission-based access controls.
- Cache-safe, runs only on menu tree rebuilds, not every page load.
- Per-menu enable/disable configuration via the admin UI.
Configuration
- Go to Configuration → User Interface → Menu Hide Parent (/admin/config/user-interface/menu-hide-parent).
- Check the menus where you want to hide empty placeholder parent items.
- Save configuration.
- (Optional) Grant the Administer Menu Hide Parent settings permission to trusted site builders.
Use Cases
- Hiding “Create” or “Manager” menu headers when users can’t create or manage any content types.
- Preventing empty parent items from cluttering navigation for restricted roles.
Technical Notes
- Implements hook_menu_tree_alter() to prune menu trees at render build time.
- Adds user.roles as a cache context for per-role variants.
- Fully compatible with cached menu rendering and configuration-managed menus.