function menu_link_field_delete in Menu Link (Field) 7
Implements hook_field_delete().
File
- ./
menu_link.field.inc, line 308 - Defines a menu link field type.
Code
function menu_link_field_delete($entity_type, $entity, $field, $instance, $langcode, &$items) {
$mlids = array();
foreach ($items as $delta => $item) {
$mlids[] = $item['mlid'];
}
if (!empty($mlids)) {
// Only delete menu links that are (still) owned by the Menu link module.
$mlids = db_select('menu_links')
->fields('menu_links', array(
'mlid',
))
->condition('module', 'menu_link')
->condition('mlid', $mlids)
->execute()
->fetchCol();
if (!empty($mlids)) {
menu_link_delete_multiple($mlids);
}
}
}