book_title variable in book-navigation.html.twig contains the page title

Created on 13 March 2009, almost 16 years ago
Updated 4 September 2024, 4 months ago

Problem/Motivation

I wanted to add a link to the first page of the book in the book navigation. The $book_url variable contains the url of the first page, however, $book_title contains the title of the current page!

From book.module:

function template_preprocess_book_navigation(&$variables) {
  $book_link = $variables['book_link'];

  // Provide extra variables for themers. Not needed by default.
  $variables['book_id'] = $book_link['bid'];
  $variables['book_title'] = check_plain($book_link['link_title']);
  $variables['book_url'] = 'node/'. $book_link['bid'];
  ...

Not sure what the best way to fix this is - I have resorted to querying the node table in a preprocess function.

Steps to reproduce

Proposed resolution

Remaining tasks

IS update
Update patch
review
commit

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Needs work

Version

2.0

Component
Book 

Last updated 3 days ago

Created by

🇬🇧United Kingdom jacktonkin

Live updates comments and jobs are added and updated live.
  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024