function media_field_delete_revision in D7 Media 7
Implements hook_field_delete_revision().
File
- includes/
media.fields.inc, line 465 - : Provides a "Multimedia asset" field to the fields API
Code
function media_field_delete_revision($entity_type, $entity, $field, $instance, $langcode, &$items) {
list($id, $vid, $bundle) = entity_extract_ids($entity_type, $entity);
foreach ($items as $delta => $item) {
// @TODO: Not sure if this is correct
$file = (object) $item;
if (file_usage_delete($file, 'media', $entity_type, $id, 1)) {
$items[$delta] = NULL;
}
}
}