UPDATE: I should mention that this is concerning the Book Navigation Block

I'm using the book module to display children of a book in a side menu. It displays the title of the book and it's children just fine. However the children of the children don't appear even after clicking on the parent page.

I searched in the module settings for book navigation however I can't seem to find a way to display them.

Is there anything that could possibly affect what sub items are displayed in a book?

  • It would be helpful for you to include the specific CSS styles that you applied that seemed to cause the problem. – Aaron Oct 16 '15 at 19:44
  • Unfortunately after attempting to reproduce the problem again I wasn't able to track down the CSS style that caused the issue on the other theme. Perhaps something else triggered it. I have removed that part of the question. Also I removed every stylesheet on the new theme and still experienced the same issue. – Matt Oct 19 '15 at 13:23

book_children(), which is used in the preprocessor for the "book_nagivation" theme hook (template_preprocess_book_navigation()) only retrieves the immediate children of the current book item, so you wouldn't expect the default "Book navigation" block provided by the Book module to show all children of the current book item recursively.

If you wanted to modify the behavior of this block in your theme, you could clone the template_preprocess_book_navigation() from book.module, placing the function in the template.php file for your theme and renaming it to yourthemename_preprocess_book_navigation(), and then create and call a modified clone of book_children() that recursively collected all links in the book beneath the passed link.

If the behavior you wanted was to display the standard tree for all interior book pages, but display book's entire outline only when you are viewing main page of the book, you could alter your yourthemename_preprocess_book_navigation() function so that it only calls the "get recursive tree" function when the $book_link doesn't have a parent ($book_link['plid'] == 0), and call book_children() for all other cases.

  • Sorry I should have been more clear. Even when visiting a page in the book that has sub items the sub items don't appear. Only the top level no matter how far I go down. – Matt Oct 19 '15 at 15:36

This snippet has a level-variable. In the comments something is said about Drupal 7. Maybe you can do something with it. https://www.drupal.org/node/44648

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.