You are here

function groupmenu_entity_delete in Group Menu 7

Implements hook_entity_delete().

File

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

Code

function groupmenu_entity_delete($entity, $type) {
  if ($type != 'group') {
    return;
  }
  $result = db_select('group_menu', 'm')
    ->fields('m', array(
    'menu_name',
  ))
    ->condition('gid', $entity->gid, '=')
    ->execute();
  while ($record = $result
    ->fetchAssoc()) {
    $menu = menu_load($record['menu_name']);
    menu_delete($menu);
    groupmenu_delete_menu($record['menu_name']);
  }
}