getBookChildType returns null in all cases

Created on 1 October 2025, 3 days ago

Problem/Motivation

Child book pages throw an exception with the message

Symfony\Component\Routing\Exception\InvalidParameterException: Parameter "node_type" for route "node.add" must match "[^/]++" ("" given) to generate a corresponding URL. in Drupal\Core\Routing\UrlGenerator->doGenerate() (line 223 of core/lib/Drupal/Core/Routing/UrlGenerator.php).

Steps to reproduce

  1. Navigate to the child book page of any book.
  2. An exception is thrown.

Proposed resolution

The node_type check in BookHelperTrait getBookChildType() doesn't appear to be correct. It's checked for an array key on a string.

Remaining tasks

Fix the method.

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
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