function imagefield_crop_field_delete in Imagefield Crop 7.2
Same name and namespace in other branches
- 7.3 imagefield_crop.module \imagefield_crop_field_delete()
Implements hook_field_delete().
File
- ./
imagefield_crop.module, line 374 - Functionality and Drupal hook implementations for the Imagefield Crop module.
Code
function imagefield_crop_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 (imagefield_crop_files_usage_list_by_entity($entity_type, $id) as $fid => $usage) {
$file = file_load($fid);
file_field_delete_file($file, $field, $entity_type, $id, 0);
$orig_file = _imagefield_crop_file_to_crop($fid);
if ($orig_file && $orig_file->fid != $fid) {
file_usage_delete($orig_file, 'imagefield_crop', NULL, NULL, 0);
file_delete($orig_file);
}
}
}