You are here

function groupmenu_group_admin_block_alter in Group Menu 7

Implements hook_group_admin_block_alter().

File

./groupmenu.module, line 877
Integrates menu with Group.

Code

function groupmenu_group_admin_block_alter(array &$block) {
  if (!module_exists('groupcontext')) {
    return;
  }
  $group_context = groupcontext();
  if (empty($group_context)) {
    return;
  }
  $href = "group/{$group_context}/menus";
  $menus = groupmenu_get_menus($group_context);
  if (count($menus) === 1) {
    $menu = reset($menus);
    $href = "group/{$group_context}/menus/{$menu->menu_name}";
  }
  $block['content']['edit_menu'] = array(
    '#theme' => 'menu_link__group_admin_block',
    '#attributes' => array(),
    '#below' => array(),
    '#localized_options' => array(
      'html' => TRUE,
    ),
    '#title' => t('Manage the menu'),
    '#href' => $href,
    '#weight' => 0,
  );
}