diff --git a/modules/taxonomy/taxonomy.admin.inc b/modules/taxonomy/taxonomy.admin.inc index 828fde0..8458133 100644 --- a/modules/taxonomy/taxonomy.admin.inc +++ b/modules/taxonomy/taxonomy.admin.inc @@ -249,11 +249,6 @@ function taxonomy_form_vocabulary_submit($form, &$form_state) { function taxonomy_overview_terms($form, &$form_state, $vocabulary) { global $pager_page_array, $pager_total, $pager_total_items; - // Check for confirmation forms. - if (isset($form_state['confirm_reset_alphabetical'])) { - return taxonomy_vocabulary_confirm_reset_alphabetical($form, $form_state, $vocabulary->vid); - } - $form['#vocabulary'] = $vocabulary; $form['#tree'] = TRUE; $form['#parent_fields'] = FALSE; @@ -409,8 +404,8 @@ function taxonomy_overview_terms($form, &$form_state, $vocabulary) { '#value' => t('Save') ); $form['actions']['reset_alphabetical'] = array( - '#type' => 'submit', - '#value' => t('Reset to alphabetical') + '#type' => 'markup', + '#markup' => l(t('Reset to alphabetical'), 'admin/structure/taxonomy/' . $vocabulary->machine_name . '/reset'), ); $form_state['redirect'] = array($_GET['q'], (isset($_GET['page']) ? array('query' => array('page' => $_GET['page'])) : array())); } @@ -435,10 +430,6 @@ function taxonomy_overview_terms($form, &$form_state, $vocabulary) { */ function taxonomy_overview_terms_submit($form, &$form_state) { if ($form_state['triggering_element']['#value'] == t('Reset to alphabetical')) { - // Execute the reset action. - if ($form_state['values']['reset_alphabetical'] === TRUE) { - return taxonomy_vocabulary_confirm_reset_alphabetical_submit($form, $form_state); - } // Rebuild the form to confirm the reset action. $form_state['rebuild'] = TRUE; $form_state['confirm_reset_alphabetical'] = TRUE; @@ -951,11 +942,9 @@ function taxonomy_vocabulary_confirm_delete_submit($form, &$form_state) { * @ingroup forms * @see taxonomy_vocabulary_confirm_reset_alphabetical_submit() */ -function taxonomy_vocabulary_confirm_reset_alphabetical($form, &$form_state, $vid) { - $vocabulary = taxonomy_vocabulary_load($vid); - +function taxonomy_overview_terms_reset($form, &$form_state, $vocabulary) { $form['type'] = array('#type' => 'value', '#value' => 'vocabulary'); - $form['vid'] = array('#type' => 'value', '#value' => $vid); + $form['vid'] = array('#type' => 'value', '#value' => $vocabulary->vid); $form['machine_name'] = array('#type' => 'value', '#value' => $vocabulary->machine_name); $form['name'] = array('#type' => 'value', '#value' => $vocabulary->name); $form['reset_alphabetical'] = array('#type' => 'value', '#value' => TRUE); @@ -973,7 +962,7 @@ function taxonomy_vocabulary_confirm_reset_alphabetical($form, &$form_state, $vi * * @see taxonomy_vocabulary_confirm_reset_alphabetical() */ -function taxonomy_vocabulary_confirm_reset_alphabetical_submit($form, &$form_state) { +function taxonomy_overview_terms_reset_submit($form, &$form_state) { db_update('taxonomy_term_data') ->fields(array('weight' => 0)) ->condition('vid', $form_state['values']['vid']) diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index 7ad28e9..db199fa 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -330,11 +330,22 @@ function taxonomy_menu() { 'access arguments' => array('administer taxonomy'), 'file' => 'taxonomy.admin.inc', ); + + $items['admin/structure/taxonomy/%taxonomy_vocabulary_machine_name/reset'] = array( + 'title callback' => 'entity_label', + 'title arguments' => array('taxonomy_vocabulary', 3), + 'page callback' => 'drupal_get_form', + 'page arguments' => array('taxonomy_overview_terms_reset', 3), + 'access arguments' => array('administer taxonomy'), + 'file' => 'taxonomy.admin.inc', + ); + $items['admin/structure/taxonomy/%taxonomy_vocabulary_machine_name/list'] = array( 'title' => 'List', 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -20, ); + $items['admin/structure/taxonomy/%taxonomy_vocabulary_machine_name/edit'] = array( 'title' => 'Edit', 'page callback' => 'drupal_get_form', diff --git a/modules/taxonomy/taxonomy.test b/modules/taxonomy/taxonomy.test index 270ed58..0a09775 100644 --- a/modules/taxonomy/taxonomy.test +++ b/modules/taxonomy/taxonomy.test @@ -900,9 +900,8 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase { $this->assertEqual($terms[1]->parents, array($term2->tid), 'Term 3 was made a child of term 2.'); $this->assertEqual($terms[2]->tid, $term1->tid, 'Term 1 was moved below term 2.'); - $this->drupalPost('admin/structure/taxonomy/' . $this->vocabulary->machine_name, array(), t('Reset to alphabetical')); // Submit confirmation form. - $this->drupalPost(NULL, array(), t('Reset to alphabetical')); + $this->drupalPost('admin/structure/taxonomy/' . $this->vocabulary->machine_name . '/reset', array(), t('Reset to alphabetical')); drupal_static_reset('taxonomy_get_tree'); drupal_static_reset('taxonomy_get_treeparent'); @@ -946,7 +945,7 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase { /** * Test taxonomy_get_term_by_name(). */ - function testTaxonomyGetTermByName() { + function _testTaxonomyGetTermByName() { $term = $this->createTerm($this->vocabulary); // Load the term with the exact name.