diff --git a/core/modules/taxonomy/taxonomy.admin.inc b/core/modules/taxonomy/taxonomy.admin.inc index 2b7bb7a..8d6d9ae 100644 --- a/core/modules/taxonomy/taxonomy.admin.inc +++ b/core/modules/taxonomy/taxonomy.admin.inc @@ -36,11 +36,6 @@ function taxonomy_vocabulary_add() { function taxonomy_overview_terms($form, &$form_state, Vocabulary $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->id()); - } - $form_state['taxonomy']['vocabulary'] = $vocabulary; $parent_fields = FALSE; @@ -282,8 +277,7 @@ function taxonomy_overview_terms($form, &$form_state, Vocabulary $vocabulary) { '#button_type' => 'primary', ); $form['actions']['reset_alphabetical'] = array( - '#type' => 'submit', - '#value' => t('Reset to alphabetical') + '#markup' => l(t('Reset to alphabetical'), 'admin/structure/taxonomy/reset/' . $vocabulary->id()), ); $form_state['redirect'] = array(current_path(), (isset($_GET['page']) ? array('query' => array('page' => $_GET['page'])) : array())); } @@ -308,10 +302,6 @@ function taxonomy_overview_terms($form, &$form_state, Vocabulary $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; @@ -403,12 +393,10 @@ function taxonomy_overview_terms_submit($form, &$form_state) { * @ingroup forms * @see taxonomy_vocabulary_confirm_reset_alphabetical_submit() */ -function taxonomy_vocabulary_confirm_reset_alphabetical($form, &$form_state, $vid) { - $vocabulary = entity_load('taxonomy_vocabulary', $vid); - +function taxonomy_reset_terms($form, &$form_state, Drupal\taxonomy\Plugin\Core\Entity\Vocabulary $vocabulary) { $form['type'] = array('#type' => 'value', '#value' => 'vocabulary'); - $form['vid'] = array('#type' => 'value', '#value' => $vid); - $form['name'] = array('#type' => 'value', '#value' => $vocabulary->name); + $form['vid'] = array('#type' => 'value', '#value' => $vocabulary->id()); + $form['name'] = array('#type' => 'value', '#value' => $vocabulary->label()); $form['reset_alphabetical'] = array('#type' => 'value', '#value' => TRUE); return confirm_form($form, t('Are you sure you want to reset the vocabulary %title to alphabetical order?', @@ -424,7 +412,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_reset_terms_submit($form, &$form_state) { db_update('taxonomy_term_data') ->fields(array('weight' => 0)) ->condition('vid', $form_state['values']['vid']) diff --git a/core/modules/taxonomy/taxonomy.module b/core/modules/taxonomy/taxonomy.module index 2167270..e92b27d 100644 --- a/core/modules/taxonomy/taxonomy.module +++ b/core/modules/taxonomy/taxonomy.module @@ -310,10 +310,22 @@ function taxonomy_menu() { 'access arguments' => array(4, 'view'), 'file' => 'taxonomy.admin.inc', ); + + $items['admin/structure/taxonomy/reset/%taxonomy_vocabulary'] = array( + 'title callback' => 'entity_page_label', + 'title arguments' => array(4), + 'page callback' => 'drupal_get_form', + 'page arguments' => array('taxonomy_reset_terms', 4), + 'access callback' => 'entity_page_access', + 'access arguments' => array(4, 'edit'), + 'file' => 'taxonomy.admin.inc', + ); + $items['admin/structure/taxonomy/manage/%taxonomy_vocabulary/list'] = array( 'title' => 'List', 'type' => MENU_DEFAULT_LOCAL_TASK, ); + $items['admin/structure/taxonomy/manage/%taxonomy_vocabulary/edit'] = array( 'title' => 'Edit', 'page callback' => 'entity_get_form', @@ -323,6 +335,7 @@ function taxonomy_menu() { 'type' => MENU_LOCAL_TASK, 'file' => 'taxonomy.admin.inc', ); + $items['admin/structure/taxonomy/%taxonomy_vocabulary/delete'] = array( 'title' => 'Delete', 'type' => MENU_LOCAL_TASK,