function file_entity_multiple_delete_confirm_submit in File Entity (fieldable files) 7
Same name and namespace in other branches
- 7.3 file_entity.admin.inc \file_entity_multiple_delete_confirm_submit()
- 7.2 file_entity.admin.inc \file_entity_multiple_delete_confirm_submit()
Attempt to delete files and notify the user of the result.
1 string reference to 'file_entity_multiple_delete_confirm_submit'
- file_entity_multiple_delete_confirm_operation in ./
file_entity.module - File operation to show a confirm form for file deletion.
File
- ./
file_entity.pages.inc, line 139 - Supports file operations including View, Edit, and Delete.
Code
function file_entity_multiple_delete_confirm_submit($form, &$form_state) {
if ($form_state['values']['confirm']) {
$files = file_load_multiple(array_keys($form_state['values']['files']));
foreach ($files as $fid => $file) {
$result = file_delete($file);
if (is_array($result)) {
drupal_set_message(t('The file @title is in use and cannot be deleted.', array(
'@title' => $file->filename,
)), 'warning');
}
elseif (!$result) {
drupal_set_message(t('The file @title was not deleted due to an error.', array(
'@title' => $file->filename,
)), 'error');
}
else {
$message = t('File @title was deleted', array(
'@title' => $file->filename,
));
$form_state['redirect'] = user_access('administer files') ? 'admin/content/file' : '<front>';
watchdog('file', $message);
drupal_set_message($message);
}
}
}
}