diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/TermFormController.php b/core/modules/taxonomy/lib/Drupal/taxonomy/TermFormController.php index 0c92528..1b30369 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/TermFormController.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/TermFormController.php @@ -9,6 +9,8 @@ use Drupal\Core\Entity\EntityFormControllerNG; use Drupal\Core\Language\Language; +use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\HttpFoundation\Request; /** * Base for controller for taxonomy term edit forms. @@ -16,9 +18,17 @@ class TermFormController extends EntityFormControllerNG { /** + * The current request. + * + * @var \Symfony\Component\HttpFoundation\Request + */ + protected $request; + + /** * Overrides Drupal\Core\Entity\EntityFormController::form(). */ - public function form(array $form, array &$form_state) { + public function form(array $form, array &$form_state, Request $request = NULL) { + $this->request = $request; $term = $this->entity; $vocabulary = entity_load('taxonomy_vocabulary', $term->bundle()); @@ -199,9 +209,8 @@ public function save(array $form, array &$form_state) { */ public function delete(array $form, array &$form_state) { $destination = array(); - if (isset($_GET['destination'])) { + if ($this->request->query->has('destination')) { $destination = drupal_get_destination(); - unset($_GET['destination']); } $form_state['redirect'] = array('taxonomy/term/' . $this->entity->id() . '/delete', array('query' => $destination)); } diff --git a/core/modules/taxonomy/taxonomy.admin.inc b/core/modules/taxonomy/taxonomy.admin.inc index 4e7c5c2..fc958ae 100644 --- a/core/modules/taxonomy/taxonomy.admin.inc +++ b/core/modules/taxonomy/taxonomy.admin.inc @@ -38,7 +38,7 @@ function taxonomy_overview_terms($form, &$form_state, Vocabulary $vocabulary) { $form_state['taxonomy']['vocabulary'] = $vocabulary; $parent_fields = FALSE; - $page = isset($_GET['page']) ? $_GET['page'] : 0; + $page = Drupal::request()->query->get('page', 0); $page_increment = Drupal::config('taxonomy.settings')->get('terms_per_page_admin'); $page_entries = 0; $before_entries = 0; @@ -282,7 +282,12 @@ function taxonomy_overview_terms($form, &$form_state, Vocabulary $vocabulary) { '#type' => 'submit', '#value' => t('Reset to alphabetical') ); - $form_state['redirect'] = array(current_path(), (isset($_GET['page']) ? array('query' => array('page' => $_GET['page'])) : array())); + + $options = array(); + if ($page = Drupal::request()->query->get('page')) { + $options['query'] = array('page' => $page); + } + $form_state['redirect'] = array(current_path(), $options); } return $form; diff --git a/core/modules/taxonomy/taxonomy.module b/core/modules/taxonomy/taxonomy.module index 0bfa84d..ef81e73 100644 --- a/core/modules/taxonomy/taxonomy.module +++ b/core/modules/taxonomy/taxonomy.module @@ -265,14 +265,10 @@ function taxonomy_menu() { ); $items['taxonomy/term/%taxonomy_term/edit'] = array( 'title' => 'Edit', - 'page callback' => 'entity_get_form', - 'page arguments' => array(2, 'default', array()), - 'access callback' => 'entity_page_access', - 'access arguments' => array(2, 'update'), + 'route_name' => 'taxonomy_term_edit', 'type' => MENU_LOCAL_TASK, 'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE, 'weight' => 10, - 'file' => 'taxonomy.admin.inc', ); $items['taxonomy/term/%taxonomy_term/delete'] = array( 'title' => 'Delete', diff --git a/core/modules/taxonomy/taxonomy.routing.yml b/core/modules/taxonomy/taxonomy.routing.yml index 09dc6d0..fbdf7c4 100644 --- a/core/modules/taxonomy/taxonomy.routing.yml +++ b/core/modules/taxonomy/taxonomy.routing.yml @@ -12,6 +12,13 @@ taxonomy_term_add: requirements: _access_taxonomy_term_create: 'taxonomy_term' +taxonomy_term_edit: + pattern: 'taxonomy/term/{taxonomy_term}/edit' + defaults: + _entity_form: 'taxonomy_term.default' + requirements: + _entity_access: 'taxonomy_term.update' + taxonomy_term_delete: pattern: '/taxonomy/term/{taxonomy_term}/delete' defaults: