The URL for each item within a book tree should be an instance of \Drupal\Core\Url but is not

Created on 30 June 2020, almost 4 years ago
Updated 24 April 2024, 2 months ago

In the available variables section of core/modules/book/templates/book-tree.html.twig within items we have (amongst others):

* - url: The book link URL, instance of \Drupal\Core\Url.

However this is no longer true. In https://www.drupal.org/project/drupal/issues/3010378 β†’ it was changed from a Url object to a string in the format entity:node/12345. We found this after updating Drupal Core and finding some of our custom code was no longer working.

Proposed resolution:
1. Either revert the change, so that url continues to be a Url object
or
2. Update the book-tree.html.twig documentation and publish a change record so anyone relying on the current/previous behaviour is able to update their code accordingly
or
3. Patch to create a Url object without loading a node, this will restoe item.url to being a Url object and maintains the performance boost originally sought out by not loading the node. This is compatible with the link Twig function as well.

We have a patch for option 3, but need framework manage review to confirm this is the right approach.

πŸ› Bug report
Status

Needs work

Version

1.0

Component
BookΒ  β†’

Last updated 1 day ago

  • Maintained by
  • πŸ‡ΊπŸ‡ΈUnited States @pwolanin
Created by

πŸ‡¬πŸ‡§United Kingdom nicrodgers Monmouthshire, UK

Live updates comments and jobs are added and updated live.
  • Needs framework manager review

    It is used to alert the framework manager core committer(s) that an issue significantly impacts (or has the potential to impact) multiple subsystems or represents a significant change or addition in architecture or public APIs, and their signoff is needed (see the governance policy draft for more information). If an issue significantly impacts only one subsystem, use Needs subsystem maintainer review instead, and make sure the issue component is set to the correct subsystem.

  • 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

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.69.0 2024