Commit 141d7d90 authored by Dries's avatar Dries

Issue #2209035 by pwolanin: Remove remaining/stray menu_link references from book module code.

parent 1d58c60a
......@@ -5,6 +5,5 @@ package: Core
version: VERSION
core: 8.x
dependencies:
- menu_link
- node
configure: book.settings
......@@ -9,11 +9,8 @@
* Implements hook_uninstall().
*/
function book_uninstall() {
// Delete menu links.
db_delete('menu_links')
->condition('module', 'book')
->execute();
menu_cache_clear_all();
// Clear book data out of the cache.
\Drupal::cache('menu')->deleteAll();
}
/**
......@@ -21,7 +18,7 @@ function book_uninstall() {
*/
function book_schema() {
$schema['book'] = array(
'description' => 'Stores book outline information. Uniquely connects each node in the outline to a link in {menu_links}',
'description' => 'Stores book outline information. Uniquely defines the location of each node in the book outline',
'fields' => array(
'nid' => array(
'type' => 'int',
......@@ -38,7 +35,7 @@ function book_schema() {
'description' => "The book ID is the {book}.nid of the top-level page.",
),
'pid' => array(
'description' => 'The parent ID (pid) is the id of the node above in the hierarchy, or zero if the node is at the top level in its menu.',
'description' => 'The parent ID (pid) is the id of the node above in the hierarchy, or zero if the node is at the top level in its outline.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
......
......@@ -29,7 +29,7 @@ function book_help($path, $arg) {
$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' => \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 menu.') . '</dd>';
$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>';
$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>';
......@@ -50,6 +50,10 @@ function book_theme() {
'variables' => array('book_link' => NULL),
'template' => 'book-navigation',
),
'book_tree' => array(
'render element' => 'tree',
'template' => 'book-tree',
),
'book_link' => array(
'render element' => 'element',
),
......@@ -714,6 +718,13 @@ function template_preprocess_book_node_export_html(&$variables) {
$variables['content'] = $variables['node']->rendered;
}
/**
* Implements template_preprocess_HOOK() for theme_book_tree().
*/
function template_preprocess_book_tree(&$variables) {
$variables['tree'] = $variables['tree']['#children'];
}
/**
* Returns HTML for a book link and subtree.
*
......
......@@ -546,8 +546,8 @@ public function bookTreeOutput(array $tree) {
// Make sure drupal_render() does not re-order the links.
$build['#sorted'] = TRUE;
// Add the theme wrapper for outer markup.
// Allow menu-specific theme overrides.
$build['#theme_wrappers'][] = 'menu_tree__book_toc_' . $data['link']['nid'];
// Allow book-specific theme overrides.
$build['#theme_wrappers'][] = 'book_tree__book_toc_' . $data['link']['bid'];
}
return $build;
......@@ -919,8 +919,9 @@ protected function _menu_tree_check_access(&$tree) {
$this->_menu_tree_check_access($tree[$key]['below']);
}
// The weights are made a uniform 5 digits by adding 50000 as an offset.
// After _menu_link_translate(), $item['title'] has the localized link title.
// Adding the mlid to the end of the index insures that it is unique.
// After calling $this->bookLinkTranslate(), $item['title'] has the
// translated title. Adding the nid to the end of the index insures that
// it is unique.
$new_tree[(50000 + $item['weight']) . ' ' . $item['title'] . ' ' . $item['nid']] = $tree[$key];
}
}
......
{#
/**
* @file
* Returns HTML for a wrapper for a book sub-tree.
*
* Available variables:
* - tree: An HTML string containing the tree's items.
*
* @see template_preprocess_book_tree()
*
* @ingroup themeable
*/
#}
<ul class="menu">{{ tree }}</ul>
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