Tokens are not replaced on Contact forms

Created on 25 February 2024, 4 months ago
Updated 5 March 2024, 4 months ago

Problem/Motivation

Tokens used on contact forms are not being replaced.

Steps to reproduce

Enable the override for the Contact form.
On the policy, add a token to the contact form body, such as [site:name]
Send an email and check that the token wasn't replaced by its actual value.

Proposed resolution

Checking on #3258789: System emails sent from actions missing token replacement β†’ and after some debugging, I noticed that just adding use TokenProcessorTrait; to the ContactPageEmailBuilder solved the problem for me. But I was wondering if this TokenProcessorTrait shouldn't actually be used on all EmailBuilder's... Can't we, for example, add the token replacement logic into EmailProcessorTrait::postRender?

Or maybe I did smth wrong on my configuration...?

Remaining tasks

Discuss about the problem and provide a patch

User interface changes

-

πŸ’¬ Support request
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡§πŸ‡·Brazil hmendes

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

Comments & Activities

  • Issue created by @hmendes
  • πŸ‡§πŸ‡·Brazil hmendes

    If anyone needs, that's the patch I'm using.

  • πŸ‡¬πŸ‡§United Kingdom AdamPS

    There is a variable you can use {{ site_name }}

    Tokens aren't enabled by default for two reasons

    • by default there would be no tokens available except a few global ones
    • replacing tokens could cause some unwanted replacements of text that happened to look like a token
Production build 0.69.0 2024