function file_entity_multiple_delete_confirm in File Entity (fieldable files) 7
Same name and namespace in other branches
- 7.3 file_entity.admin.inc \file_entity_multiple_delete_confirm()
- 7.2 file_entity.admin.inc \file_entity_multiple_delete_confirm()
Confirm form for the request to delete files.
Parameters
array $files: An array of file_ids to delete.
1 call to file_entity_multiple_delete_confirm()
- file_entity_multiple_delete_confirm_operation in ./
file_entity.module - File operation to show a confirm form for file deletion.
1 string reference to 'file_entity_multiple_delete_confirm'
- file_entity_page_delete in ./
file_entity.pages.inc - Menu callback; shows delete confirmation form.
File
- ./
file_entity.pages.inc, line 110 - Supports file operations including View, Edit, and Delete.
Code
function file_entity_multiple_delete_confirm($form, &$form_state, $files, $redirect_path = NULL) {
$form['files'] = array(
'#tree' => TRUE,
);
$form['file_titles'] = array(
'#theme' => 'item_list',
);
$files = file_load_multiple($files);
foreach ($files as $fid => $file) {
$form['files'][$fid] = array(
'#type' => 'value',
'#value' => $fid,
);
$form['file_titles']['#items'][] = check_plain($file->filename);
}
$form['operation'] = array(
'#type' => 'hidden',
'#value' => 'delete',
);
$confirm_question = format_plural(count($files), 'Are you sure you want to delete this file?', 'Are you sure you want to delete these files?');
return confirm_form($form, $confirm_question, $redirect_path, t('This action cannot be undone.'), t('Delete'), t('Cancel'));
}