function simplenews_token_replace_body in Simplenews 3.x
Replaces tokens in a mail body.
This is a wrapper to Token::replace() for the email body.
Parameters
string $text: An HTML string containing replaceable tokens.
array $data: (optional) An array of keyed objects.
array $options: (optional) A keyed array of settings and flags to control the token replacement process.
Return value
string String with tokens replaced.
2 calls to simplenews_token_replace_body()
- MailBuilder::buildCombinedMail in src/
Mail/ MailBuilder.php - Build subject and body of the subscribe confirmation email.
- MailBuilder::buildValidateMail in src/
Mail/ MailBuilder.php - Build subject and body of the validate email.
File
- ./
simplenews.module, line 987 - Simplenews node handling, sent email, newsletter block and general hooks.
Code
function simplenews_token_replace_body($text, array $data = [], array $options = []) {
// The input string must be formatted which is done using the fallback text
// formatter. The output must remain as markup. The default mail plugin will
// automatically convert to text. A plugin that supports HTML can send the
// markup directly.
return Markup::create(check_markup(\Drupal::token()
->replace($text, $data, $options)));
}