Change record status: 
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.

  1. TokenTrait has been removed. In many cases token replacement is now automatic based on metadata from the Mailer attribute value token_types.
  2. Code can set parameters token_data and token_options to control the token replacement.
  3. 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