You are here

function groupmenu_admin_menu_output_alter in Group Menu 7

Implements hook_admin_menu_output_alter().

Integration with admin_menu module. Remove Group Menus from Admin Menu as this adds a lot of clutter.

File

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

Code

function groupmenu_admin_menu_output_alter(&$content) {
  if (isset($content['menu']['admin/structure']['admin/structure/menu'])) {
    foreach ($content['menu']['admin/structure']['admin/structure/menu'] as $key => $menu) {
      if (preg_match('/^admin\\/structure\\/menu\\/manage\\/(\\S+)$/', $key, $matches)) {
        $result = db_query("SELECT distinct gm.gid FROM {group_menu} as gm where gm.menu_name = :key", array(
          ':key' => $matches[1],
        ))
          ->fetchCol();
        if (isset($result[0])) {
          unset($content['menu']['admin/structure']['admin/structure/menu'][$key]);
        }
      }
    }
  }
}