Commit 3cb2a5ef authored by Dries's avatar Dries

- Patch #582456 by dereine, sun, tobiasb: make confirm_form() respect query string destination.

parent 36135952
...@@ -462,7 +462,7 @@ function node_delete_confirm($form, &$form_state, $node) { ...@@ -462,7 +462,7 @@ function node_delete_confirm($form, &$form_state, $node) {
return confirm_form($form, return confirm_form($form,
t('Are you sure you want to delete %title?', array('%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'])), t('Are you sure you want to delete %title?', array('%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'])),
isset($_GET['destination']) ? $_GET['destination'] : 'node/' . $node->nid, 'node/' . $node->nid,
t('This action cannot be undone.'), t('This action cannot be undone.'),
t('Delete'), t('Delete'),
t('Cancel') t('Cancel')
......
...@@ -186,7 +186,7 @@ function path_admin_delete_confirm($form, $form_state, $pid) { ...@@ -186,7 +186,7 @@ function path_admin_delete_confirm($form, $form_state, $pid) {
$form['pid'] = array('#type' => 'value', '#value' => $pid); $form['pid'] = array('#type' => 'value', '#value' => $pid);
$output = confirm_form($form, $output = confirm_form($form,
t('Are you sure you want to delete path alias %title?', array('%title' => $path['dst'])), t('Are you sure you want to delete path alias %title?', array('%title' => $path['dst'])),
isset($_GET['destination']) ? $_GET['destination'] : 'admin/config/search/path'); 'admin/config/search/path');
} }
return $output; return $output;
} }
......
...@@ -2400,14 +2400,17 @@ function _system_sort_requirements($a, $b) { ...@@ -2400,14 +2400,17 @@ function _system_sort_requirements($a, $b) {
function confirm_form($form, $question, $path, $description = NULL, $yes = NULL, $no = NULL, $name = 'confirm') { function confirm_form($form, $question, $path, $description = NULL, $yes = NULL, $no = NULL, $name = 'confirm') {
$description = isset($description) ? $description : t('This action cannot be undone.'); $description = isset($description) ? $description : t('This action cannot be undone.');
// Prepare cancel link // Prepare cancel link.
$query = $fragment = NULL; if (isset($_GET['destination'])) {
if (is_array($path)) { $options = drupal_parse_url(urldecode($_GET['destination']));
$query = isset($path['query']) ? $path['query'] : NULL; }
$fragment = isset($path['fragment']) ? $path['fragment'] : NULL; elseif (is_array($path)) {
$path = isset($path['path']) ? $path['path'] : NULL; $options = $path;
} }
$cancel = l($no ? $no : t('Cancel'), $path, array('query' => $query, 'fragment' => $fragment)); else {
$options = array('path' => $path);
}
$cancel = l($no ? $no : t('Cancel'), $options['path'], $options);
drupal_set_title($question, PASS_THROUGH); drupal_set_title($question, PASS_THROUGH);
......
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