Commit c8f9c9b4 authored by alexpott's avatar alexpott

Issue #2352385 by andypost: Standardize book & forum entity route names.

parent 408f452f
......@@ -8,8 +8,8 @@ book.settings:
base_route: book.admin
weight: 100
book.outline:
route_name: book.outline
entity.node.book_outline_form:
route_name: entity.node.book_outline_form
base_route: entity.node.canonical
title: Outline
weight: 2
......@@ -44,7 +44,7 @@ function book_help($route_name, RouteMatchInterface $route_match) {
case 'book.admin':
return '<p>' . t('The book module offers a means to organize a collection of related content pages, collectively known as a book. When viewed, this content automatically displays links to adjacent book pages, providing a simple navigation system for creating and reviewing structured content.') . '</p>';
case 'book.outline':
case 'entity.node.book_outline_form':
return '<p>' . t('The outline feature allows you to include pages in the <a href="!book">Book hierarchy</a>, as well as move them within the hierarchy or to <a href="!book-admin">reorder an entire book</a>.', array('!book' => \Drupal::url('book.render'), '!book-admin' => \Drupal::url('book.admin'))) . '</p>';
}
}
......@@ -88,8 +88,8 @@ function book_entity_type_build(array &$entity_types) {
/** @var $entity_types \Drupal\Core\Entity\EntityTypeInterface[] */
$entity_types['node']
->setFormClass('book_outline', 'Drupal\book\Form\BookOutlineForm')
->setLinkTemplate('book-outline-form', 'book.outline')
->setLinkTemplate('book-remove-form', 'book.remove');
->setLinkTemplate('book-outline-form', 'entity.node.book_outline_form')
->setLinkTemplate('book-remove-form', 'entity.node.book_remove_form');
}
/**
......
......@@ -30,7 +30,7 @@ book.export:
_permission: 'access printer-friendly version'
_entity_access: 'node.view'
book.outline:
entity.node.book_outline_form:
path: '/node/{node}/outline'
defaults:
_entity_form: 'node.book_outline'
......@@ -51,7 +51,7 @@ book.admin_edit:
_entity_access: 'node.view'
node: \d+
book.remove:
entity.node.book_remove_form:
path: '/node/{node}/outline/remove'
defaults:
_form: '\Drupal\book\Form\BookRemoveForm'
......
......@@ -53,7 +53,7 @@ public function getBookAdminRoutes() {
*/
public function testBookNodeLocalTasks($route) {
$this->assertLocalTasks($route, array(
0 => array('book.outline', 'entity.node.canonical', 'entity.node.edit_form', 'entity.node.delete_form', 'entity.node.version_history',),
0 => array('entity.node.book_outline_form', 'entity.node.canonical', 'entity.node.edit_form', 'entity.node.delete_form', 'entity.node.version_history',),
));
}
......@@ -63,7 +63,7 @@ public function testBookNodeLocalTasks($route) {
public function getBookNodeRoutes() {
return array(
array('entity.node.canonical'),
array('book.outline'),
array('entity.node.book_outline_form'),
);
}
......
......@@ -137,8 +137,9 @@ function forum_entity_type_build(array &$entity_types) {
$entity_types['taxonomy_term']
->setFormClass('forum', 'Drupal\forum\Form\ForumForm')
->setFormClass('container', 'Drupal\forum\Form\ContainerForm')
->setLinkTemplate('forum-delete-form', 'forum.delete')
->setLinkTemplate('forum-edit-form', 'forum.edit_forum');
->setLinkTemplate('forum-delete-form', 'entity.taxonomy_term.forum_delete_form')
->setLinkTemplate('forum-edit-container-form', 'entity.taxonomy_term.forum_edit_container_form')
->setLinkTemplate('forum-edit-form', 'entity.taxonomy_term.forum_edit_form');
}
/**
......
forum.delete:
entity.taxonomy_term.forum_delete_form:
path: '/admin/structure/forum/delete/forum/{taxonomy_term}'
defaults:
_form: '\Drupal\forum\Form\DeleteForm'
......@@ -46,7 +46,7 @@ forum.add_forum:
requirements:
_permission: 'administer forums'
forum.edit_container:
entity.taxonomy_term.forum_edit_container_form:
path: '/admin/structure/forum/edit/container/{taxonomy_term}'
defaults:
_entity_form: 'taxonomy_term.container'
......@@ -54,7 +54,7 @@ forum.edit_container:
requirements:
_permission: 'administer forums'
forum.edit_forum:
entity.taxonomy_term.forum_edit_form:
path: '/admin/structure/forum/edit/forum/{taxonomy_term}'
defaults:
_entity_form: 'taxonomy_term.forum'
......
......@@ -80,7 +80,7 @@ public function save(array $form, FormStateInterface $form_state) {
$term_storage = $this->entityManager->getStorage('taxonomy_term');
$status = $term_storage->save($term);
$route_name = $this->urlStub == 'container' ? 'forum.edit_container' : 'forum.edit_forum';
$route_name = $this->urlStub == 'container' ? 'entity.taxonomy_term.forum_edit_container_form' : 'entity.taxonomy_term.forum_edit_form';
$route_parameters = ['taxonomy_term' => $term->id()];
$link = $this->l($this->t('Edit'), new Url($route_name, $route_parameters));
switch ($status) {
......
......@@ -71,11 +71,11 @@ public function buildForm(array $form, FormStateInterface $form_state) {
$route_parameters = $form['terms'][$key]['operations']['#links']['edit']['url']->getRouteParameters();
if (!empty($term->forum_container->value)) {
$form['terms'][$key]['operations']['#links']['edit']['title'] = $this->t('edit container');
$form['terms'][$key]['operations']['#links']['edit']['url'] = Url::fromRoute('forum.edit_container', $route_parameters);
$form['terms'][$key]['operations']['#links']['edit']['url'] = Url::fromRoute('entity.taxonomy_term.forum_edit_container_form', $route_parameters);
}
else {
$form['terms'][$key]['operations']['#links']['edit']['title'] = $this->t('edit forum');
$form['terms'][$key]['operations']['#links']['edit']['url'] = Url::fromRoute('forum.edit_forum', $route_parameters);
$form['terms'][$key]['operations']['#links']['edit']['url'] = Url::fromRoute('entity.taxonomy_term.forum_edit_form', $route_parameters);
}
// We don't want the redirect from the link so we can redirect the
// delete action.
......
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