Menu Manager with Multiple Menus

Foxtrek_64

Active member
Currently, the Menu Manager (ACP -> Setup -> Public Navigation) allows us to manage the main navigation menu. But, there are many other menus on the site that are not so easily customizable, requiring template modifications that need to be tracked and updated.

I would like to see an overhauled menu manager that let's admins and addons create custom menus. Built in menus could be listed separately so they always exist or selectors could be added to denote a main menu, user menu, or footer menu.

Menu categories could be useful for organization within the ACP. For example, the user menu could have its own category and three menus could be added underneath: one starting with News feed, one starting with Account details, and another starting with Log out.

Custom menus should not be responsible display anywhere - they should provide a list of menu items we can iterate over in our custom templates. That said, a widget that allows us to show a menu (e.g. for a "quick links" sidebar I'm the forum) could be nice.

Built in menu candidates:
  • Main Menu
  • User Menu (when clicking your icon/name in the corner)
  • Footer links (on the default theme, these exist below the theme selector and starts with Terms and rules)

Add-on candidate examples:
  • Mega footer menu (see the example on this site. There are four custom menus down there)
  • Content navigation, e.g. a knowledgebase that has a forum-like hierarchy

Editing the menu items should be a very similar experience to the public navigation editor - a list of nested items with configurations for where to go. The intended user experience should be that addons should register custom menus or add/replace menu items in built in menus. Admins can then customize those menus, changing the order or adding/removing their own. This allows custom themes to handle these custom menu items gracefully (likely via a foreach rather than explicitly adding menu items by hand).

It would also prevent addons from fighting to each other. If two plugins for instance try to add something to the bottom nav menu, this can result in strange and unexpected results depending on how they're added. Adding the menu items to a menu instead eliminates this point of conflict.

Open questions:
- How should we handle two addons attempting to modify the same existing menu item? For instance, if the 'contact us' link is changed by a forms plugin to go to a user defined contact form, and then a helpdesk plugin is installed which tries to overwrite the link to go to its knowledge base.

I see three options here. Option 3 is my recommendation as it creates more predictable behavior.
  • First plugin wins. A check is added to the modify function that only allows it to be modified if the menu item has not already been overridden. Under the hood, I imagine that a nullable column would exist that holds the id of the menu item that is overriding it. If that is not null, then the update call fails.
  • Define as undefined behavior. Every plugin applies the override. Winner is whichever plugin loads last. Because this is unpredictable, the outcome is undefined.
  • Do not allow updates. If an addon wants to replace an existing menu item, they should create a custom disabled menu item and insert it after the item they wish to replace. The admin can then go to the menu and disable the built in item and enable the item from the plugin they want displayed.

Do let me know of other thoughts or concerns you guys see and I'll update this post.
 
Upvote 2
 
Neat plugin! I'll definitely see if I can put it to use.
Seems I saw the wrong forum. I do like this suggestion as well and I think this could be a good companion.

My suggestion is more about the back end - allowing us to use the already very powerful menu editor for menus other than the main navigation menu. The system suggested here us agnostic to how the menus are displayed or even whether they are displayed at all. It should be perfectly legal to define a menu and not use it, just like it's perfectly legal to define a template or a widget and not use it.
 
Neat plugin! I'll definitely see if I can put it to use.

This suggestion is more about the back end - allowing us to use the already very powerful menu editor for menus other than the main navigation menu. The system suggested here us agnostic to how the menus are displayed or even whether they are displayed at all. It should be perfectly legal to define a menu and not use it, just like it's perfectly legal to define a template or a widget and not use it.

I could definitely see the linked addon hooking in to a multi-menu system though. I think that would be a great way to manage that.

Not a plugin. Just another suggestion for improving the navigation structure.
 
Back
Top Bottom