Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Currently, if a group has multiple menus, the OG menu: single block displays the first menu only. If you are viewing group content that is linked from any other menu, you still only see the first menu and not the menu that contains the current content. I will submit a patch that checks if the current page is in any one of the group menus and display that menu in the single block, otherwise if none is found, display the first OG menu.
Comments
Comment #1
bulldozer2003Comment #2
bulldozer2003Would it be better to add a new display for this? Leaving single block to display the first menu and an additional block for the context aware menu?
In my use case I realize that a new context aware block would be better than replacing the single block.
Comment #3
bulldozer2003Here is a patch implementing a new single menu block that shows the OG Menu the current page belongs to, if any.
Question: would it be worth adding code to check if the single menu block is in use and hide this block if it is going to show the single menu again?
Comment #4
bulldozer2003Ok here is an even better implementation.
Now a "default" menu can be selected on the group>menus page, if set, that is the menu that the single menu block will display.
Adds the contextual single menu block, that will display the appropriate OG context's menu that has a link to the current page.
Comment #5
bulldozer2003Here is a fully thought out implementation of my improved block displays.
To assign default menus, a new column was added to the group "list menus for %group" page. When og creates a menu for a group via the node checkbox, that menu is set default.
Comment #6
rv0 CreditAttribution: rv0 commentedWell, I could not apply to latest code so I just had a brief glance at the patch.
So correct me if I'm wrong:
The "og_menu_default_menus" variable setting puzzles me a bit.
I've worked on sites with 1000's of groups, that array will become huge.
This feels wrong. Would't a simple boolean in the og_menu table offer the same functionality at a fraction of the performance cost?
Comment #7
bulldozer2003Rethinking this, I could change the menu list to be a sortable table and menus could be stacked in the order the user wants them displayed. Multi menu block would display them in the user defined order and single menu would display the top menu, while context menu block behaves as I originally outlined.
Comment #8
xjm