You are here

function og_menu_admin_menu_output_alter in Organic Groups Menu (OG Menu) 7.3

Implements hook_admin_menu_output_alter().

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

File

./og_menu.module, line 671
Integrates Menu with Organic Groups. Lots of menu forms duplication in OG context.

Code

function og_menu_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 ogm.gid FROM {og_menu} as ogm where ogm.menu_name = :key", array(
          ':key' => $matches[1],
        ))
          ->fetchCol();
        if (isset($result[0])) {
          unset($content['menu']['admin/structure']['admin/structure/menu'][$key]);
        }
      }
    }
  }
}