By adamps on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
2.x
Introduced in version:
2.0.0-alpha3
Description:
The token data replacement feature has been improved to increase consistency, efficiency and clarity.
- TokenTrait has been removed. In many cases token replacement is now automatic based on metadata from the Mailer attribute value
token_types. - Code can set parameters token_data and token_options to control the token replacement.
- Token replacement now occurs before rendering rather than after (except when the email body didn't exist until it was created by a template in the rendering process).
Before
use TokenProcessorTrait;
// Remaining lines not normally needed.
$this->tokenOptions(['callback' => 'user_mail_tokens', 'clear' => TRUE]);
$this->tokenData(['node' => $node]);
After
// No replacement code is required for the first 'before' line.
// Remaining lines not normally needed.
$this->setParam('token_options', ['callback' => 'user_mail_tokens', 'clear' => TRUE]);
$this->setParam('token_data', ['node' => $node]);
Impacts:
Module developers