function media_wysiwyg_field_attach_delete_revision in D7 Media 7.2
Same name and namespace in other branches
- 7.4 modules/media_wysiwyg/includes/media_wysiwyg.file_usage.inc \media_wysiwyg_field_attach_delete_revision()
- 7.3 modules/media_wysiwyg/includes/media_wysiwyg.file_usage.inc \media_wysiwyg_field_attach_delete_revision()
Implements hook_field_attach_delete_revision().
Parameters
string or int or object... $entity_type:
string or int or object... $entity:
File
- modules/
media_wysiwyg/ includes/ media_wysiwyg.file_usage.inc, line 160 - Functions related to the tracking the file usage of embedded media.
Code
function media_wysiwyg_field_attach_delete_revision($entity_type, $entity) {
list($entity_id) = entity_extract_ids($entity_type, $entity);
$files = media_wysiwyg_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);
}
}
}