Plain-text Token field tokens are double escaped.

Created on 1 October 2020, over 4 years ago
Updated 27 December 2023, over 1 year ago

Problem/Motivation

If a DS token field is added using the plain_text format with a token inside the text, the token will be double escaped.

Currently Drupal\Core\Utility\Token->replace() escapes all tokens by default @see #2580723: Fix token system confusion, with new function Token::replacePlain() . So if using plain_text, the result escaped again.

Steps to reproduce

Proposed resolution

Detect if the format is plain_text, if it is then un-escape the token.
[technically, we escape all the text first, add the escaped token (so both are escaped, then we un-escape both, so they can re-escaped again later]

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Closed: won't fix

Version

3.0

Component

Code

Created by

🇦🇺Australia silverham

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

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.

Production build 0.71.5 2024