When I try to use the $book_title variable in book-navigation.tpl.php it resolves to the title of the current book page, not the title of the top-level page (which it is supposed to).

When I try to use the $book_url variable it also returns the wrong value, this time we get a double node/ string, i.e. node/node/x (at least x is the right value - the node id of the top level page).

Comments

chekov’s picture

The second problem is easy to fix:

In template_preprocess_book_navigation

Change

$variables['book_url'] = 'node/' . $book_link['bid'];

to

$variables['book_url'] = $book_link['bid'];

The second one is less obvious - the book title is not available in the $book_link array passed to the function. I'm insufficiently familiar with the code to dig any deeper.

thrnio’s picture

Issue summary: View changes
Status: Active » Closed (duplicate)
Related issues: +#400982: book_title variable in book-navigation.html.twig contains the page title

Duplicate of issue #400982