You are here

function media_field_attach_delete_revision in D7 Media 7

Implements hook_field_attach_delete_revision().

Parameters

type $entity_type:

type $entity:

File

includes/media.filter.inc, line 192
Functions related to the WYSIWYG editor and the media input filter.

Code

function media_field_attach_delete_revision($entity_type, $entity) {
  list($entity_id) = entity_extract_ids($entity_type, $entity);
  $files = media_entity_field_count_files($entity_type, $entity);
  foreach ($files as $fid => $count) {
    if ($file = file_load($fid)) {
      file_usage_delete($file, 'media', $entity_type, $entity_id, $count);
    }
  }
}