You are here

function groupmenu_entity_update in Group Menu 7

Implements hook_entity_update().

File

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

Code

function groupmenu_entity_update($entity, $type) {
  if ($type != 'group') {
    return;
  }
  $menu = groupmenu_get_group_menus(array(
    $entity->gid,
  ));
  if (empty($menu)) {
    menu_save(array(
      'menu_name' => 'menu-group-' . $entity->gid,
      'title' => $entity->title,
      'description' => t('Group Menu for @title', array(
        '@title' => $entity->title,
      )),
    ));
    groupmenu_update_menu('menu-group-' . $entity->gid, $entity->gid);
  }
  groupmenu_group_save($entity);
}