Token Replacement
Both message's body and subject allow the use of tokens.
By default, every message can use global tokens and a sender-recipient token which provides tokens for the account of the user that will receive the message. You can safely use this token to show a greeting with the user's name because each message is rendered separately for each recipient.
Custom modules may also allow more token types by providing the tokenTypes setting of the message or calling the message's \Drupal\sender\Entity\Message::setTokenTypes() method.
Tokens that need extra data (e.g. "node") require a $data parameter to be passed to the SenderInterface::send() method. For more information on this parameter, please check \Drupal\Core\Utility\Token::replace() documentation.
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion