function media_multiple_delete_confirm in D7 Media 7
Confirm the request to delete files.
1 call to media_multiple_delete_confirm()
- media_admin in includes/
media.admin.inc - Display the list or thumbnails media admin display.
1 string reference to 'media_multiple_delete_confirm'
- media_page_delete in includes/
media.pages.inc - Menu callback; shows delete confirmation form.
File
- includes/
media.pages.inc, line 83 - Common pages for the Media module.
Code
function media_multiple_delete_confirm($form, &$form_state, $files, $redirect_on_success = NULL, $redirect_on_cancel = NULL) {
$form['files'] = array(
'#tree' => TRUE,
);
$form['file_titles'] = array(
'#theme' => 'item_list',
);
foreach ($files as $fid => $value) {
$title = db_query('SELECT filename FROM {file_managed} WHERE fid = :fid', array(
':fid' => $fid,
))
->fetchField();
$form['files'][$fid] = array(
'#type' => 'value',
'#value' => $fid,
);
$form['file_titles']['#items'][] = check_plain($title);
}
$form['operation'] = array(
'#type' => 'hidden',
'#value' => 'delete',
);
if (isset($redirect_on_success)) {
$form['redirect_on_success'] = array(
'#type' => 'value',
'#value' => $redirect_on_success,
);
}
$form['#submit'][] = 'media_multiple_delete_confirm_submit';
$confirm_question = format_plural(count($files), 'Are you sure you want to delete this item?', 'Are you sure you want to delete these items?');
return confirm_form($form, $confirm_question, isset($redirect_on_cancel) ? $redirect_on_cancel : current_path(), t('This action cannot be undone.'), t('Delete'), t('Cancel'));
}