You are here

function mediafield_field_delete_revision in D7 Media 7.3

Same name and namespace in other branches
  1. 7.4 modules/mediafield/mediafield.module \mediafield_field_delete_revision()
  2. 7.2 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;
    }
  }
}