diff --git a/core/modules/book/src/BookManager.php b/core/modules/book/src/BookManager.php index d0cf791d2a..70ae7b307a 100644 --- a/core/modules/book/src/BookManager.php +++ b/core/modules/book/src/BookManager.php @@ -1087,6 +1087,9 @@ protected function buildBookOutlineData(array $links, array $parents = [], $dept protected function buildBookOutlineRecursive(&$links, $parents, $depth) { $tree = []; $node = \Drupal::routeMatch()->getParameter('node'); + if (!($node instance of NodeInterface)) { + $node = $this->entityTypeManager->getStorage('node')->load($node); + } while ($item = array_pop($links)) { // Check if item belongs to the current page. $item['is_active'] = ($node && $node->id() == $item['nid']) ? TRUE : FALSE;