Update core 8.3.0
This commit is contained in:
parent
da7a7918f8
commit
cd7a898e66
6144 changed files with 132297 additions and 87747 deletions
|
|
@ -25,17 +25,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>.', [':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>.', [':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.', [':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.', [':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.", [':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>';
|
||||
|
|
@ -47,7 +47,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>.', [':book' => \Drupal::url('book.render'), ':book-admin' => \Drupal::url('book.admin')]) . '</p>';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -55,23 +55,23 @@ function book_help($route_name, RouteMatchInterface $route_match) {
|
|||
* Implements hook_theme().
|
||||
*/
|
||||
function book_theme() {
|
||||
return array(
|
||||
'book_navigation' => array(
|
||||
'variables' => array('book_link' => NULL),
|
||||
),
|
||||
'book_tree' => array(
|
||||
'variables' => array('items' => array(), 'attributes' => array()),
|
||||
),
|
||||
'book_export_html' => array(
|
||||
'variables' => array('title' => NULL, 'contents' => NULL, 'depth' => NULL),
|
||||
),
|
||||
'book_all_books_block' => array(
|
||||
return [
|
||||
'book_navigation' => [
|
||||
'variables' => ['book_link' => NULL],
|
||||
],
|
||||
'book_tree' => [
|
||||
'variables' => ['items' => [], 'attributes' => []],
|
||||
],
|
||||
'book_export_html' => [
|
||||
'variables' => ['title' => NULL, 'contents' => NULL, 'depth' => NULL],
|
||||
],
|
||||
'book_all_books_block' => [
|
||||
'render element' => 'book_menus',
|
||||
),
|
||||
'book_node_export_html' => array(
|
||||
'variables' => array('node' => NULL, 'content' => NULL, 'children' => NULL),
|
||||
),
|
||||
);
|
||||
],
|
||||
'book_node_export_html' => [
|
||||
'variables' => ['node' => NULL, 'content' => NULL, 'children' => NULL],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -97,31 +97,31 @@ function book_node_links_alter(array &$links, NodeInterface $node, array &$conte
|
|||
$child_type = \Drupal::config('book.settings')->get('child_type');
|
||||
$access_control_handler = \Drupal::entityManager()->getAccessControlHandler('node');
|
||||
if (($account->hasPermission('add content to books') || $account->hasPermission('administer book outlines')) && $access_control_handler->createAccess($child_type) && $node->isPublished() && $node->book['depth'] < BookManager::BOOK_MAX_DEPTH) {
|
||||
$book_links['book_add_child'] = array(
|
||||
$book_links['book_add_child'] = [
|
||||
'title' => t('Add child page'),
|
||||
'url' => Url::fromRoute('node.add', ['node_type' => $child_type], ['query' => ['parent' => $node->id()]]),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
if ($account->hasPermission('access printer-friendly version')) {
|
||||
$book_links['book_printer'] = array(
|
||||
$book_links['book_printer'] = [
|
||||
'title' => t('Printer-friendly version'),
|
||||
'url' => Url::fromRoute('book.export', [
|
||||
'type' => 'html',
|
||||
'node' => $node->id(),
|
||||
]),
|
||||
'attributes' => array('title' => t('Show a printer-friendly version of this book page and its sub-pages.'))
|
||||
);
|
||||
'attributes' => ['title' => t('Show a printer-friendly version of this book page and its sub-pages.')]
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($book_links)) {
|
||||
$links['book'] = array(
|
||||
$links['book'] = [
|
||||
'#theme' => 'links__node__book',
|
||||
'#links' => $book_links,
|
||||
'#attributes' => array('class' => array('links', 'inline')),
|
||||
);
|
||||
'#attributes' => ['class' => ['links', 'inline']],
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -148,17 +148,17 @@ function book_form_node_form_alter(&$form, FormStateInterface $form_state, $form
|
|||
$collapsed = !($node->isNew() && !empty($node->book['pid']));
|
||||
$form = \Drupal::service('book.manager')->addFormElements($form, $form_state, $node, $account, $collapsed);
|
||||
// The "js-hide" class hides submit button when Javascript is enabled.
|
||||
$form['book']['pick-book'] = array(
|
||||
$form['book']['pick-book'] = [
|
||||
'#type' => 'submit',
|
||||
'#value' => t('Change book (update list of parents)'),
|
||||
'#submit' => array('book_pick_book_nojs_submit'),
|
||||
'#submit' => ['book_pick_book_nojs_submit'],
|
||||
'#weight' => 20,
|
||||
'#attributes' => array(
|
||||
'class' => array(
|
||||
'#attributes' => [
|
||||
'class' => [
|
||||
'js-hide',
|
||||
),
|
||||
),
|
||||
);
|
||||
],
|
||||
],
|
||||
];
|
||||
$form['#entity_builders'][] = 'book_node_builder';
|
||||
}
|
||||
}
|
||||
|
|
@ -232,7 +232,7 @@ function book_node_view(array &$build, EntityInterface $node, EntityViewDisplayI
|
|||
if (!$book_node->access()) {
|
||||
return;
|
||||
}
|
||||
$build['book_navigation'] = array(
|
||||
$build['book_navigation'] = [
|
||||
'#theme' => 'book_navigation',
|
||||
'#book_link' => $node->book,
|
||||
'#weight' => 100,
|
||||
|
|
@ -241,7 +241,7 @@ function book_node_view(array &$build, EntityInterface $node, EntityViewDisplayI
|
|||
'#cache' => [
|
||||
'tags' => $node->getEntityType()->getListCacheTags(),
|
||||
],
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -295,7 +295,7 @@ function book_node_prepare_form(NodeInterface $node, $operation, FormStateInterf
|
|||
// Prepare defaults for the add/edit form.
|
||||
$account = \Drupal::currentUser();
|
||||
if (empty($node->book) && ($account->hasPermission('add content to books') || $account->hasPermission('administer book outlines'))) {
|
||||
$node->book = array();
|
||||
$node->book = [];
|
||||
|
||||
$query = \Drupal::request()->query;
|
||||
if ($node->isNew() && !is_null($query->get('parent')) && is_numeric($query->get('parent'))) {
|
||||
|
|
@ -341,10 +341,10 @@ function book_form_node_confirm_form_alter(&$form, FormStateInterface $form_stat
|
|||
}
|
||||
|
||||
if (isset($node->book) && $node->book['has_children']) {
|
||||
$form['book_warning'] = array(
|
||||
'#markup' => '<p>' . t('%title is part of a book outline, and has associated child pages. If you proceed with deletion, the child pages will be relocated automatically.', array('%title' => $node->label())) . '</p>',
|
||||
$form['book_warning'] = [
|
||||
'#markup' => '<p>' . t('%title is part of a book outline, and has associated child pages. If you proceed with deletion, the child pages will be relocated automatically.', ['%title' => $node->label()]) . '</p>',
|
||||
'#weight' => -10,
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -365,13 +365,13 @@ function book_form_node_confirm_form_alter(&$form, FormStateInterface $form_stat
|
|||
function template_preprocess_book_all_books_block(&$variables) {
|
||||
// Remove all non-renderable elements.
|
||||
$elements = $variables['book_menus'];
|
||||
$variables['book_menus'] = array();
|
||||
$variables['book_menus'] = [];
|
||||
foreach (Element::children($elements) as $index) {
|
||||
$variables['book_menus'][] = array(
|
||||
$variables['book_menus'][] = [
|
||||
'id' => $index,
|
||||
'menu' => $elements[$index],
|
||||
'title' => $elements[$index]['#book_title'],
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -391,7 +391,7 @@ function template_preprocess_book_navigation(&$variables) {
|
|||
// Provide extra variables for themers. Not needed by default.
|
||||
$variables['book_id'] = $book_link['bid'];
|
||||
$variables['book_title'] = $book_link['link_title'];
|
||||
$variables['book_url'] = \Drupal::url('entity.node.canonical', array('node' => $book_link['bid']));
|
||||
$variables['book_url'] = \Drupal::url('entity.node.canonical', ['node' => $book_link['bid']]);
|
||||
$variables['current_depth'] = $book_link['depth'];
|
||||
$variables['tree'] = '';
|
||||
|
||||
|
|
@ -401,14 +401,14 @@ function template_preprocess_book_navigation(&$variables) {
|
|||
if ($book_link['nid']) {
|
||||
$variables['tree'] = $book_outline->childrenLinks($book_link);
|
||||
|
||||
$build = array();
|
||||
$build = [];
|
||||
|
||||
if ($prev = $book_outline->prevLink($book_link)) {
|
||||
$prev_href = \Drupal::url('entity.node.canonical', array('node' => $prev['nid']));
|
||||
$build['#attached']['html_head_link'][][] = array(
|
||||
$prev_href = \Drupal::url('entity.node.canonical', ['node' => $prev['nid']]);
|
||||
$build['#attached']['html_head_link'][][] = [
|
||||
'rel' => 'prev',
|
||||
'href' => $prev_href,
|
||||
);
|
||||
];
|
||||
$variables['prev_url'] = $prev_href;
|
||||
$variables['prev_title'] = $prev['title'];
|
||||
}
|
||||
|
|
@ -416,21 +416,21 @@ function template_preprocess_book_navigation(&$variables) {
|
|||
/** @var \Drupal\book\BookManagerInterface $book_manager */
|
||||
$book_manager = \Drupal::service('book.manager');
|
||||
if ($book_link['pid'] && $parent = $book_manager->loadBookLink($book_link['pid'])) {
|
||||
$parent_href = \Drupal::url('entity.node.canonical', array('node' => $book_link['pid']));
|
||||
$build['#attached']['html_head_link'][][] = array(
|
||||
$parent_href = \Drupal::url('entity.node.canonical', ['node' => $book_link['pid']]);
|
||||
$build['#attached']['html_head_link'][][] = [
|
||||
'rel' => 'up',
|
||||
'href' => $parent_href,
|
||||
);
|
||||
];
|
||||
$variables['parent_url'] = $parent_href;
|
||||
$variables['parent_title'] = $parent['title'];
|
||||
}
|
||||
|
||||
if ($next = $book_outline->nextLink($book_link)) {
|
||||
$next_href = \Drupal::url('entity.node.canonical', array('node' => $next['nid']));
|
||||
$build['#attached']['html_head_link'][][] = array(
|
||||
$next_href = \Drupal::url('entity.node.canonical', ['node' => $next['nid']]);
|
||||
$build['#attached']['html_head_link'][][] = [
|
||||
'rel' => 'next',
|
||||
'href' => $next_href,
|
||||
);
|
||||
];
|
||||
$variables['next_url'] = $next_href;
|
||||
$variables['next_title'] = $next['title'];
|
||||
}
|
||||
|
|
@ -442,7 +442,7 @@ function template_preprocess_book_navigation(&$variables) {
|
|||
|
||||
$variables['has_links'] = FALSE;
|
||||
// Link variables to filter for values and set state of the flag variable.
|
||||
$links = array('prev_url', 'prev_title', 'parent_url', 'parent_title', 'next_url', 'next_title');
|
||||
$links = ['prev_url', 'prev_title', 'parent_url', 'parent_title', 'next_url', 'next_title'];
|
||||
foreach ($links as $link) {
|
||||
if (isset($variables[$link])) {
|
||||
// Flag when there is a value.
|
||||
|
|
@ -475,7 +475,7 @@ function template_preprocess_book_export_html(&$variables) {
|
|||
$variables['language_rtl'] = ($language_interface->getDirection() == LanguageInterface::DIRECTION_RTL);
|
||||
|
||||
// HTML element attributes.
|
||||
$attributes = array();
|
||||
$attributes = [];
|
||||
$attributes['lang'] = $language_interface->getId();
|
||||
$attributes['dir'] = $language_interface->getDirection();
|
||||
$variables['html_attributes'] = new Attribute($attributes);
|
||||
|
|
|
|||
Reference in a new issue