Skip to content

Instantly share code, notes, and snippets.

@dasginganinja
Created December 6, 2018 19:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dasginganinja/bdc7151a5cd74e5b8f69abf7b0f8867f to your computer and use it in GitHub Desktop.
Save dasginganinja/bdc7151a5cd74e5b8f69abf7b0f8867f to your computer and use it in GitHub Desktop.
OG Drupal 7 Get First menu in current context
<?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