diff --git a/core/modules/book/src/Plugin/Block/BookNavigationBlock.php b/core/modules/book/src/Plugin/Block/BookNavigationBlock.php index b232fbf..6967077 100644 --- a/core/modules/book/src/Plugin/Block/BookNavigationBlock.php +++ b/core/modules/book/src/Plugin/Block/BookNavigationBlock.php @@ -156,9 +156,12 @@ public function build() { } } elseif ($current_bid) { - // Only display this block when the user is browsing a book. - $query = \Drupal::entityQuery('node'); - $nid = $query->condition('nid', $node->book['bid'], '=')->execute(); + // Only display this block when the user is browsing a book and do + // not show unpublished books. + $nid = \Drupal::entityQuery('node') + ->condition('nid', $node->book['bid'], '=') + ->condition('status', NODE_PUBLISHED) + ->execute(); // Only show the block if the user has view access for the top-level node. if ($nid) {