1 file.admin.inc | file_type_delete_confirm($form, &$form_state, $type) |
Menu callback; delete a single file type.
File
- core/
modules/ file/ file.admin.inc, line 470 - Admin page callbacks for the File module.
Code
function file_type_delete_confirm($form, &$form_state, $type) {
$type = (array) $type;
$form['type'] = array('#type' => 'value', '#value' => $type['type']);
$form['name'] = array('#type' => 'value', '#value' => $type['name']);
$message = t('Are you sure you want to delete the file type %type?', array('%type' => $type['name']));
$caption = '';
$num_files = db_query("SELECT COUNT(*) FROM {file_managed} WHERE type = :type", array(':type' => $type['type']))->fetchField();
if ($num_files) {
$caption .= '<p>' . format_plural($num_files, '%type is used by 1 file on your site. If you remove this file type, you will not be able to edit the %type file and it may not display correctly.', '%type is used by @count pieces of file on your site. If you remove %type, you will not be able to edit the %type file and it may not display correctly.', array('%type' => $type['name'])) . '</p>';
}
$caption .= '<p>' . t('This action cannot be undone.') . '</p>';
return confirm_form($form, $message, 'admin/structure/file-types', $caption, t('Delete'));
}