Commit 92ff3876 authored by alexpott's avatar alexpott

Issue #2291833 by andypost, kgoel | Crell: Standardize taxonomy term entity route names.

parent f5b0b26e
...@@ -246,7 +246,11 @@ function testBreadCrumbs() { ...@@ -246,7 +246,11 @@ function testBreadCrumbs() {
'enabled[value]' => 1, 'enabled[value]' => 1,
); );
$this->drupalPostForm("admin/structure/menu/manage/$menu/add", $edit, t('Save')); $this->drupalPostForm("admin/structure/menu/manage/$menu/add", $edit, t('Save'));
$menu_links = entity_load_multiple_by_properties('menu_link_content', array('title' => $edit['title[0][value]'], 'route_name' => 'taxonomy.term_page', 'route_parameters' => serialize(array('taxonomy_term' => $term->id())))); $menu_links = entity_load_multiple_by_properties('menu_link_content', array(
'title' => $edit['title[0][value]'],
'route_name' => 'entity.taxonomy_term.canonical',
'route_parameters' => serialize(array('taxonomy_term' => $term->id())),
));
$tags[$name]['link'] = reset($menu_links); $tags[$name]['link'] = reset($menu_links);
$parent_mlid = $tags[$name]['link']->getPluginId(); $parent_mlid = $tags[$name]['link']->getPluginId();
} }
......
...@@ -43,11 +43,11 @@ ...@@ -43,11 +43,11 @@
* "uuid" = "uuid" * "uuid" = "uuid"
* }, * },
* bundle_entity_type = "taxonomy_vocabulary", * bundle_entity_type = "taxonomy_vocabulary",
* field_ui_base_route = "taxonomy.overview_terms", * field_ui_base_route = "entity.taxonomy_vocabulary.overview_form",
* links = { * links = {
* "canonical" = "taxonomy.term_page", * "canonical" = "entity.taxonomy_term.canonical",
* "delete-form" = "taxonomy.term_delete", * "delete-form" = "entity.taxonomy_term.delete_form",
* "edit-form" = "taxonomy.term_edit", * "edit-form" = "entity.taxonomy_term.edit_form",
* }, * },
* permission_granularity = "bundle" * permission_granularity = "bundle"
* ) * )
......
...@@ -35,11 +35,11 @@ ...@@ -35,11 +35,11 @@
* "weight" = "weight" * "weight" = "weight"
* }, * },
* links = { * links = {
* "add-form" = "taxonomy.term_add", * "add-form" = "entity.taxonomy_term.add_form",
* "delete-form" = "taxonomy.vocabulary_delete", * "delete-form" = "entity.taxonomy_vocabulary.delete_form",
* "reset" = "taxonomy.vocabulary_reset", * "reset-form" = "entity.taxonomy_vocabulary.reset_form",
* "overview-form" = "taxonomy.overview_terms", * "overview-form" = "entity.taxonomy_vocabulary.overview_form",
* "edit-form" = "taxonomy.vocabulary_edit" * "edit-form" = "entity.taxonomy_vocabulary.edit_form"
* } * }
* ) * )
*/ */
......
...@@ -195,7 +195,7 @@ public function buildForm(array $form, FormStateInterface $form_state, Vocabular ...@@ -195,7 +195,7 @@ public function buildForm(array $form, FormStateInterface $form_state, Vocabular
$form['terms'] = array( $form['terms'] = array(
'#type' => 'table', '#type' => 'table',
'#header' => array($this->t('Name'), $this->t('Weight'), $this->t('Operations')), '#header' => array($this->t('Name'), $this->t('Weight'), $this->t('Operations')),
'#empty' => $this->t('No terms available. <a href="@link">Add term</a>.', array('@link' => $this->url('taxonomy.term_add', array('taxonomy_vocabulary' => $taxonomy_vocabulary->id())))), '#empty' => $this->t('No terms available. <a href="@link">Add term</a>.', array('@link' => $this->url('entity.taxonomy_term.add_form', array('taxonomy_vocabulary' => $taxonomy_vocabulary->id())))),
'#attributes' => array( '#attributes' => array(
'id' => 'taxonomy', 'id' => 'taxonomy',
), ),
...@@ -452,7 +452,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { ...@@ -452,7 +452,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
public function submitReset(array &$form, FormStateInterface $form_state) { public function submitReset(array &$form, FormStateInterface $form_state) {
/** @var $vocabulary \Drupal\taxonomy\VocabularyInterface */ /** @var $vocabulary \Drupal\taxonomy\VocabularyInterface */
$vocabulary = $form_state['taxonomy']['vocabulary']; $vocabulary = $form_state['taxonomy']['vocabulary'];
$form_state->setRedirectUrl($vocabulary->urlInfo('reset')); $form_state->setRedirectUrl($vocabulary->urlInfo('reset-form'));
} }
} }
...@@ -85,7 +85,7 @@ public function save(array $form, FormStateInterface $form_state) { ...@@ -85,7 +85,7 @@ public function save(array $form, FormStateInterface $form_state) {
$this->termStorage->resetWeights($this->entity->id()); $this->termStorage->resetWeights($this->entity->id());
drupal_set_message($this->t('Reset vocabulary %name to alphabetical order.', array('%name' => $this->entity->label()))); drupal_set_message($this->t('Reset vocabulary %name to alphabetical order.', array('%name' => $this->entity->label())));
$this->logger('taxonomy')->notice('Reset vocabulary %name to alphabetical order.', array('%name' => $this->entity->label())); $this->logger('taxonomy')->notice('Reset vocabulary %name to alphabetical order.', array('%name' => $this->entity->label()));
$form_state->setRedirectUrl($this->entity->urlInfo('edit-form')); $form_state->setRedirectUrl($this->getCancelUrl());
} }
} }
...@@ -23,7 +23,7 @@ class TermBreadcrumbBuilder implements BreadcrumbBuilderInterface { ...@@ -23,7 +23,7 @@ class TermBreadcrumbBuilder implements BreadcrumbBuilderInterface {
* {@inheritdoc} * {@inheritdoc}
*/ */
public function applies(RouteMatchInterface $route_match) { public function applies(RouteMatchInterface $route_match) {
return $route_match->getRouteName() == 'taxonomy.term_page' return $route_match->getRouteName() == 'entity.taxonomy_term.canonical'
&& $route_match->getParameter('taxonomy_term') instanceof TermInterface; && $route_match->getParameter('taxonomy_term') instanceof TermInterface;
} }
...@@ -38,7 +38,7 @@ public function build(RouteMatchInterface $route_match) { ...@@ -38,7 +38,7 @@ public function build(RouteMatchInterface $route_match) {
$breadcrumb = array(); $breadcrumb = array();
while ($parents = taxonomy_term_load_parents($term->id())) { while ($parents = taxonomy_term_load_parents($term->id())) {
$term = array_shift($parents); $term = array_shift($parents);
$breadcrumb[] = $this->l($term->getName(), 'taxonomy.term_page', array('taxonomy_term' => $term->id())); $breadcrumb[] = $this->l($term->getName(), 'entity.taxonomy_term.canonical', array('taxonomy_term' => $term->id()));
} }
$breadcrumb[] = $this->l($this->t('Home'), '<front>'); $breadcrumb[] = $this->l($this->t('Home'), '<front>');
$breadcrumb = array_reverse($breadcrumb); $breadcrumb = array_reverse($breadcrumb);
......
...@@ -470,6 +470,8 @@ function testTermReorder() { ...@@ -470,6 +470,8 @@ function testTermReorder() {
$this->drupalPostForm('admin/structure/taxonomy/manage/' . $this->vocabulary->id() . '/overview', array(), t('Reset to alphabetical')); $this->drupalPostForm('admin/structure/taxonomy/manage/' . $this->vocabulary->id() . '/overview', array(), t('Reset to alphabetical'));
// Submit confirmation form. // Submit confirmation form.
$this->drupalPostForm(NULL, array(), t('Reset to alphabetical')); $this->drupalPostForm(NULL, array(), t('Reset to alphabetical'));
// Ensure form redirected back to overview.
$this->assertUrl('admin/structure/taxonomy/manage/' . $this->vocabulary->id() . '/overview');
drupal_static_reset('taxonomy_get_tree'); drupal_static_reset('taxonomy_get_tree');
drupal_static_reset('taxonomy_get_treeparent'); drupal_static_reset('taxonomy_get_treeparent');
......
taxonomy_add_vocabulary_local_action: entity.taxonomy_vocabulary.add_form:
route_name: taxonomy.vocabulary_add route_name: entity.taxonomy_vocabulary.add_form
title: 'Add vocabulary' title: 'Add vocabulary'
appears_on: appears_on:
- taxonomy.vocabulary_list - taxonomy.vocabulary_list
taxonomy.term_add: entity.taxonomy_term.add_form:
route_name: taxonomy.term_add route_name: entity.taxonomy_term.add_form
title: 'Add term' title: 'Add term'
appears_on: appears_on:
- taxonomy.overview_terms - entity.taxonomy_vocabulary.overview_form
taxonomy.term_edit: entity.taxonomy_term.edit_form:
title: Edit title: Edit
group: taxonomy_term group: taxonomy_term
route_name: taxonomy.term_edit route_name: entity.taxonomy_term.edit_form
weight: 10 weight: 10
taxonomy.term_delete: entity.taxonomy_term.delete_form:
title: Delete title: Delete
group: taxonomy_term group: taxonomy_term
route_name: taxonomy.term_delete route_name: entity.taxonomy_term.delete_form
weight: 20 weight: 20
taxonomy.vocabulary_delete: entity.taxonomy_vocabulary.delete_form:
title: Delete title: Delete
group: taxonomy_vocabulary group: taxonomy_vocabulary
route_name: taxonomy.vocabulary_delete route_name: entity.taxonomy_vocabulary.delete_form
weight: 20 weight: 20
taxonomy.term_page: entity.taxonomy_term.canonical:
title: 'View' title: 'View'
route_name: taxonomy.term_page route_name: entity.taxonomy_term.canonical
base_route: taxonomy.term_page base_route: entity.taxonomy_term.canonical
taxonomy.term_edit: entity.taxonomy_term.edit_form:
title: 'Edit' title: 'Edit'
route_name: taxonomy.term_edit route_name: entity.taxonomy_term.edit_form
base_route: taxonomy.term_page base_route: entity.taxonomy_term.canonical
taxonomy.overview_terms: entity.taxonomy_vocabulary.overview_form:
title: 'List' title: 'List'
route_name: taxonomy.overview_terms route_name: entity.taxonomy_vocabulary.overview_form
base_route: taxonomy.overview_terms base_route: entity.taxonomy_vocabulary.overview_form
taxonomy.vocabulary_edit:
entity.taxonomy_vocabulary.edit_form:
title: 'Edit' title: 'Edit'
route_name: taxonomy.vocabulary_edit route_name: entity.taxonomy_vocabulary.edit_form
base_route: taxonomy.overview_terms base_route: entity.taxonomy_vocabulary.overview_form
...@@ -79,7 +79,7 @@ function taxonomy_help($route_name, RouteMatchInterface $route_match) { ...@@ -79,7 +79,7 @@ function taxonomy_help($route_name, RouteMatchInterface $route_match) {
$output = '<p>' . t('Taxonomy is for categorizing content. Terms are grouped into vocabularies. For example, a vocabulary called "Fruit" would contain the terms "Apple" and "Banana".') . '</p>'; $output = '<p>' . t('Taxonomy is for categorizing content. Terms are grouped into vocabularies. For example, a vocabulary called "Fruit" would contain the terms "Apple" and "Banana".') . '</p>';
return $output; return $output;
case 'taxonomy.overview_terms': case 'entity.taxonomy_vocabulary.overview_form':
$vocabulary = $route_match->getParameter('taxonomy_vocabulary'); $vocabulary = $route_match->getParameter('taxonomy_vocabulary');
switch ($vocabulary->hierarchy) { switch ($vocabulary->hierarchy) {
case TAXONOMY_HIERARCHY_DISABLED: case TAXONOMY_HIERARCHY_DISABLED:
...@@ -120,7 +120,7 @@ function taxonomy_permission() { ...@@ -120,7 +120,7 @@ function taxonomy_permission() {
* Entity URI callback. * Entity URI callback.
*/ */
function taxonomy_term_uri($term) { function taxonomy_term_uri($term) {
return new Url('taxonomy.term_page', array( return new Url('entity.taxonomy_term.canonical', array(
'taxonomy_term' => $term->id(), 'taxonomy_term' => $term->id(),
)); ));
} }
......
...@@ -6,7 +6,7 @@ taxonomy.vocabulary_list: ...@@ -6,7 +6,7 @@ taxonomy.vocabulary_list:
requirements: requirements:
_permission: 'administer taxonomy' _permission: 'administer taxonomy'
taxonomy.term_add: entity.taxonomy_term.add_form:
path: '/admin/structure/taxonomy/manage/{taxonomy_vocabulary}/add' path: '/admin/structure/taxonomy/manage/{taxonomy_vocabulary}/add'
defaults: defaults:
_content: '\Drupal\taxonomy\Controller\TaxonomyController::addForm' _content: '\Drupal\taxonomy\Controller\TaxonomyController::addForm'
...@@ -14,7 +14,7 @@ taxonomy.term_add: ...@@ -14,7 +14,7 @@ taxonomy.term_add:
requirements: requirements:
_entity_create_access: 'taxonomy_term:{taxonomy_vocabulary}' _entity_create_access: 'taxonomy_term:{taxonomy_vocabulary}'
taxonomy.term_edit: entity.taxonomy_term.edit_form:
path: '/taxonomy/term/{taxonomy_term}/edit' path: '/taxonomy/term/{taxonomy_term}/edit'
defaults: defaults:
_entity_form: 'taxonomy_term.default' _entity_form: 'taxonomy_term.default'
...@@ -24,7 +24,7 @@ taxonomy.term_edit: ...@@ -24,7 +24,7 @@ taxonomy.term_edit:
requirements: requirements:
_entity_access: 'taxonomy_term.update' _entity_access: 'taxonomy_term.update'
taxonomy.term_delete: entity.taxonomy_term.delete_form:
path: '/taxonomy/term/{taxonomy_term}/delete' path: '/taxonomy/term/{taxonomy_term}/delete'
defaults: defaults:
_entity_form: 'taxonomy_term.delete' _entity_form: 'taxonomy_term.delete'
...@@ -34,7 +34,7 @@ taxonomy.term_delete: ...@@ -34,7 +34,7 @@ taxonomy.term_delete:
requirements: requirements:
_entity_access: 'taxonomy_term.delete' _entity_access: 'taxonomy_term.delete'
taxonomy.vocabulary_add: entity.taxonomy_vocabulary.add_form:
path: '/admin/structure/taxonomy/add' path: '/admin/structure/taxonomy/add'
defaults: defaults:
_entity_form: 'taxonomy_vocabulary' _entity_form: 'taxonomy_vocabulary'
...@@ -42,7 +42,7 @@ taxonomy.vocabulary_add: ...@@ -42,7 +42,7 @@ taxonomy.vocabulary_add:
requirements: requirements:
_entity_create_access: 'taxonomy_vocabulary' _entity_create_access: 'taxonomy_vocabulary'
taxonomy.vocabulary_edit: entity.taxonomy_vocabulary.edit_form:
path: '/admin/structure/taxonomy/manage/{taxonomy_vocabulary}' path: '/admin/structure/taxonomy/manage/{taxonomy_vocabulary}'
defaults: defaults:
_entity_form: 'taxonomy_vocabulary.default' _entity_form: 'taxonomy_vocabulary.default'
...@@ -50,7 +50,7 @@ taxonomy.vocabulary_edit: ...@@ -50,7 +50,7 @@ taxonomy.vocabulary_edit:
requirements: requirements:
_entity_access: 'taxonomy_vocabulary.update' _entity_access: 'taxonomy_vocabulary.update'
taxonomy.vocabulary_delete: entity.taxonomy_vocabulary.delete_form:
path: '/admin/structure/taxonomy/manage/{taxonomy_vocabulary}/delete' path: '/admin/structure/taxonomy/manage/{taxonomy_vocabulary}/delete'
defaults: defaults:
_entity_form: 'taxonomy_vocabulary.delete' _entity_form: 'taxonomy_vocabulary.delete'
...@@ -58,7 +58,7 @@ taxonomy.vocabulary_delete: ...@@ -58,7 +58,7 @@ taxonomy.vocabulary_delete:
requirements: requirements:
_entity_access: 'taxonomy_vocabulary.delete' _entity_access: 'taxonomy_vocabulary.delete'
taxonomy.vocabulary_reset: entity.taxonomy_vocabulary.reset_form:
path: '/admin/structure/taxonomy/manage/{taxonomy_vocabulary}/reset' path: '/admin/structure/taxonomy/manage/{taxonomy_vocabulary}/reset'
defaults: defaults:
_entity_form: 'taxonomy_vocabulary.reset' _entity_form: 'taxonomy_vocabulary.reset'
...@@ -80,7 +80,7 @@ taxonomy.autocomplete_vid: ...@@ -80,7 +80,7 @@ taxonomy.autocomplete_vid:
requirements: requirements:
_permission: 'access content' _permission: 'access content'
taxonomy.overview_terms: entity.taxonomy_vocabulary.overview_form:
path: '/admin/structure/taxonomy/manage/{taxonomy_vocabulary}/overview' path: '/admin/structure/taxonomy/manage/{taxonomy_vocabulary}/overview'
defaults: defaults:
_form: 'Drupal\taxonomy\Form\OverviewTerms' _form: 'Drupal\taxonomy\Form\OverviewTerms'
...@@ -88,7 +88,7 @@ taxonomy.overview_terms: ...@@ -88,7 +88,7 @@ taxonomy.overview_terms:
requirements: requirements:
_entity_access: 'taxonomy_vocabulary.view' _entity_access: 'taxonomy_vocabulary.view'
taxonomy.term_page: entity.taxonomy_term.canonical:
path: '/taxonomy/term/{taxonomy_term}' path: '/taxonomy/term/{taxonomy_term}'
defaults: defaults:
_content: '\Drupal\taxonomy\Controller\TaxonomyController::termPage' _content: '\Drupal\taxonomy\Controller\TaxonomyController::termPage'
......
...@@ -28,7 +28,7 @@ protected function setUp() { ...@@ -28,7 +28,7 @@ protected function setUp() {
*/ */
public function testTaxonomyPageLocalTasks($route, $subtask = array()) { public function testTaxonomyPageLocalTasks($route, $subtask = array()) {
$tasks = array( $tasks = array(
0 => array('taxonomy.term_page', 'taxonomy.term_edit'), 0 => array('entity.taxonomy_term.canonical', 'entity.taxonomy_term.edit_form'),
); );
if ($subtask) $tasks[] = $subtask; if ($subtask) $tasks[] = $subtask;
$this->assertLocalTasks($route, $tasks); $this->assertLocalTasks($route, $tasks);
...@@ -39,8 +39,8 @@ public function testTaxonomyPageLocalTasks($route, $subtask = array()) { ...@@ -39,8 +39,8 @@ public function testTaxonomyPageLocalTasks($route, $subtask = array()) {
*/ */
public function getTaxonomyPageRoutes() { public function getTaxonomyPageRoutes() {
return array( return array(
array('taxonomy.term_page'), array('entity.taxonomy_term.canonical'),
array('taxonomy.term_edit'), array('entity.taxonomy_term.edit_form'),
); );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment