You are here

function minisite_file_field_delete_file in Mini site 7

Delete minisite file field data.

3 calls to minisite_file_field_delete_file()
minisite_field_delete in includes/minisite.field.inc
Implements hook_field_delete().
minisite_field_delete_revision in includes/minisite.field.inc
Implements hook_field_delete_revision().
minisite_field_update in includes/minisite.field.inc
Implements hook_field_update().

File

includes/minisite.field.inc, line 206
Minisite field.

Code

function minisite_file_field_delete_file($item, $field, $entity_type, $id, $count = 1) {

  // To prevent the file field from deleting files it doesn't know about, check
  // the file reference count. Temporary files can be deleted because they
  // are not yet associated with any content at all.
  $file = (object) $item;
  $file_usage = file_usage_list($file);

  // Delete minisite.
  minisite_site_delete($item, $field, $entity_type, $id);
  if ($file->status == 0 || !empty($file_usage['minisite'])) {
    file_usage_delete($file, 'minisite', $entity_type, $id, $count);
    return file_delete($file);
  }

  // Even if the file is not deleted, return TRUE to indicate the file field
  // record can be removed from the field database tables.
  return TRUE;
}