Global tokens not replaced

Created on 27 April 2023, over 1 year ago
Updated 18 October 2023, about 1 year ago

Problem/Motivation

I've a custom global token, but it's not replaced. In 2.0.0, the value is as literal token, in 2.x the value is empty.

Steps to reproduce

Use a global custom token as argument.

Proposed resolution

I'm attaching a patch which I've tested and it works for me.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom kenorb

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

Comments & Activities

  • Issue created by @kenorb
  • πŸ‡¬πŸ‡§United Kingdom kenorb

    I'm attaching a patch file.

  • Status changed to Needs review over 1 year ago
  • πŸ‡¬πŸ‡§United Kingdom kenorb
  • πŸ‡¨πŸ‡¦Canada joelseguin Ontario, Canada

    Thanks @kenorb - I can confirm that the patch works great. I was attempting to add a date token [current-date:html_year] and was wondering why it wasn't getting applied.

  • Status changed to RTBC about 1 year ago
  • πŸ‡©πŸ‡ͺGermany kreatIL

    I can also confirm patch #2 fixes the issue. In my case [current-date:custom] did not get replaced at first. With the patch being applied it works like a charm. Thank you.

  • Status changed to Needs review about 1 year ago
  • πŸ‡¨πŸ‡¦Canada smulvih2 Canada 🍁

    I was experiencing the same issue, but patch #2 did not fix the issue for me. In my case the token is [current-user:field_organization:target_id]. The current-user token is the first to be replaced within it's own if statement. Then in a later if statement if $tokens[$token_entity_type] is not being used then it overwrites my current-user value.

    The original ticket that introduced the else {$argument = '';} code (related issue) aims to catch when the token cannot be replaced, instead of returning the token back it just returns a blank string. I have captured this in a preg_match at the end of the if statements looking at replacing the token with it's value.

    Please give this a test for your cases and let me know if this works for everyone. Thanks!

  • πŸ‡©πŸ‡ͺGermany kreatIL

    @smulvih2: Thank you for submitting the patch. I've tested it in my environment, and it successfully fixed the token replacement issue I was experiencing.

  • πŸ‡ΊπŸ‡ΈUnited States rudy.barrett

    Confirmed this fixes my views with argument tokens of [current-user:field_custom:name] as well.

  • Status changed to Fixed about 1 year ago
  • πŸ‡¨πŸ‡¦Canada smulvih2 Canada 🍁

    Pushed out a new release 2.0.2 with this fix. Hope this gets everyone past the global token replacement issue.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024