diff options
author | Steven Wittens <steven@10.no-reply.drupal.org> | 2006-12-12 09:48:47 +0000 |
---|---|---|
committer | Steven Wittens <steven@10.no-reply.drupal.org> | 2006-12-12 09:48:47 +0000 |
commit | 2c3f9537ed85f4b6170d7b0452513806e0d779de (patch) | |
tree | ad3c208b50d9468df60833b8141eab5ac5565b17 /modules/system/system.module | |
parent | 5cb01fd589f715b9685299da06794e20d9cf137e (diff) | |
download | brdo-2c3f9537ed85f4b6170d7b0452513806e0d779de.tar.gz brdo-2c3f9537ed85f4b6170d7b0452513806e0d779de.tar.bz2 |
#84250: Allow usage of query string on confirm forms.
Diffstat (limited to 'modules/system/system.module')
-rw-r--r-- | modules/system/system.module | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/modules/system/system.module b/modules/system/system.module index b4d2f637d..aabebdd72 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -2124,6 +2124,7 @@ function system_node_type($op, $info) { * block <em>foo</em>?"). * @param $path * The page to go to if the user denies the action. + * Can be either a drupal path, or an array with the keys 'path', 'query', 'fragment'. * @param $description * Additional text to display (defaults to "This action cannot be undone."). * @param $yes @@ -2138,6 +2139,16 @@ function system_node_type($op, $info) { */ function confirm_form($form, $question, $path, $description = NULL, $yes = NULL, $no = NULL, $name = 'confirm') { $description = ($description) ? $description : t('This action cannot be undone.'); + + // Prepare cancel link + $query = $fragment = NULL; + if (is_array($path)) { + $query = isset($path['query']) ? $path['query'] : NULL; + $fragment = isset($path['fragment']) ? $path['fragment'] : NULL; + $path = isset($path['path']) ? $path['path'] : NULL; + } + $cancel = l($no ? $no : t('Cancel'), $path, array(), $query, $fragment); + drupal_set_title($question); $form['#attributes'] = array('class' => 'confirmation'); $form['description'] = array('#value' => $description); @@ -2145,7 +2156,7 @@ function confirm_form($form, $question, $path, $description = NULL, $yes = NULL, $form['actions'] = array('#prefix' => '<div class="container-inline">', '#suffix' => '</div>'); $form['actions']['submit'] = array('#type' => 'submit', '#value' => $yes ? $yes : t('Confirm')); - $form['actions']['cancel'] = array('#value' => l($no ? $no : t('Cancel'), $path)); + $form['actions']['cancel'] = array('#value' => $cancel); $form['#base'] = 'confirm_form'; return $form; } |