Commit fe8b35f5 authored by Steven Wittens's avatar Steven Wittens

#153781: Convert all remaining confirm_forms() to deletion api.

parent 39a0ee02
......@@ -2979,7 +2979,7 @@ function drupal_delete_add_form_elements($elements) {
/**
* @} End of "ingroup deletionapi".
*/
/**
* Create/build/execute deletion packages.
*
......
......@@ -393,7 +393,9 @@ function locale_languages_delete_form(&$form_state, $langcode) {
}
else {
$form['langcode'] = array('#type' => 'value', '#value' => $langcode);
return confirm_form($form, t('Are you sure you want to delete the language %name?', array('%name' => t($languages[$langcode]->name))), 'admin/settings/language', t('Deleting a language will remove all interface translations associated with it, and posts in this language will be set to be language neutral. This action cannot be undone.'), t('Delete'), t('Cancel'));
$options = array('description' => t('Deleting a language will remove all interface translations associated with it, and posts in this language will be set to be language neutral. This action cannot be undone.'));
return confirm_form($form, t('Are you sure you want to delete the language %name?', array('%name' => t($languages[$langcode]->name))), 'admin/settings/language', $options);
}
}
......@@ -1194,7 +1196,7 @@ function _locale_import_one_string($op, $value = NULL, $mode = NULL, $lang = NUL
else {
// Some real string to import.
$comments = _locale_import_shorten_comments(empty($value['#']) ? array() : $value['#']);
if (strpos($value['msgid'], "\0")) {
// This string has plural versions.
$english = explode("\0", $value['msgid'], 2);
......@@ -1279,7 +1281,7 @@ function _locale_import_one_string_db(&$report, $langcode, $source, $translation
db_query("DELETE FROM {locales_target} WHERE language = '%s' AND lid = %d AND plid = %d AND plural = %d", $translation, $langcode, $lid, $plid, $plural);
$report[2]++;
}
return $lid;
}
......
......@@ -566,7 +566,7 @@ function block_box_delete($bid = 0) {
$form['info'] = array('#type' => 'hidden', '#value' => $box['info'] ? $box['info'] : $box['title']);
$form['bid'] = array('#type' => 'hidden', '#value' => $bid);
return confirm_form($form, t('Are you sure you want to delete the block %name?', array('%name' => $box['info'])), 'admin/build/block', '', t('Delete'), t('Cancel'));
return confirm_form($form, t('Are you sure you want to delete the block %name?', array('%name' => $box['info'])), 'admin/build/block');
}
/**
......
......@@ -265,7 +265,7 @@ function contact_admin_delete(&$form_state, $cid = NULL) {
'#value' => $info->category,
);
return confirm_form($form, t('Are you sure you want to delete %category?', array('%category' => $info->category)), 'admin/build/contact', t('This action cannot be undone.'), t('Delete'), t('Cancel'));
return confirm_form($form, t('Are you sure you want to delete %category?', array('%category' => $info->category)), 'admin/build/contact');
}
else {
drupal_set_message(t('Category not found.'), 'error');
......
......@@ -32,15 +32,15 @@ function filter_help($section) {
<p>Below you can configure which input formats are available to which roles, as well as choose a default input format (used for imported content, for example).</p>
<p>Note that (1) the default format is always available to all roles, and (2) all filter formats can always be used by roles with the "administer filters" permission even if they are not explicitly listed in the Roles column of this table.</p>');
case 'admin/settings/filters/'. arg(3):
case 'admin/settings/filters/'. ((int)arg(3)):
return t('
<p>Every <em>filter</em> performs one particular change on the user input, for example stripping out malicious HTML or making URLs clickable. Choose which filters you want to apply to text in this input format.</p>
<p>If you notice some filters are causing conflicts in the output, you can <a href="@rearrange">rearrange them</a>.</p>', array('@rearrange' => url('admin/settings/filters/'. arg(3) .'/order')));
case 'admin/settings/filters/'. arg(3) .'/configure':
case 'admin/settings/filters/'. ((int)arg(3)) .'/configure':
return '<p>'. t('If you cannot find the settings for a certain filter, make sure you have enabled it on the <a href="@url">view tab</a> first.', array('@url' => url('admin/settings/filters/'. arg(3)))) .'</p>';
case 'admin/settings/filters/'. arg(3) .'/order':
case 'admin/settings/filters/'. ((int)arg(3)) .'/order':
return t('
<p>Because of the flexible filtering system, you might encounter a situation where one filter prevents another from doing its job. For example: a word in an URL gets converted into a glossary term, before the URL can be converted in a clickable link. When this happens, you will need to rearrange the order in which filters get executed.</p>
<p>Filters are executed from top-to-bottom. You can use the weight column to rearrange them: heavier filters "sink" to the bottom.</p>');
......@@ -337,7 +337,9 @@ function filter_admin_delete() {
$form['format'] = array('#type' => 'hidden', '#value' => $format->format);
$form['name'] = array('#type' => 'hidden', '#value' => $format->name);
return confirm_form($form, t('Are you sure you want to delete the input format %format?', array('%format' => $format->name)), 'admin/settings/filters', t('If you have any content left in this input format, it will be switched to the default input format. This action cannot be undone.'), t('Delete'), t('Cancel'));
$options = array('description' => t('If you have any content left in this input format, it will be switched to the default input format. This action cannot be undone.'));
return confirm_form($form, t('Are you sure you want to delete the input format %format?', array('%format' => $format->name)), 'admin/settings/filters', $options);
}
else {
drupal_set_message(t('The default format cannot be deleted.'));
......
......@@ -610,7 +610,9 @@ function forum_confirm_delete(&$form_state, $tid) {
$form['tid'] = array('#type' => 'value', '#value' => $tid);
$form['name'] = array('#type' => 'value', '#value' => $term->name);
return confirm_form($form, t('Are you sure you want to delete the forum %name?', array('%name' => $term->name)), 'admin/content/forum', t('Deleting a forum or container will delete all sub-forums and associated posts as well. This action cannot be undone.'), t('Delete'), t('Cancel'));
$options = array('description' => t('Deleting a forum or container will delete all sub-forums and associated posts as well. This action cannot be undone.'));
return confirm_form($form, t('Are you sure you want to delete the forum %name?', array('%name' => $term->name)), 'admin/content/forum', $options);
}
/**
......
......@@ -464,7 +464,7 @@ function menu_item_delete_form(&$form_state, $mlid) {
}
$form['#item'] = $item;
return confirm_form($form, t('Are you sure you want to delete the custom menu item %item?', array('%item' => $item['link_title'])), 'admin/build/menu/'. $item['menu_name'], t('This action cannot be undone.'), t('Delete'));
return confirm_form($form, t('Are you sure you want to delete the custom menu item %item?', array('%item' => $item['link_title'])), 'admin/build/menu/'. $item['menu_name']);
}
/**
......@@ -485,7 +485,13 @@ function menu_item_delete_form_submit($form, &$form_state) {
function menu_reset_item(&$form_state, $mlid) {
if (isset($mlid) && $item = db_fetch_array(db_query('SELECT router_path, link_title FROM {menu_links} WHERE mlid = %d', $mlid))) {
$form['#router_path'] = $item['router_path'];
return confirm_form($form, t('Are you sure you want to reset the item %item to its default values?', array('%item' => $item['link_title'])), 'admin/build/menu', t('Any customizations will be lost. This action cannot be undone.'), t('Reset'));
$options = array(
'description' => t('Any customizations will be lost. This action cannot be undone.'),
'yes' => t('Reset')
);
return confirm_form($form, t('Are you sure you want to reset the item %item to its default values?', array('%item' => $item['link_title'])), 'admin/build/menu', $options);
}
else {
drupal_not_found();
......
......@@ -392,7 +392,9 @@ function node_type_delete_confirm(&$form_state, $type) {
$caption .= '<p>'. t('This action cannot be undone.') .'</p>';
return confirm_form($form, $message, 'admin/content/types', $caption, t('Delete'));
$options = array('description' => $caption);
return confirm_form($form, $message, 'admin/content/types', $options);
}
/**
......
......@@ -1078,8 +1078,13 @@ function node_configure_validate($form, &$form_state) {
* Menu callback: confirm rebuilding of permissions.
*/
function node_configure_rebuild_confirm() {
$options = array(
'description' => t('This will wipe all current node permissions and rebuild them based on current settings. Rebuilding the permissions may take a while so please be patient. This action cannot be undone.'),
'yes' => t('Rebuild permissions')
);
return confirm_form(array(), t('Are you sure you want to rebuild node permissions on the site?'),
'admin/content/node-settings', t('This will wipe all current node permissions and rebuild them based on current settings. Rebuilding the permissions may take a while so please be patient. This action cannot be undone.'), t('Rebuild permissions'), t('Cancel'));
'admin/content/node-settings', $options);
}
/**
......
......@@ -96,8 +96,7 @@ function path_admin_delete_confirm($pid) {
$form['pid'] = array('#type' => 'value', '#value' => $pid);
$output = confirm_form($form,
t('Are you sure you want to delete path alias %title?', array('%title' => $path['dst'])),
isset($_GET['destination']) ? $_GET['destination'] : 'admin/build/path', t('This action cannot be undone.'),
t('Delete'), t('Cancel') );
isset($_GET['destination']) ? $_GET['destination'] : 'admin/build/path');
}
return $output;
}
......
......@@ -398,10 +398,10 @@ function profile_field_delete(&$form_state, $fid) {
$form['fid'] = array('#type' => 'value', '#value' => $fid);
$form['title'] = array('#type' => 'value', '#value' => $field->title);
$options = array('description' => t('This action cannot be undone. If users have entered values into this field in their profile, these entries will also be deleted. If you want to keep the user-entered data, instead of deleting the field you may wish to <a href="@edit-field">edit this field</a> and change it to a hidden profile field so that it may only be accessed by administrators.', array('@edit-field' => url('admin/user/profile/edit/'. $fid))));
return confirm_form($form,
t('Are you sure you want to delete the field %field?', array('%field' => $field->title)), 'admin/user/profile',
t('This action cannot be undone. If users have entered values into this field in their profile, these entries will also be deleted. If you want to keep the user-entered data, instead of deleting the field you may wish to <a href="@edit-field">edit this field</a> and change it to a hidden profile field so that it may only be accessed by administrators.', array('@edit-field' => url('admin/user/profile/edit/'. $fid))),
t('Delete'), t('Cancel'));
t('Are you sure you want to delete the field %field?', array('%field' => $field->title)), 'admin/user/profile', $options);
}
/**
......
......@@ -262,8 +262,13 @@ function search_admin_settings() {
* Menu callback: confirm wiping of the index.
*/
function search_wipe_confirm() {
$options = array(
'description' => t(' The search index is not cleared but systematically updated to reflect the new settings. Searching will continue to work but new content won\'t be indexed until all existing content has been re-indexed. This action cannot be undone.'),
'yes' => t('Re-index site')
);
return confirm_form(array(), t('Are you sure you want to re-index the site?'),
'admin/settings/search', t(' The search index is not cleared but systematically updated to reflect the new settings. Searching will continue to work but new content won\'t be indexed until all existing content has been re-indexed. This action cannot be undone.'), t('Re-index site'), t('Cancel'));
'admin/settings/search', $options);
}
/**
......
......@@ -1641,14 +1641,18 @@ function system_modules_confirm_form($modules, $storage) {
$form['text'] = array('#value' => theme('item_list', $items));
if ($form) {
$options = array(
'description' => t('Would you like to continue with enabling the above?'),
'yes' => t('Continue'),
);
// Set some default form values
$form = confirm_form(
$form,
t('Some required modules must be enabled'),
'admin/build/modules',
t('Would you like to continue with enabling the above?'),
t('Continue'),
t('Cancel'));
$options);
return $form;
}
}
......@@ -1929,13 +1933,17 @@ function system_modules_uninstall_confirm_form($storage) {
$form['#confirmed'] = TRUE;
$form['uninstall']['#tree'] = TRUE;
$form['modules'] = array('#value' => '<p>'. t('The following modules will be completely uninstalled from your site, and <em>all data from these modules will be lost</em>!') .'</p>'. theme('item_list', $uninstall));
$options = array(
'description' => t('Would you like to continue with uninstalling the above?'),
'yes' => t('Uninstall')
);
$form = confirm_form(
$form,
t('Confirm uninstall'),
'admin/build/modules/uninstall',
t('Would you like to continue with uninstalling the above?'),
t('Uninstall'),
t('Cancel'));
$options);
return $form;
}
}
......
......@@ -384,13 +384,14 @@ function taxonomy_vocabulary_confirm_delete(&$form_state, $vid) {
$form['type'] = array('#type' => 'value', '#value' => 'vocabulary');
$form['vid'] = array('#type' => 'value', '#value' => $vid);
$form['name'] = array('#type' => 'value', '#value' => $vocabulary->name);
$options = array('description' => t('Deleting a vocabulary will delete all the terms in it. This action cannot be undone.'));
return confirm_form($form,
t('Are you sure you want to delete the vocabulary %title?',
array('%title' => $vocabulary->name)),
'admin/content/taxonomy',
t('Deleting a vocabulary will delete all the terms in it. This action cannot be undone.'),
t('Delete'),
t('Cancel'));
$options);
}
function taxonomy_vocabulary_confirm_delete_submit($form, &$form_state) {
......@@ -620,13 +621,14 @@ function taxonomy_term_confirm_delete(&$form_state, $tid) {
$form['type'] = array('#type' => 'value', '#value' => 'term');
$form['name'] = array('#type' => 'value', '#value' => $term->name);
$form['tid'] = array('#type' => 'value', '#value' => $tid);
$options = array('description' => t('Deleting a term will delete all its children if there are any. This action cannot be undone.'));
return confirm_form($form,
t('Are you sure you want to delete the term %title?',
array('%title' => $term->name)),
'admin/content/taxonomy',
t('Deleting a term will delete all its children if there are any. This action cannot be undone.'),
t('Delete'),
t('Cancel'));
$options);
}
function taxonomy_term_confirm_delete_submit($form, &$form_state) {
......
......@@ -1607,11 +1607,12 @@ function user_edit($form_state, $category = 'account') {
}
function user_confirm_delete($name, $uid) {
$options = array('description' => t('All submissions made by this user will be attributed to the anonymous account. This action cannot be undone.'));
return confirm_form(array(),
t('Are you sure you want to delete the account %name?', array('%name' => $name)),
'user/'. $uid,
t('All submissions made by this user will be attributed to the anonymous account. This action cannot be undone.'),
t('Delete'), t('Cancel'));
$options);
}
/**
......@@ -1663,7 +1664,7 @@ function user_view($account) {
// Retrieve all profile fields and store data in content element.
$account->content = user_build_content($account);
drupal_set_title(check_plain($account->name));
/**
/**
* To theme user profiles, copy modules/user/user_profile.tpl.php
* to your theme directory, and edit it as instructed in that file's comments.
*/
......@@ -1844,10 +1845,7 @@ function user_admin_access_delete_confirm($aid = 0) {
$form['aid'] = array('#type' => 'hidden', '#value' => $aid);
$output = confirm_form($form,
t('Are you sure you want to delete the @type rule for %rule?', array('@type' => $access_types[$edit->type], '%rule' => $edit->mask)),
'admin/user/rules',
t('This action cannot be undone.'),
t('Delete'),
t('Cancel'));
'admin/user/rules');
return $output;
}
......@@ -2448,10 +2446,11 @@ function user_multiple_delete_confirm(&$form_state) {
}
$form['operation'] = array('#type' => 'hidden', '#value' => 'delete');
$options = array('yes' => t('Delete all'));
return confirm_form($form,
t('Are you sure you want to delete these users?'),
'admin/user/user', t('This action cannot be undone.'),
t('Delete all'), t('Cancel'));
'admin/user/user', $options);
}
function user_multiple_delete_confirm_submit($form, &$form_state) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment