You are here

function file_entity_page_delete in File Entity (fieldable files) 7

Same name and namespace in other branches
  1. 7.3 file_entity.pages.inc \file_entity_page_delete()
  2. 7.2 file_entity.pages.inc \file_entity_page_delete()

Menu callback; shows delete confirmation form.

1 string reference to 'file_entity_page_delete'
file_entity_menu in ./file_entity.module
Implements hook_menu().

File

./file_entity.pages.inc, line 90
Supports file operations including View, Edit, and Delete.

Code

function file_entity_page_delete($file) {
  drupal_set_title(t('<em>Delete @type</em> @title', array(
    '@type' => $file->type,
    '@title' => $file->filename,
  )), PASS_THROUGH);

  // Don't bother showing the form if the item is in use, since we won't allow
  // them to delete it anyway.
  $references = file_usage_list($file);
  if (!empty($references)) {
    return t('The file %title is in use and cannot be deleted.', array(
      '%title' => $file->filename,
    ));
  }
  else {
    $files = array(
      $file->fid => $file->fid,
    );
    return drupal_get_form('file_entity_multiple_delete_confirm', $files, 'file/' . $file->fid);
  }
}