diff --git a/core/modules/book/src/BookManager.php b/core/modules/book/src/BookManager.php
index bd0d419..2e8a944 100644
--- a/core/modules/book/src/BookManager.php
+++ b/core/modules/book/src/BookManager.php
@@ -539,30 +539,28 @@ protected function buildItems(array $tree) {
$items = [];
foreach ($tree as $data) {
- $class = ['menu-item'];
- // Generally we only deal with visible links, but just in case.
+ $element = [];
+
if (!$data['link']['access']) {
continue;
}
// Set a class for the
-tag. Since $data['below'] may contain local
- // tasks, only set 'expanded' class if the link also has children within
+ // tasks, only set 'expanded' true if the link also has children within
// the current book.
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 link is in active trail.
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();
diff --git a/core/modules/toolbar/templates/menu--toolbar.html.twig b/core/modules/toolbar/templates/menu--toolbar.html.twig
index 4165072..e8e6b45 100644
--- a/core/modules/toolbar/templates/menu--toolbar.html.twig
+++ b/core/modules/toolbar/templates/menu--toolbar.html.twig
@@ -32,14 +32,14 @@