function groupmenu_group_save in Group Menu 7
Process menu links for group on group save.
2 calls to groupmenu_group_save()
- groupmenu_entity_insert in ./
groupmenu.module - Implements hook_entity_insert().
- groupmenu_entity_update in ./
groupmenu.module - Implements hook_entity_update().
File
- ./
groupmenu.module, line 432 - Integrates menu with Group.
Code
function groupmenu_group_save(Group $group) {
if (isset($group->menu)) {
$link =& $group->menu;
if (!empty($link['parent'])) {
list($link['menu_name'], $link['plid']) = explode(':', $link['parent']);
}
if (empty($link['enabled'])) {
if (!empty($link['mlid'])) {
menu_link_delete($link['mlid']);
}
}
elseif (trim($link['link_title'])) {
$link['link_title'] = trim($link['link_title']);
$link['link_path'] = "group/{$group->gid}";
if (trim($link['description'])) {
$link['options']['attributes']['title'] = trim($link['description']);
}
else {
// If the description field was left empty, remove the title attribute
// from the menu link.
unset($link['options']['attributes']['title']);
}
if (!menu_link_save($link)) {
drupal_set_message(t('There was an error saving the menu link.'), 'error');
}
}
}
}