Book token doesn't work in pathauto while ECA is enabled

Created on 9 February 2023, almost 2 years ago
Updated 15 February 2023, almost 2 years ago

Problem/Motivation

We use book module to allow our contributors to create child nodes of preexisting books. We use pathauto with book related tokens and discovered path of book pages are wrongly set. Comparing enabled modules with another website where pathauto works well, we isolated the issue comes when ECA is enabled.
We found the issue #3314123 and tried an edited version of the band-aid suggested here and it seems to solves the problem.

Steps to reproduce

in a fresh Drupal install,

  1. enable book + pathauto + token
  2. on page /admin/config/search/path/patterns/add add content url alias pattern `[node:book:root:title]/[node:title]` to generate alias from menu parents' paths + node title
  3. Add a "Book page" node L1, and create a new book
  4. Add a "Book page" Node L2 and attach it to the book L1 - as expected, alias will be constructed as /node-l1/node-l2/
  5. Enable ECA Core
  6. Add another Node L2a and attach it to the book L1 - result: the generated url alias will omit the name of the book and consist of the node title only

Proposed resolution

Like I said before, an edited version of the band-aid suggested in issue #3314123 works but maybe it is not the greatest solution.

if ($type === 'book') {
  $real_token_type = 'book';
}

Also, I think book module is unlikely to be refactorised with entities, so maybe the patch haven't to be a simple band-aid but a more long term solution.

🐛 Bug report
Status

Fixed

Version

1.2

Component

Code

Created by

🇫🇷France gjonc

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024