function mediafield_field_delete_revision in D7 Media 7.4
Same name and namespace in other branches
- 7.2 modules/mediafield/mediafield.module \mediafield_field_delete_revision()
- 7.3 modules/mediafield/mediafield.module \mediafield_field_delete_revision()
Implements hook_field_delete_revision().
File
- modules/
mediafield/ mediafield.module, line 305 - Provide a "Multimedia asset" field.
Code
function mediafield_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, 'mediafield', $entity_type, $id, 1)) {
$items[$delta] = NULL;
}
}
}