PluginModule-menu items appear in two menus
Bug #1372536 reported by
Tobias Zeuch
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Mahara |
Fix Released
|
High
|
Tobias Zeuch |
Bug Description
With a module-plugin, that overwrites menu_items, the returned menu items appear in the main navigation and also in the top right corner. Both are very helpful on their own, but it should be possible to add an item to either of them without the other, like, have an entry only in the upper right corner but not in the main menu or vice versa.
The calls are indistinguishable (as far as I see) and originate from web.php::main_nav, line 2683 and web.php::right_nav, line 2741
Changed in mahara: | |
assignee: | nobody → Son Nguyen (ngson2000) |
status: | Confirmed → In Progress |
Changed in mahara: | |
assignee: | Son Nguyen (ngson2000) → Tobias Zeuch (tobias-zeuch-8) |
Changed in mahara: | |
milestone: | 1.10.0 → 1.11.0 |
Changed in mahara: | |
milestone: | 1.11.0 → 1.10.0 |
Changed in mahara: | |
status: | In Progress → Fix Committed |
Changed in mahara: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
After investigating a bit more about the menu-structure and understanding in more detail about how the menus are built, I realized that the problem is not specific for the module plugins but is the same for interaction and artefact. The active menu-items are filtered by their path: Every entry whose path starts with "settings" or "inbox" gets displayed in the upper right corner, for the main menu, the active elements start with "content", "myportfolio" and "groups", plus admin for admin user.
To get a menu item into the first level, it would need a path without a '/', but with the two identical calls, the menu item directly appears in both menus.
Are plugins not meant to add anything to the first level of any of the menus? If not, I'm not sure what would be the easiest way to allow that. menu_items could accept a string (by default ignored) for the different menus, to adjust the output regarding on the menu it is called for. But that would compete with the logic of putting menu items into the menu using their path. )-function.
There could be another path level for the side-menu, but that would mean changes for all plugins that add to the right-nav menu and I think it would clash a little bit with the actual concept where you could add a complete menu-item subtree to the right-nav by adding the parent-entry to the right_nav(
Or there could be another function right_nav_items() for plugins, also weird when there is already the possibility to add subentries to the "settings" menu for example using the menu_items() function.