Token replacement in block not working

Created on 22 July 2022, over 2 years ago
Updated 1 October 2024, 6 months ago

Problem/Motivation

Tokens are no longer replaced because $node is undefined.

Steps to reproduce

Add tokens to add to any output, and place Add to Any as a block.

Proposed resolution

Check for node as object from route parameters in addition to integer.

Remaining tasks

Patch needs review.

🐛 Bug report
Status

Active

Version

1.16

Component

Code

Created by

🇨🇦Canada ibullock London, ON

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.

  • First commit to issue fork.
  • 🇨🇭Switzerland das-peter

    Hijacking this because there's still an issue with token replacements e.g. if one accesses a page without having the permissions.
    In such a case the block won't get the necessary node instance and hence skips the token replacement entirely.
    Which is a shame because site wide tokens e.g. [site:base-path] aren't replaced either.

    Created a MR with an approach that makes the token replacement data optional but always runs the replacement.
    Only thing I wonder is if we should enable the clear flag in the token replacement.

Production build 0.71.5 2024