Problem/Motivation
- Bug: missing escaping HTML before replacing variables in the subject
- Bug: token browser is missing for Verify emails (where the only token data is the global site)
- Feature: we'd like to add replacement to other fields, especially the plain text body
- Task: the current method is inconsistent. Token replacement happens in
TokenProcessor, variable replacement of the body inBodyEmailAdjusterand variable replacement of the subject inEmail.
Proposed resolution
- Extend
TokenProcessoralso to replace variables, rename it toReplacementProcessor, and add it to all emails. Use parameterstoken_dataandtoken_optionsto control the token replacement. - The metadata from the
Mailerattribute includes a valuetoken_typesso automatically use this to set thetoken_dataparameter. - Add HTML escaping before replacing variables if the value is plain text.
- Create ReplaceableProcessorInterface for registering token/variable replacement in an extensible way
Remaining tasks
User interface changes
API changes
Affects Mailer implementations that replace tokens.
- Remove all code relating to TokenTrait (1.x) or TokenProcessor (earlier version of 2.x).
- Use $email->setParam('token_options') if needed to set options
Data model changes
Issue fork symfony_mailer-3529416
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
adamps commentedComment #4
adamps commentedComment #6
adamps commentedComment #8
adamps commentedUnfortunately I only tested with site tokens - which work - but other tokens are broken.
Comment #10
adamps commented