Created
December 6, 2018 19:47
-
-
Save dasginganinja/bdc7151a5cd74e5b8f69abf7b0f8867f to your computer and use it in GitHub Desktop.
OG Drupal 7 Get First menu in current context
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Determine appropriate menu to load | |
$context = og_context(); | |
$menu_name = 'main-menu'; | |
if ($context) { | |
$menus = og_menu_get_group_menus([ | |
$context['group_type'] => [$context['gid']], | |
]); | |
$menu = array_shift($menus); | |
if ($menu) { | |
$menu_name = $menu['menu_name']; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment