Score:0

Display the last page in a BOOK content type as a link?

kr flag

I'm currently using the core BOOK content type as a form of discussions. I created a views page with all the books and titles exposed. But I also want to append the last page of the book in the Views page. Setting the Depth = 1 I get the first page of the book and title, which is correct. But how do I set it to show the last Depth of the book so it can create a link to the last page?

enter image description here

Score:0
mx flag

Showing only the latest anything is too complicated a query.

You first have to include all items into Views, then sort them according to your desired criteria, and when your item is at the top of the list restrict Views to only show one item. That is how you can get the Book Page with largest Book Weight number, or Changed field, if you're wanting content that is latest to have been changed.

Having only one item needs to be incorporated into another query, which means another Views, so you can use your "latest" info in a list of other items.

In your case you need to create separate Views of Book Discussions with Depth 2, add Sorting according to Depth, Weight, or Changed (what ever criteria you mean by "last"), and set the Pager to show only 1 item in results. This Views is a helper Views, to be embedded into your original Views. To make the connection you also need to add the Contextual Filter for the Book parent (Page Depth 1?) that will then be used in your original Views to show the correct Page for the correct Book title in the list of all Books.

Then you need to install a contributed module that enables you to embed Views Displays into other Views Displays: Views Field View

Be mindful that combining queries like this can cause performance issues, these types of queries are generally speaking slower than regular Views and depending on the number of your data items can be heavy on performance.

With that module installed edit your original Views of Book titles and add a new Field (Global:View field). You will need to save these Field settings in two steps, (select, save, select, save), and you might need to have the Book Parent ID present in the original Views (you can set it to "Exclude from display"), that field needs to match the Contextual filter Field from your helper Views.

You can look up the actual argument name under "Replacement patterns". Read more on the GitLab page for the module: views_field_view

I sit in a Tesla and translated this thread with Ai:

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.