You are here

function media_field_delete in D7 Media 7

Implements hook_field_delete().

File

includes/media.fields.inc, line 452
: Provides a "Multimedia asset" field to the fields API

Code

function media_field_delete($entity_type, $entity, $field, $instance, $langcode, &$items) {
  list($id, $vid, $bundle) = entity_extract_ids($entity_type, $entity);

  // Delete all file usages within this entity.
  foreach ($items as $delta => $item) {
    $file = (object) $item;
    file_usage_delete($file, 'media', $entity_type, $id, 0);
  }
}