function views_bulk_operations_delete_item in Views Bulk Operations (VBO) 7.3
File
- actions/
delete.action.inc, line 39 - Implements a generic entity delete action. Uses Entity API if available.
Code
function views_bulk_operations_delete_item($entity, $context) {
$info = entity_get_info($context['entity_type']);
$entity_id = $entity->{$info['entity keys']['id']};
entity_delete($context['entity_type'], $entity_id);
// Add a message to the watchdog if we've been configured to do so.
if (!empty($context['settings']['log'])) {
// Log an appropriate message for this entity type, using the format from
// the node, taxonomy and user module for their entity types.
switch ($context['entity_type']) {
case 'node':
watchdog('content', '@type: deleted %title.', array(
'@type' => $entity->type,
'%title' => $entity->title,
));
break;
case 'taxonomy_term':
watchdog('taxonomy', 'Deleted term %name.', array(
'%name' => $entity->name,
), WATCHDOG_NOTICE);
break;
case 'user':
watchdog('user', 'Deleted user: %name %email.', array(
'%name' => $entity->name,
'%email' => '<' . $entity->mail . '>',
), WATCHDOG_NOTICE);
break;
default:
watchdog('entity', 'Deleted @type %label.', array(
'@type' => $context['entity_type'],
'%label' => entity_label($context['entity_type'], $entity),
));
break;
}
}
}