You are here

function entity_embed_field_attach_delete_revision in Entity Embed 7

Same name and namespace in other branches
  1. 7.2 includes/entity_embed.file_usage.inc \entity_embed_field_attach_delete_revision()

Implements hook_field_attach_delete_revision().

File

includes/entity_embed.file_usage.inc, line 25
Tracks usage of embedded files.

Code

function entity_embed_field_attach_delete_revision($entity_type, $entity) {
  list($id, $vid, $bundle) = entity_extract_ids($entity_type, $entity);
  $files = entity_embed_entity_field_count_files($entity_type, $entity);
  foreach ($files as $fid => $count) {
    if ($file = file_load($fid)) {
      file_usage_delete($file, 'entity_embed', $entity_type, $id, $count);
    }
  }
}