I am working with books in drupal 8. I want to display a specific page("table of contenets") on the sidebar whenever any page of that book is accessed. "table of contents" is a book page. every page of book has two id's.

  • page_id
  • book_id

Page_id is unique for every page but book id is same for all pages. I believe contextual filter based on book_id might solve my issue. but I don't know how to add contextual filter based on book id.

here are the results of SELECT * FROM book

enter image description here

I can see this "Top level book from current node" . I think this is helpful to do my task. can anybody explain me how can use that option.

enter image description here

Need tons of help.

Thank you!

  • The Book module already provides a block that displays the table of contents. Does that not work for you? With Contextual Filters, you could try using "Top Level Book from current node", but Book is an old module with iffy Views support. Nov 24 at 13:36
  • I don't know where to find that block that displays table of contents. To be precise, I need to display two book pages on every book page url. one of them is "table of contents" . Nov 24 at 13:42
  • The block that displays the table of contents can be found with all the other blocks at /admin/structure/block. If you still need help, please edit your question to be more specific. For example, how many books is "some books"? If you only need this for a few books, and you won't be adding more, it will be faster to make some custom blocks. Also, you said two links on each page, one of which is table of contents. What is the other link? Nov 24 at 13:49
  • @PatrickKenny this question explains what I want link, need help sir! Nov 25 at 13:01

Your Answer

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

Browse other questions tagged or ask your own question.