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() {
'enabled[value]' => 1,
);
$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);
$parent_mlid = $tags[$name]['link']->getPluginId();
}
......
......@@ -43,11 +43,11 @@
* "uuid" = "uuid"
* },
* bundle_entity_type = "taxonomy_vocabulary",
* field_ui_base_route = "taxonomy.overview_terms",
* field_ui_base_route = "entity.taxonomy_vocabulary.overview_form",
* links = {
* "canonical" = "taxonomy.term_page",
* "delete-form" = "taxonomy.term_delete",
* "edit-form" = "taxonomy.term_edit",
* "canonical" = "entity.taxonomy_term.canonical",
* "delete-form" = "entity.taxonomy_term.delete_form",
* "edit-form" = "entity.taxonomy_term.edit_form",
* },
* permission_granularity = "bundle"
* )
......
......@@ -35,11 +35,11 @@
* "weight" = "weight"
* },
* links = {
* "add-form" = "taxonomy.term_add",
* "delete-form" = "taxonomy.vocabulary_delete",
* "reset" = "taxonomy.vocabulary_reset",
* "overview-form" = "taxonomy.overview_terms",
* "edit-form" = "taxonomy.vocabulary_edit"
* "add-form" = "entity.taxonomy_term.add_form",
* "delete-form" = "entity.taxonomy_vocabulary.delete_form",
* "reset-form" = "entity.taxonomy_vocabulary.reset_form",
* "overview-form" = "entity.taxonomy_vocabulary.overview_form",
* "edit-form" = "entity.taxonomy_vocabulary.edit_form"
* }
* )
*/
......
......@@ -195,7 +195,7 @@ public function buildForm(array $form, FormStateInterface $form_state, Vocabular
$form['terms'] = array(
'#type' => 'table',
'#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(
'id' => 'taxonomy',
),
......@@ -452,7 +452,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
public function submitReset(array &$form, FormStateInterface $form_state) {
/** @var $vocabulary \Drupal\taxonomy\VocabularyInterface */
$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) {
$this->termStorage->resetWeights($this->entity->id());
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()));
$form_state->setRedirectUrl($this->entity->urlInfo('edit-form'));
$form_state->setRedirectUrl($this->getCancelUrl());
}
}
......@@ -23,7 +23,7 @@ class TermBreadcrumbBuilder implements BreadcrumbBuilderInterface {
* {@inheritdoc}
*/
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;
}
......@@ -38,7 +38,7 @@ public function build(RouteMatchInterface $route_match) {
$breadcrumb = array();
while ($parents = taxonomy_term_load_parents($term->id())) {
$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 = array_reverse($breadcrumb);
......
......@@ -470,6 +470,8 @@ function testTermReorder() {
$this->drupalPostForm('admin/structure/taxonomy/manage/' . $this->vocabulary->id() . '/overview', array(), t('Reset to alphabetical'));
// Submit confirmation form.
$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_treeparent');
......
taxonomy_add_vocabulary_local_action:
route_name: taxonomy.vocabulary_add
entity.taxonomy_vocabulary.add_form:
route_name: entity.taxonomy_vocabulary.add_form
title: 'Add vocabulary'
appears_on:
- taxonomy.vocabulary_list
taxonomy.term_add:
route_name: taxonomy.term_add
entity.taxonomy_term.add_form:
route_name: entity.taxonomy_term.add_form
title: 'Add term'
appears_on:
- taxonomy.overview_terms
- entity.taxonomy_vocabulary.overview_form
taxonomy.term_edit:
entity.taxonomy_term.edit_form:
title: Edit
group: taxonomy_term
route_name: taxonomy.term_edit
route_name: entity.taxonomy_term.edit_form
weight: 10
taxonomy.term_delete:
entity.taxonomy_term.delete_form:
title: Delete
group: taxonomy_term
route_name: taxonomy.term_delete
route_name: entity.taxonomy_term.delete_form
weight: 20
taxonomy.vocabulary_delete:
entity.taxonomy_vocabulary.delete_form:
title: Delete
group: taxonomy_vocabulary
route_name: taxonomy.vocabulary_delete
route_name: entity.taxonomy_vocabulary.delete_form
weight: 20
taxonomy.term_page:
entity.taxonomy_term.canonical:
title: 'View'
route_name: taxonomy.term_page
base_route: taxonomy.term_page
route_name: entity.taxonomy_term.canonical
base_route: entity.taxonomy_term.canonical
taxonomy.term_edit:
entity.taxonomy_term.edit_form:
title: 'Edit'
route_name: taxonomy.term_edit
base_route: taxonomy.term_page
route_name: entity.taxonomy_term.edit_form
base_route: entity.taxonomy_term.canonical
taxonomy.overview_terms:
entity.taxonomy_vocabulary.overview_form:
title: 'List'
route_name: taxonomy.overview_terms
base_route: taxonomy.overview_terms
taxonomy.vocabulary_edit:
route_name: entity.taxonomy_vocabulary.overview_form
base_route: entity.taxonomy_vocabulary.overview_form
entity.taxonomy_vocabulary.edit_form:
title: 'Edit'
route_name: taxonomy.vocabulary_edit
base_route: taxonomy.overview_terms
route_name: entity.taxonomy_vocabulary.edit_form
base_route: entity.taxonomy_vocabulary.overview_form
......@@ -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>';
return $output;
case 'taxonomy.overview_terms':
case 'entity.taxonomy_vocabulary.overview_form':
$vocabulary = $route_match->getParameter('taxonomy_vocabulary');
switch ($vocabulary->hierarchy) {
case TAXONOMY_HIERARCHY_DISABLED:
......@@ -120,7 +120,7 @@ function taxonomy_permission() {
* Entity URI callback.
*/
function taxonomy_term_uri($term) {
return new Url('taxonomy.term_page', array(
return new Url('entity.taxonomy_term.canonical', array(
'taxonomy_term' => $term->id(),
));
}
......
......@@ -6,7 +6,7 @@ taxonomy.vocabulary_list:
requirements:
_permission: 'administer taxonomy'
taxonomy.term_add:
entity.taxonomy_term.add_form:
path: '/admin/structure/taxonomy/manage/{taxonomy_vocabulary}/add'
defaults:
_content: '\Drupal\taxonomy\Controller\TaxonomyController::addForm'
......@@ -14,7 +14,7 @@ taxonomy.term_add:
requirements:
_entity_create_access: 'taxonomy_term:{taxonomy_vocabulary}'
taxonomy.term_edit:
entity.taxonomy_term.edit_form:
path: '/taxonomy/term/{taxonomy_term}/edit'
defaults:
_entity_form: 'taxonomy_term.default'
......@@ -24,7 +24,7 @@ taxonomy.term_edit:
requirements:
_entity_access: 'taxonomy_term.update'
taxonomy.term_delete:
entity.taxonomy_term.delete_form:
path: '/taxonomy/term/{taxonomy_term}/delete'
defaults:
_entity_form: 'taxonomy_term.delete'
......@@ -34,7 +34,7 @@ taxonomy.term_delete:
requirements:
_entity_access: 'taxonomy_term.delete'
taxonomy.vocabulary_add:
entity.taxonomy_vocabulary.add_form:
path: '/admin/structure/taxonomy/add'
defaults:
_entity_form: 'taxonomy_vocabulary'
......@@ -42,7 +42,7 @@ taxonomy.vocabulary_add:
requirements:
_entity_create_access: 'taxonomy_vocabulary'
taxonomy.vocabulary_edit:
entity.taxonomy_vocabulary.edit_form:
path: '/admin/structure/taxonomy/manage/{taxonomy_vocabulary}'
defaults:
_entity_form: 'taxonomy_vocabulary.default'
......@@ -50,7 +50,7 @@ taxonomy.vocabulary_edit:
requirements:
_entity_access: 'taxonomy_vocabulary.update'
taxonomy.vocabulary_delete:
entity.taxonomy_vocabulary.delete_form:
path: '/admin/structure/taxonomy/manage/{taxonomy_vocabulary}/delete'
defaults:
_entity_form: 'taxonomy_vocabulary.delete'
......@@ -58,7 +58,7 @@ taxonomy.vocabulary_delete:
requirements:
_entity_access: 'taxonomy_vocabulary.delete'
taxonomy.vocabulary_reset:
entity.taxonomy_vocabulary.reset_form:
path: '/admin/structure/taxonomy/manage/{taxonomy_vocabulary}/reset'
defaults:
_entity_form: 'taxonomy_vocabulary.reset'
......@@ -80,7 +80,7 @@ taxonomy.autocomplete_vid:
requirements:
_permission: 'access content'
taxonomy.overview_terms:
entity.taxonomy_vocabulary.overview_form:
path: '/admin/structure/taxonomy/manage/{taxonomy_vocabulary}/overview'
defaults:
_form: 'Drupal\taxonomy\Form\OverviewTerms'
......@@ -88,7 +88,7 @@ taxonomy.overview_terms:
requirements:
_entity_access: 'taxonomy_vocabulary.view'
taxonomy.term_page:
entity.taxonomy_term.canonical:
path: '/taxonomy/term/{taxonomy_term}'
defaults:
_content: '\Drupal\taxonomy\Controller\TaxonomyController::termPage'
......
......@@ -28,7 +28,7 @@ protected function setUp() {
*/
public function testTaxonomyPageLocalTasks($route, $subtask = 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;
$this->assertLocalTasks($route, $tasks);
......@@ -39,8 +39,8 @@ public function testTaxonomyPageLocalTasks($route, $subtask = array()) {
*/
public function getTaxonomyPageRoutes() {
return array(
array('taxonomy.term_page'),
array('taxonomy.term_edit'),
array('entity.taxonomy_term.canonical'),
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