Score:0

How to add contextual filter?

br flag

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!

cn flag
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.
Steve Siddu avatar
br flag
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" .
cn flag
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?
Steve Siddu avatar
br flag
@PatrickKenny this question explains what I want [link](https://drupal.stackexchange.com/questions/308393/how-to-customize-table-of-contents-block-of-book-module), need help sir!
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.