summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2008-02-14 18:41:16 +0000
committerDries Buytaert <dries@buytaert.net>2008-02-14 18:41:16 +0000
commit5bdc79db5fd637d695c1bf9b8c9d4afa2d5015c1 (patch)
treeb523645832cc52467bb3d7b593886acd8b99b7fd /modules
parent3aac93b61f9dc903a31cf65185e074d51889999c (diff)
downloadbrdo-5bdc79db5fd637d695c1bf9b8c9d4afa2d5015c1.tar.gz
brdo-5bdc79db5fd637d695c1bf9b8c9d4afa2d5015c1.tar.bz2
- Patch #163297 by pwolanin et al: remove $_POST from taxonomy module's form handling.
Diffstat (limited to 'modules')
-rw-r--r--modules/taxonomy/taxonomy.admin.inc15
1 files changed, 12 insertions, 3 deletions
diff --git a/modules/taxonomy/taxonomy.admin.inc b/modules/taxonomy/taxonomy.admin.inc
index 1631d30b4..90ff0168d 100644
--- a/modules/taxonomy/taxonomy.admin.inc
+++ b/modules/taxonomy/taxonomy.admin.inc
@@ -113,6 +113,10 @@ function taxonomy_form_vocabulary(&$form_state, $edit = array()) {
'required' => 0,
'weight' => 0,
);
+ // Check whether we need a deletion confirmation form.
+ if (isset($form_state['confirm_delete']) && isset($form_state['values']['vid'])) {
+ return taxonomy_vocabulary_confirm_delete($form_state, $form_state['values']['vid']);
+ }
$form['identification'] = array(
'#type' => 'fieldset',
'#title' => t('Identification'),
@@ -195,6 +199,12 @@ function taxonomy_form_vocabulary(&$form_state, $edit = array()) {
* Accept the form submission for a vocabulary and save the results.
*/
function taxonomy_form_vocabulary_submit($form, &$form_state) {
+ if ($form_state['clicked_button']['#value'] == t('Delete')) {
+ // Rebuild the form to confirm vocabulary deletion.
+ $form_state['rebuild'] = TRUE;
+ $form_state['confirm_delete'] = TRUE;
+ return;
+ }
// Fix up the nodes array to remove unchecked nodes.
$form_state['values']['nodes'] = array_filter($form_state['values']['nodes']);
switch (taxonomy_save_vocabulary($form_state['values'])) {
@@ -217,9 +227,6 @@ function taxonomy_form_vocabulary_submit($form, &$form_state) {
* Page to edit a vocabulary.
*/
function taxonomy_admin_vocabulary_edit($vocabulary) {
- if ((isset($_POST['op']) && $_POST['op'] == t('Delete')) || isset($_POST['confirm'])) {
- return drupal_get_form('taxonomy_vocabulary_confirm_delete', $vocabulary->vid);
- }
return drupal_get_form('taxonomy_form_vocabulary', (array)$vocabulary);
}
@@ -866,9 +873,11 @@ function taxonomy_term_confirm_delete_submit($form, &$form_state) {
function taxonomy_vocabulary_confirm_delete(&$form_state, $vid) {
$vocabulary = taxonomy_vocabulary_load($vid);
+ $form['#id'] = 'taxonomy_vocabulary_confirm_delete';
$form['type'] = array('#type' => 'value', '#value' => 'vocabulary');
$form['vid'] = array('#type' => 'value', '#value' => $vid);
$form['name'] = array('#type' => 'value', '#value' => $vocabulary->name);
+ $form['#submit'] = array('taxonomy_vocabulary_confirm_delete_submit');
return confirm_form($form,
t('Are you sure you want to delete the vocabulary %title?',
array('%title' => $vocabulary->name)),