Commit 3c479060 authored by alexpott's avatar alexpott

Issue #501472 by izus, kiamlaluno, valthebald, catch: Move book administration to admin/structure.

parent b5b34b18
...@@ -6,4 +6,4 @@ core: 8.x ...@@ -6,4 +6,4 @@ core: 8.x
dependencies: dependencies:
- menu_link - menu_link
- node - node
configure: admin/content/book/settings configure: admin/structure/book/settings
...@@ -22,7 +22,7 @@ function book_help($path, $arg) { ...@@ -22,7 +22,7 @@ function book_help($path, $arg) {
$output .= '<h3>' . t('Uses') . '</h3>'; $output .= '<h3>' . t('Uses') . '</h3>';
$output .= '<dl>'; $output .= '<dl>';
$output .= '<dt>' . t('Adding and managing book content') . '</dt>'; $output .= '<dt>' . t('Adding and managing book content') . '</dt>';
$output .= '<dd>' . t('You can assign separate permissions for <em>creating</em>, <em>editing</em>, and <em>deleting</em> book content, as well as <em>adding content to books</em>, and <em>creating new books</em>. Users with the <em>Administer book outlines</em> permission can add <em>any</em> type of content to a book by selecting the appropriate book outline while editing the content. They can also view a list of all books, and edit and rearrange section titles on the <a href="@admin-book">Book administration page</a>.', array('@admin-book' => url('admin/content/book'))) . '</dd>'; $output .= '<dd>' . t('You can assign separate permissions for <em>creating</em>, <em>editing</em>, and <em>deleting</em> book content, as well as <em>adding content to books</em>, and <em>creating new books</em>. Users with the <em>Administer book outlines</em> permission can add <em>any</em> type of content to a book by selecting the appropriate book outline while editing the content. They can also view a list of all books, and edit and rearrange section titles on the <a href="@admin-book">Book administration page</a>.', array('@admin-book' => url('admin/structure/book'))) . '</dd>';
$output .= '<dt>' . t('Book navigation') . '</dt>'; $output .= '<dt>' . t('Book navigation') . '</dt>';
$output .= '<dd>' . t("Book pages have a default book-specific navigation block. This navigation block contains links that lead to the previous and next pages in the book, and to the level above the current page in the book's structure. This block can be enabled on the <a href='@admin-block'>Blocks administration page</a>. For book pages to show up in the book navigation, they must be added to a book outline.", array('@admin-block' => url('admin/structure/block'))) . '</dd>'; $output .= '<dd>' . t("Book pages have a default book-specific navigation block. This navigation block contains links that lead to the previous and next pages in the book, and to the level above the current page in the book's structure. This block can be enabled on the <a href='@admin-block'>Blocks administration page</a>. For book pages to show up in the book navigation, they must be added to a book outline.", array('@admin-block' => url('admin/structure/block'))) . '</dd>';
$output .= '<dt>' . t('Collaboration') . '</dt>'; $output .= '<dt>' . t('Collaboration') . '</dt>';
...@@ -31,10 +31,10 @@ function book_help($path, $arg) { ...@@ -31,10 +31,10 @@ function book_help($path, $arg) {
$output .= '<dd>' . t("Users with the <em>View printer-friendly books</em> permission can select the <em>printer-friendly version</em> link visible at the bottom of a book page's content to generate a printer-friendly display of the page and all of its subsections.") . '</dd>'; $output .= '<dd>' . t("Users with the <em>View printer-friendly books</em> permission can select the <em>printer-friendly version</em> link visible at the bottom of a book page's content to generate a printer-friendly display of the page and all of its subsections.") . '</dd>';
$output .= '</dl>'; $output .= '</dl>';
return $output; return $output;
case 'admin/content/book': case 'admin/structure/book':
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>'; 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 'node/%/outline': case 'node/%/outline':
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' => url('book'), '@book-admin' => url('admin/content/book'))) . '</p>'; 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' => url('book'), '@book-admin' => url('admin/structure/book'))) . '</p>';
} }
} }
...@@ -131,24 +131,24 @@ function book_node_view_link(EntityInterface $node, $view_mode) { ...@@ -131,24 +131,24 @@ function book_node_view_link(EntityInterface $node, $view_mode) {
* Implements hook_menu(). * Implements hook_menu().
*/ */
function book_menu() { function book_menu() {
$items['admin/content/book'] = array( $items['admin/structure/book'] = array(
'title' => 'Books', 'title' => 'Books',
'description' => "Manage your site's book outlines.", 'description' => "Manage your site's book outlines.",
'route_name' => 'book_admin', 'route_name' => 'book_admin',
'type' => MENU_LOCAL_TASK, 'type' => MENU_LOCAL_TASK,
); );
$items['admin/content/book/list'] = array( $items['admin/structure/book/list'] = array(
'title' => 'List', 'title' => 'List',
'type' => MENU_DEFAULT_LOCAL_TASK, 'type' => MENU_DEFAULT_LOCAL_TASK,
); );
$items['admin/content/book/settings'] = array( $items['admin/structure/book/settings'] = array(
'title' => 'Settings', 'title' => 'Settings',
'route_name' => 'book_settings', 'route_name' => 'book_settings',
'access arguments' => array('administer site configuration'), 'access arguments' => array('administer site configuration'),
'type' => MENU_LOCAL_TASK, 'type' => MENU_LOCAL_TASK,
'weight' => 100, 'weight' => 100,
); );
$items['admin/content/book/%node'] = array( $items['admin/structure/book/%node'] = array(
'title' => 'Re-order book pages and change titles', 'title' => 'Re-order book pages and change titles',
'page callback' => 'drupal_get_form', 'page callback' => 'drupal_get_form',
'page arguments' => array('book_admin_edit', 3), 'page arguments' => array('book_admin_edit', 3),
...@@ -206,7 +206,7 @@ function book_export_access(EntityInterface $node) { ...@@ -206,7 +206,7 @@ function book_export_access(EntityInterface $node) {
* Access callback: Determines if the outline tab is accessible. * Access callback: Determines if the outline tab is accessible.
* *
* Path: * Path:
* - admin/content/book/%node * - admin/structure/book/%node
* - node/%node/outline * - node/%node/outline
* *
* @param \Drupal\Core\Entity\EntityInterface $node * @param \Drupal\Core\Entity\EntityInterface $node
......
...@@ -6,14 +6,14 @@ book_render: ...@@ -6,14 +6,14 @@ book_render:
_permission: 'access content' _permission: 'access content'
book_admin: book_admin:
pattern: '/admin/content/book' pattern: '/admin/structure/book'
defaults: defaults:
_content: '\Drupal\book\Controller\BookController::adminOverview' _content: '\Drupal\book\Controller\BookController::adminOverview'
requirements: requirements:
_permission: 'administer book outlines' _permission: 'administer book outlines'
book_settings: book_settings:
pattern: '/admin/content/book/settings' pattern: '/admin/structure/book/settings'
defaults: defaults:
_form: 'Drupal\book\BookSettingsForm' _form: 'Drupal\book\BookSettingsForm'
requirements: requirements:
......
...@@ -57,7 +57,7 @@ public function adminOverview() { ...@@ -57,7 +57,7 @@ public function adminOverview() {
$links = array(); $links = array();
$links['edit'] = array( $links['edit'] = array(
'title' => t('Edit order and titles'), 'title' => t('Edit order and titles'),
'href' => 'admin/content/book/' . $book['nid'], 'href' => 'admin/structure/book/' . $book['nid'],
); );
$row[] = array( $row[] = array(
'data' => array( 'data' => array(
......
...@@ -419,13 +419,13 @@ function testBookNodeTypeChange() { ...@@ -419,13 +419,13 @@ function testBookNodeTypeChange() {
'book_allowed_types[bar]' => 'bar', 'book_allowed_types[bar]' => 'bar',
); );
$this->drupalPost('admin/content/book/settings', $edit, t('Save configuration')); $this->drupalPost('admin/structure/book/settings', $edit, t('Save configuration'));
$this->assertTrue(book_type_is_allowed('bar'), 'Config book.settings:allowed_types contains the bar node type.'); $this->assertTrue(book_type_is_allowed('bar'), 'Config book.settings:allowed_types contains the bar node type.');
$this->assertTrue(book_type_is_allowed('page'), 'Config book.settings:allowed_types contains the page node type.'); $this->assertTrue(book_type_is_allowed('page'), 'Config book.settings:allowed_types contains the page node type.');
// Test the order of the book.settings::allowed_types configuration is as // Test the order of the book.settings::allowed_types configuration is as
// expected. The point of this test is to prove that after changing a node // expected. The point of this test is to prove that after changing a node
// type going to admin/content/book/settings and pressing save without // type going to admin/structure/book/settings and pressing save without
// changing anything should not alter the book.settings configuration. The // changing anything should not alter the book.settings configuration. The
// order will be: // order will be:
// @code // @code
...@@ -435,7 +435,7 @@ function testBookNodeTypeChange() { ...@@ -435,7 +435,7 @@ function testBookNodeTypeChange() {
// ); // );
// @endcode // @endcode
$current_config = config('book.settings')->init()->get(); $current_config = config('book.settings')->init()->get();
$this->drupalPost('admin/content/book/settings', array(), t('Save configuration')); $this->drupalPost('admin/structure/book/settings', array(), t('Save configuration'));
$this->assertIdentical($current_config, config('book.settings')->init()->get()); $this->assertIdentical($current_config, config('book.settings')->init()->get());
// Change the name, machine name and description. // Change the name, machine name and description.
...@@ -456,7 +456,7 @@ function testBookNodeTypeChange() { ...@@ -456,7 +456,7 @@ function testBookNodeTypeChange() {
// ); // );
// @endcode // @endcode
$current_config = config('book.settings')->init()->get(); $current_config = config('book.settings')->init()->get();
$this->drupalPost('admin/content/book/settings', array(), t('Save configuration')); $this->drupalPost('admin/structure/book/settings', array(), t('Save configuration'));
$this->assertIdentical($current_config, config('book.settings')->init()->get()); $this->assertIdentical($current_config, config('book.settings')->init()->get());
$edit = array( $edit = array(
...@@ -474,7 +474,7 @@ function testBookNodeTypeChange() { ...@@ -474,7 +474,7 @@ function testBookNodeTypeChange() {
// ); // );
// @endcode // @endcode
$current_config = config('book.settings')->init()->get(); $current_config = config('book.settings')->init()->get();
$this->drupalPost('admin/content/book/settings', array(), t('Save configuration')); $this->drupalPost('admin/structure/book/settings', array(), t('Save configuration'));
$this->assertIdentical($current_config, config('book.settings')->init()->get()); $this->assertIdentical($current_config, config('book.settings')->init()->get());
// Ensure that after all the node type changes book.settings:child_type has // Ensure that after all the node type changes book.settings:child_type has
...@@ -496,7 +496,7 @@ public function testBookOrdering() { ...@@ -496,7 +496,7 @@ public function testBookOrdering() {
$plid = $node1->book['mlid']; $plid = $node1->book['mlid'];
// Head to admin screen and attempt to re-order. // Head to admin screen and attempt to re-order.
$this->drupalGet('admin/content/book/' . $book->nid); $this->drupalGet('admin/structure/book/' . $book->nid);
$edit = array( $edit = array(
"table[book-admin-{$node1->nid}][weight]" => 1, "table[book-admin-{$node1->nid}][weight]" => 1,
"table[book-admin-{$node2->nid}][weight]" => 2, "table[book-admin-{$node2->nid}][weight]" => 2,
......
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