Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663
This commit is contained in:
parent
eb34d130a8
commit
f32e58e4b1
8476 changed files with 211648 additions and 170042 deletions
|
@ -26,17 +26,17 @@ function book_help($route_name, RouteMatchInterface $route_match) {
|
|||
switch ($route_name) {
|
||||
case 'help.page.book':
|
||||
$output = '<h3>' . t('About') . '</h3>';
|
||||
$output .= '<p>' . t('The Book module is used for creating structured, multi-page content, such as site resource guides, manuals, and wikis. It allows you to create content that has chapters, sections, subsections, or any similarly-tiered structure. Enabling the module creates a new content type <em>Book page</em>. For more information, see the <a href="!book">online documentation for the Book module</a>.', array('!book' => 'https://www.drupal.org/documentation/modules/book')) . '</p>';
|
||||
$output .= '<p>' . t('The Book module is used for creating structured, multi-page content, such as site resource guides, manuals, and wikis. It allows you to create content that has chapters, sections, subsections, or any similarly-tiered structure. Enabling the module creates a new content type <em>Book page</em>. For more information, see the <a href=":book">online documentation for the Book module</a>.', array(':book' => 'https://www.drupal.org/documentation/modules/book')) . '</p>';
|
||||
$output .= '<h3>' . t('Uses') . '</h3>';
|
||||
$output .= '<dl>';
|
||||
$output .= '<dt>' . t('Adding and managing book content') . '</dt>';
|
||||
$output .= '<dd>' . t('Books have a hierarchical structure, called a <em>book outline</em>. Each book outline can have nested pages up to nine levels deep. Multiple content types can be configured to behave as a book outline. From the content edit form, it is possible to add a page to a book outline or create a new book.') . '</dd>';
|
||||
$output .= '<dd>' . t('You can assign separate permissions for <em>creating new books</em> as well as <em>creating</em>, <em>editing</em> and <em>deleting</em> book content. 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 list page</a>.', array('!admin-book' => \Drupal::url('book.admin'))) . '</dd>';
|
||||
$output .= '<dd>' . t('You can assign separate permissions for <em>creating new books</em> as well as <em>creating</em>, <em>editing</em> and <em>deleting</em> book content. 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 list page</a>.', array(':admin-book' => \Drupal::url('book.admin'))) . '</dd>';
|
||||
$output .= '<dt>' . t('Configuring content types for books') . '</dt>';
|
||||
$output .= '<dd>' . t('The <em>Book page</em> content type is the initial content type enabled for book outlines. On the <a href="!admin-settings">Book settings page</a> you can configure content types that can used in book outlines.', array('!admin-settings' => \Drupal::url('book.settings'))) . '</dd>';
|
||||
$output .= '<dd>' . t('Users with the <em>Add content and child pages to books</em> permission will see a link to <em>Add child page</em> when viewing a content item that is part of a book outline. This link will allow users to create a new content item of the content type you select on the <a href="!admin-settings">Book settings page</a>. By default this is the <em>Book page</em> content type.', array('!admin-settings' => \Drupal::url('book.settings'))) . '</dd>';
|
||||
$output .= '<dd>' . t('The <em>Book page</em> content type is the initial content type enabled for book outlines. On the <a href=":admin-settings">Book settings page</a> you can configure content types that can used in book outlines.', array(':admin-settings' => \Drupal::url('book.settings'))) . '</dd>';
|
||||
$output .= '<dd>' . t('Users with the <em>Add content and child pages to books</em> permission will see a link to <em>Add child page</em> when viewing a content item that is part of a book outline. This link will allow users to create a new content item of the content type you select on the <a href=":admin-settings">Book settings page</a>. By default this is the <em>Book page</em> content type.', array(':admin-settings' => \Drupal::url('book.settings'))) . '</dd>';
|
||||
$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 layout page</a>. For book pages to show up in the book navigation, they must be added to a book outline.", array('!admin-block' => (\Drupal::moduleHandler()->moduleExists('block')) ? \Drupal::url('block.admin_display') : '#')) . '</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 layout page</a>. For book pages to show up in the book navigation, they must be added to a book outline.", array(':admin-block' => (\Drupal::moduleHandler()->moduleExists('block')) ? \Drupal::url('block.admin_display') : '#')) . '</dd>';
|
||||
$output .= '<dt>' . t('Collaboration') . '</dt>';
|
||||
$output .= '<dd>' . t('Books can be created collaboratively, as they allow users with appropriate permissions to add pages into existing books, and add those pages to a custom table of contents.') . '</dd>';
|
||||
$output .= '<dt>' . t('Printing books') . '</dt>';
|
||||
|
@ -48,7 +48,7 @@ function book_help($route_name, RouteMatchInterface $route_match) {
|
|||
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 '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>';
|
||||
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>';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -466,7 +466,6 @@ function template_preprocess_book_export_html(&$variables) {
|
|||
$variables['base_url'] = $base_url;
|
||||
$variables['language'] = $language_interface;
|
||||
$variables['language_rtl'] = ($language_interface->getDirection() == LanguageInterface::DIRECTION_RTL);
|
||||
$variables['head'] = drupal_get_html_head();
|
||||
|
||||
// HTML element attributes.
|
||||
$attributes = array();
|
||||
|
|
|
@ -7,7 +7,7 @@ id: node.book.promote
|
|||
field_name: promote
|
||||
entity_type: node
|
||||
bundle: book
|
||||
label: Promoted to front page
|
||||
label: 'Promoted to front page'
|
||||
description: ''
|
||||
required: false
|
||||
translatable: true
|
||||
|
@ -15,6 +15,7 @@ default_value:
|
|||
-
|
||||
value: 0
|
||||
default_value_callback: ''
|
||||
settings: { }
|
||||
third_party_settings: { }
|
||||
settings:
|
||||
on_label: 'On'
|
||||
off_label: 'Off'
|
||||
field_type: boolean
|
||||
|
|
|
@ -5,26 +5,18 @@ dependencies:
|
|||
- field.field.node.book.body
|
||||
- node.type.book
|
||||
module:
|
||||
- entity_reference
|
||||
- text
|
||||
id: node.book.default
|
||||
targetEntityType: node
|
||||
bundle: book
|
||||
mode: default
|
||||
content:
|
||||
title:
|
||||
type: string_textfield
|
||||
weight: -5
|
||||
body:
|
||||
type: text_textarea_with_summary
|
||||
weight: 26
|
||||
settings:
|
||||
size: 60
|
||||
placeholder: ''
|
||||
third_party_settings: { }
|
||||
uid:
|
||||
type: entity_reference_autocomplete
|
||||
weight: 5
|
||||
settings:
|
||||
match_operator: CONTAINS
|
||||
size: 60
|
||||
rows: 9
|
||||
summary_rows: 3
|
||||
placeholder: ''
|
||||
third_party_settings: { }
|
||||
created:
|
||||
|
@ -44,13 +36,19 @@ content:
|
|||
display_label: true
|
||||
weight: 16
|
||||
third_party_settings: { }
|
||||
body:
|
||||
type: text_textarea_with_summary
|
||||
weight: 26
|
||||
title:
|
||||
type: string_textfield
|
||||
weight: -5
|
||||
settings:
|
||||
rows: 9
|
||||
summary_rows: 3
|
||||
size: 60
|
||||
placeholder: ''
|
||||
third_party_settings: { }
|
||||
uid:
|
||||
type: entity_reference_autocomplete
|
||||
weight: 5
|
||||
settings:
|
||||
match_operator: CONTAINS
|
||||
size: 60
|
||||
placeholder: ''
|
||||
third_party_settings: { }
|
||||
hidden: { }
|
||||
third_party_settings: { }
|
||||
|
|
|
@ -20,6 +20,4 @@ content:
|
|||
third_party_settings: { }
|
||||
links:
|
||||
weight: 101
|
||||
hidden:
|
||||
langcode: true
|
||||
third_party_settings: { }
|
||||
hidden: { }
|
||||
|
|
|
@ -22,6 +22,4 @@ content:
|
|||
third_party_settings: { }
|
||||
links:
|
||||
weight: 101
|
||||
hidden:
|
||||
langcode: true
|
||||
third_party_settings: { }
|
||||
hidden: { }
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
id: node.print
|
||||
label: Print
|
||||
langcode: en
|
||||
status: false
|
||||
cache: true
|
||||
targetEntityType: node
|
||||
dependencies:
|
||||
module:
|
||||
- book
|
||||
- node
|
||||
enforced:
|
||||
module:
|
||||
- book
|
||||
module:
|
||||
- node
|
||||
id: node.print
|
||||
label: Print
|
||||
targetEntityType: node
|
||||
cache: true
|
||||
|
|
|
@ -18,5 +18,4 @@ default_value: { }
|
|||
default_value_callback: ''
|
||||
settings:
|
||||
display_summary: true
|
||||
third_party_settings: { }
|
||||
field_type: text_with_summary
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
module:
|
||||
- book
|
||||
enforced:
|
||||
module:
|
||||
- book
|
||||
|
@ -11,7 +9,5 @@ type: book
|
|||
description: '<em>Books</em> have a built-in hierarchical navigation. Use for handbooks or tutorials.'
|
||||
help: ''
|
||||
new_revision: false
|
||||
display_submitted: true
|
||||
preview_mode: 1
|
||||
display_submitted: true
|
||||
third_party_settings: { }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
id: d6_book
|
||||
label: Drupal 6 books
|
||||
label: Books
|
||||
migration_tags:
|
||||
- Drupal 6
|
||||
source:
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
id: d6_book_settings
|
||||
label: Drupal 6 book configuration
|
||||
label: Book configuration
|
||||
migration_tags:
|
||||
- Drupal 6
|
||||
source:
|
||||
|
|
|
@ -96,7 +96,7 @@ class BookBreadcrumbBuilder implements BreadcrumbBuilderInterface {
|
|||
}
|
||||
}
|
||||
$breadcrumb->setLinks($links);
|
||||
$breadcrumb->setCacheContexts(['route.book_navigation']);
|
||||
$breadcrumb->addCacheContexts(['route.book_navigation']);
|
||||
return $breadcrumb;
|
||||
}
|
||||
|
||||
|
|
|
@ -357,7 +357,7 @@ class BookManager implements BookManagerInterface {
|
|||
'#type' => 'select',
|
||||
'#title' => $this->t('Parent item'),
|
||||
'#default_value' => $book_link['pid'],
|
||||
'#description' => $this->t('The parent page in the book. The maximum depth for a book and all child pages is !maxdepth. Some pages in the selected book may not be available as parents if selecting them would exceed this limit.', array('!maxdepth' => static::BOOK_MAX_DEPTH)),
|
||||
'#description' => $this->t('The parent page in the book. The maximum depth for a book and all child pages is @maxdepth. Some pages in the selected book may not be available as parents if selecting them would exceed this limit.', array('@maxdepth' => static::BOOK_MAX_DEPTH)),
|
||||
'#options' => $this->getTableOfContents($book_link['bid'], $book_link['parent_depth_limit'], array($book_link['nid'])),
|
||||
'#attributes' => array('class' => array('book-title-select')),
|
||||
'#prefix' => '<div id="edit-book-plid-wrapper">',
|
||||
|
@ -539,30 +539,33 @@ class BookManager implements BookManagerInterface {
|
|||
$items = [];
|
||||
|
||||
foreach ($tree as $data) {
|
||||
$class = ['menu-item'];
|
||||
$element = [];
|
||||
|
||||
// Generally we only deal with visible links, but just in case.
|
||||
if (!$data['link']['access']) {
|
||||
continue;
|
||||
}
|
||||
// Set a class for the <li>-tag. Since $data['below'] may contain local
|
||||
// tasks, only set 'expanded' class if the link also has children within
|
||||
// Set a class for the <li> tag. Since $data['below'] may contain local
|
||||
// tasks, only set 'expanded' to true if the link also has children within
|
||||
// the current book.
|
||||
$element['is_expanded'] = FALSE;
|
||||
$element['is_collapsed'] = FALSE;
|
||||
if ($data['link']['has_children'] && $data['below']) {
|
||||
$class[] = 'menu-item--expanded';
|
||||
$element['is_expanded'] = TRUE;
|
||||
}
|
||||
elseif ($data['link']['has_children']) {
|
||||
$class[] = 'menu-item--collapsed';
|
||||
$element['is_collapsed'] = TRUE;
|
||||
}
|
||||
|
||||
// Set a class if the link is in the active trail.
|
||||
// Set a helper variable to indicate whether the link is in the active
|
||||
// trail.
|
||||
$element['in_active_trail'] = FALSE;
|
||||
if ($data['link']['in_active_trail']) {
|
||||
$class[] = 'menu-item--active-trail';
|
||||
$element['in_active_trail'] = TRUE;
|
||||
}
|
||||
|
||||
// Allow book-specific theme overrides.
|
||||
$element = [];
|
||||
$element['attributes'] = new Attribute();
|
||||
$element['attributes']['class'] = $class;
|
||||
$element['title'] = $data['link']['title'];
|
||||
$node = $this->entityManager->getStorage('node')->load($data['link']['nid']);
|
||||
$element['url'] = $node->urlInfo();
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
namespace Drupal\book\Tests;
|
||||
|
||||
use Drupal\Component\Utility\SafeMarkup;
|
||||
use Drupal\Core\Cache\Cache;
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
use Drupal\simpletest\WebTestBase;
|
||||
use Drupal\user\RoleInterface;
|
||||
|
@ -67,6 +68,7 @@ class BookTest extends WebTestBase {
|
|||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->drupalPlaceBlock('system_breadcrumb_block');
|
||||
$this->drupalPlaceBlock('page_title_block');
|
||||
|
||||
// node_access_test requires a node_access_rebuild().
|
||||
node_access_rebuild();
|
||||
|
@ -124,11 +126,12 @@ class BookTest extends WebTestBase {
|
|||
|
||||
// Enable the debug output.
|
||||
\Drupal::state()->set('book_test.debug_book_navigation_cache_context', TRUE);
|
||||
Cache::invalidateTags(['book_test.debug_book_navigation_cache_context']);
|
||||
|
||||
$this->drupalLogin($this->bookAuthor);
|
||||
|
||||
// On non-node route.
|
||||
$this->drupalGet('');
|
||||
$this->drupalGet($this->adminUser->urlInfo());
|
||||
$this->assertRaw('[route.book_navigation]=book.none');
|
||||
|
||||
// On non-book node route.
|
||||
|
@ -494,99 +497,6 @@ class BookTest extends WebTestBase {
|
|||
$this->assertTrue(empty($node->book), 'Deleting childless top-level book node properly allowed.');
|
||||
}
|
||||
|
||||
/*
|
||||
* Tests node type changing machine name when type is a book allowed type.
|
||||
*/
|
||||
function testBookNodeTypeChange() {
|
||||
$this->drupalLogin($this->adminUser);
|
||||
// Change the name, machine name and description.
|
||||
$edit = array(
|
||||
'name' => 'Bar',
|
||||
'type' => 'bar',
|
||||
);
|
||||
$this->drupalPostForm('admin/structure/types/manage/book', $edit, t('Save content type'));
|
||||
|
||||
// Ensure that the config book.settings:allowed_types has been updated with
|
||||
// the new machine and the old one has been removed.
|
||||
$this->assertTrue(book_type_is_allowed('bar'), 'Config book.settings:allowed_types contains the updated node type machine name "bar".');
|
||||
$this->assertFalse(book_type_is_allowed('book'), 'Config book.settings:allowed_types does not contain the old node type machine name "book".');
|
||||
|
||||
$edit = array(
|
||||
'name' => 'Basic page',
|
||||
'title_label' => 'Title for basic page',
|
||||
'type' => 'page',
|
||||
);
|
||||
$this->drupalPostForm('admin/structure/types/add', $edit, t('Save content type'));
|
||||
|
||||
// Add page to the allowed node types.
|
||||
$edit = array(
|
||||
'book_allowed_types[page]' => 'page',
|
||||
'book_allowed_types[bar]' => 'bar',
|
||||
);
|
||||
|
||||
$this->drupalPostForm('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('page'), 'Config book.settings:allowed_types contains the page node type.');
|
||||
|
||||
// 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
|
||||
// type going to admin/structure/book/settings and pressing save without
|
||||
// changing anything should not alter the book.settings configuration. The
|
||||
// order will be:
|
||||
// @code
|
||||
// array(
|
||||
// 'bar',
|
||||
// 'page',
|
||||
// );
|
||||
// @endcode
|
||||
$current_config = $this->config('book.settings')->get();
|
||||
$this->drupalPostForm('admin/structure/book/settings', array(), t('Save configuration'));
|
||||
$this->assertIdentical($current_config, $this->config('book.settings')->get());
|
||||
|
||||
// Change the name, machine name and description.
|
||||
$edit = array(
|
||||
'name' => 'Zebra book',
|
||||
'type' => 'zebra',
|
||||
);
|
||||
$this->drupalPostForm('admin/structure/types/manage/bar', $edit, t('Save content type'));
|
||||
$this->assertTrue(book_type_is_allowed('zebra'), 'Config book.settings:allowed_types contains the zebra 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
|
||||
// expected. The order should be:
|
||||
// @code
|
||||
// array(
|
||||
// 'page',
|
||||
// 'zebra',
|
||||
// );
|
||||
// @endcode
|
||||
$current_config = $this->config('book.settings')->get();
|
||||
$this->drupalPostForm('admin/structure/book/settings', array(), t('Save configuration'));
|
||||
$this->assertIdentical($current_config, $this->config('book.settings')->get());
|
||||
|
||||
$edit = array(
|
||||
'name' => 'Animal book',
|
||||
'type' => 'zebra',
|
||||
);
|
||||
$this->drupalPostForm('admin/structure/types/manage/zebra', $edit, t('Save content type'));
|
||||
|
||||
// Test the order of the book.settings::allowed_types configuration is as
|
||||
// expected. The order should be:
|
||||
// @code
|
||||
// array(
|
||||
// 'page',
|
||||
// 'zebra',
|
||||
// );
|
||||
// @endcode
|
||||
$current_config = $this->config('book.settings')->get();
|
||||
$this->drupalPostForm('admin/structure/book/settings', array(), t('Save configuration'));
|
||||
$this->assertIdentical($current_config, $this->config('book.settings')->get());
|
||||
|
||||
// Ensure that after all the node type changes book.settings:child_type has
|
||||
// the expected value.
|
||||
$this->assertEqual($this->config('book.settings')->get('child_type'), 'zebra');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests re-ordering of books.
|
||||
*/
|
||||
|
|
|
@ -23,7 +23,7 @@ class BookUninstallTest extends KernelTestBase {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('system', 'user', 'field', 'filter', 'text', 'entity_reference', 'node', 'book');
|
||||
public static $modules = ['system', 'user', 'field', 'filter', 'text', 'node', 'book'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
|
|
@ -20,11 +20,9 @@ class MigrateBookConfigsTest extends MigrateDrupal6TestBase {
|
|||
use SchemaCheckTestTrait;
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = array('book', 'system', 'node', 'field', 'text', 'entity_reference');
|
||||
public static $modules = ['book'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
|
|
@ -17,39 +17,19 @@ use Drupal\node\Entity\Node;
|
|||
*/
|
||||
class MigrateBookTest extends MigrateDrupal6TestBase {
|
||||
|
||||
public static $modules = array('book', 'system', 'node', 'field', 'text', 'entity_reference', 'user');
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['book'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->installEntitySchema('node');
|
||||
$this->installSchema('book', array('book'));
|
||||
$this->installSchema('node', array('node_access'));
|
||||
|
||||
// Create a default bogus mapping for all variants of d6_node.
|
||||
$id_mappings = array(
|
||||
'd6_node:*' => array(
|
||||
array(
|
||||
array(0),
|
||||
array(0),
|
||||
),
|
||||
),
|
||||
);
|
||||
for ($i = 4; $i <= 8; $i++) {
|
||||
$entity = entity_create('node', array(
|
||||
'type' => 'story',
|
||||
'title' => "Node $i",
|
||||
'nid' => $i,
|
||||
'status' => TRUE,
|
||||
));
|
||||
$entity->enforceIsNew();
|
||||
$entity->save();
|
||||
$id_mappings['d6_node__story'][] = array(array($i), array($i));
|
||||
}
|
||||
$this->prepareMigrations($id_mappings);
|
||||
$this->installSchema('book', ['book']);
|
||||
$this->installSchema('node', ['node_access']);
|
||||
$this->migrateContent();
|
||||
$this->executeMigration('d6_book');
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,11 @@
|
|||
* - below: The book item child items.
|
||||
* - title: The book link title.
|
||||
* - url: The book link URL, instance of \Drupal\Core\Url.
|
||||
* - is_expanded: TRUE if the link has visible children within the current
|
||||
* book tree.
|
||||
* - is_collapsed: TRUE if the link has children within the current book tree
|
||||
* that are not currently visible.
|
||||
* - in_active_trail: TRUE if the link is in the active trail.
|
||||
*
|
||||
* @ingroup themeable
|
||||
*/
|
||||
|
@ -31,14 +36,14 @@
|
|||
{% else %}
|
||||
<ul>
|
||||
{% endif %}
|
||||
{% for item in items %}
|
||||
<li{{ item.attributes }}>
|
||||
{{ link(item.title, item.url) }}
|
||||
{% if item.below %}
|
||||
{{ book_tree.book_links(item.below, attributes, menu_level + 1) }}
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
{% for item in items %}
|
||||
<li{{ item.attributes }}>
|
||||
{{ link(item.title, item.url) }}
|
||||
{% if item.below %}
|
||||
{{ book_tree.book_links(item.below, attributes, menu_level + 1) }}
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
* Implements hook_page_attachments().
|
||||
*/
|
||||
function book_test_page_attachments(array &$page) {
|
||||
$page['#cache']['tags'][] = 'book_test.debug_book_navigation_cache_context';
|
||||
if (\Drupal::state()->get('book_test.debug_book_navigation_cache_context', FALSE)) {
|
||||
drupal_set_message(\Drupal::service('cache_contexts_manager')->convertTokensToKeys(['route.book_navigation'])->getKeys()[0]);
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
namespace Drupal\Tests\book\Unit;
|
||||
|
||||
use Drupal\simpletest\AssertHelperTrait;
|
||||
use Drupal\Tests\UnitTestCase;
|
||||
|
||||
/**
|
||||
|
@ -15,6 +16,8 @@ use Drupal\Tests\UnitTestCase;
|
|||
*/
|
||||
class BookUninstallValidatorTest extends UnitTestCase {
|
||||
|
||||
use AssertHelperTrait;
|
||||
|
||||
/**
|
||||
* @var \Drupal\book\BookUninstallValidator|\PHPUnit_Framework_MockObject_MockObject
|
||||
*/
|
||||
|
@ -44,7 +47,7 @@ class BookUninstallValidatorTest extends UnitTestCase {
|
|||
$module = 'not_book';
|
||||
$expected = [];
|
||||
$reasons = $this->bookUninstallValidator->validate($module);
|
||||
$this->assertSame($expected, $reasons);
|
||||
$this->assertSame($expected, $this->castSafeStrings($reasons));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -61,7 +64,7 @@ class BookUninstallValidatorTest extends UnitTestCase {
|
|||
$module = 'book';
|
||||
$expected = [];
|
||||
$reasons = $this->bookUninstallValidator->validate($module);
|
||||
$this->assertSame($expected, $reasons);
|
||||
$this->assertSame($expected, $this->castSafeStrings($reasons));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -78,7 +81,7 @@ class BookUninstallValidatorTest extends UnitTestCase {
|
|||
$module = 'book';
|
||||
$expected = ['To uninstall Book, delete all content that has the Book content type'];
|
||||
$reasons = $this->bookUninstallValidator->validate($module);
|
||||
$this->assertSame($expected, $reasons);
|
||||
$this->assertSame($expected, $this->castSafeStrings($reasons));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -94,7 +97,7 @@ class BookUninstallValidatorTest extends UnitTestCase {
|
|||
$module = 'book';
|
||||
$expected = ['To uninstall Book, delete all content that is part of a book'];
|
||||
$reasons = $this->bookUninstallValidator->validate($module);
|
||||
$this->assertSame($expected, $reasons);
|
||||
$this->assertSame($expected, $this->castSafeStrings($reasons));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,90 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Tests\book\Unit\Plugin\migrate\source\d6\BookTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\Tests\book\Unit\Plugin\migrate\source\d6;
|
||||
|
||||
use Drupal\book\Plugin\migrate\source\d6\Book;
|
||||
use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase;
|
||||
|
||||
/**
|
||||
* @coversDefaultClass \Drupal\book\Plugin\migrate\source\d6\Book
|
||||
* @group book
|
||||
*/
|
||||
class BookTest extends MigrateSqlSourceTestCase {
|
||||
|
||||
const PLUGIN_CLASS = Book::class;
|
||||
|
||||
protected $migrationConfiguration = array(
|
||||
'id' => 'test',
|
||||
'source' => array(
|
||||
'plugin' => 'd6_book',
|
||||
),
|
||||
);
|
||||
|
||||
protected $expectedResults = array(
|
||||
array(
|
||||
'nid' => '4',
|
||||
'bid' => '4',
|
||||
'mlid' => '1',
|
||||
'plid' => '0',
|
||||
'weight' => '-10',
|
||||
'p1' => '1',
|
||||
'p2' => '0',
|
||||
'p3' => '0',
|
||||
'p4' => '0',
|
||||
'p5' => '0',
|
||||
'p6' => '0',
|
||||
'p7' => '0',
|
||||
'p8' => '0',
|
||||
'p9' => '0',
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
$this->databaseContents['book'] = array(
|
||||
array(
|
||||
'mlid' => '1',
|
||||
'nid' => '4',
|
||||
'bid' => '4',
|
||||
),
|
||||
);
|
||||
$this->databaseContents['menu_links'] = array(
|
||||
array(
|
||||
'menu_name' => 'book-toc-1',
|
||||
'mlid' => '1',
|
||||
'plid' => '0',
|
||||
'link_path' => 'node/4',
|
||||
'router_path' => 'node/%',
|
||||
'link_title' => 'Test top book title',
|
||||
'options' => 'a:0:{}',
|
||||
'module' => 'book',
|
||||
'hidden' => '0',
|
||||
'external' => '0',
|
||||
'has_children' => '1',
|
||||
'expanded' => '0',
|
||||
'weight' => '-10',
|
||||
'depth' => '1',
|
||||
'customized' => '0',
|
||||
'p1' => '1',
|
||||
'p2' => '0',
|
||||
'p3' => '0',
|
||||
'p4' => '0',
|
||||
'p5' => '0',
|
||||
'p6' => '0',
|
||||
'p7' => '0',
|
||||
'p8' => '0',
|
||||
'p9' => '0',
|
||||
'updated' => '0',
|
||||
),
|
||||
);
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue