When ECA is active, token replacement in pathauto no longer works

Created on 7 October 2022, about 2 years ago
Updated 8 February 2023, almost 2 years ago

Problem/Motivation

Dear maintainers! In one of our projects, we stumbled upon a problem with pathauto´s token replacement in conjunction with ECA.

Pathauto provides a replacement for the token [node:menu-link:parents:join-path] - which, for some reason, is not executed when ECA (Core) is enabled.

Steps to reproduce

in a fresh Drupal install,

  1. enable pathauto + token
  2. on page /admin/config/search/path/patterns/add add content url alias pattern `[node:menu-link:parents:join-path]/[node:title]` to generate alias from menu parents' paths + node title
  3. add a node L1, provide menu link in main nav
  4. add a Node L2, attach it to main nav with parent: Node L1 - as expected, alias will be constructed as /node-l1/node-l2/
  5. enable ECA Core
  6. add another Node L2a, attach it to main nav with parent: Node L1 - result: the generated url alias will omit the path(s) of the parent(s) and consist of the node title only

Sorry, I am not able to propose a solution. I am not even sure whether this is a problem with ECA at all or whether it somehow occurs just with the module enabled. The only hint I can provide is: when replacing the token named 'join-path', pathauto expects the $type to be "array" - exactly this expected type no longer shows up once ECA is enabled.

🐛 Bug report
Status

Fixed

Version

1.1

Component

Code

Created by

🇩🇪Germany kgertz Konstanz

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

  • 🇫🇷France gjonc

    Hello, we encountered the same issue using book tokens in pathauto. If ECA is enabled, the token is empty and the node path is incorrect.
    We tried and edited band-aid like the one you suggest here and its seems to work.

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

    Because books aren't entities, the $real_token_type for book tokens is set to 'node'.

    It is unlikely that book module will be refactored with entities. So maybe book tokens need a band-aid like menu-link or specific case in getTokenType.

  • 🇩🇪Germany mxh Offenburg

    @gjonc This issue is closed. Could you please open a new issue for your encountered problem? You may also relate from that new issue to this one. Thanks!

Production build 0.71.5 2024