You are here

public function Email::applyTokens in Courier 8

Same name and namespace in other branches
  1. 2.x src/Entity/Email.php \Drupal\courier\Entity\Email::applyTokens()

Applies tokens to relevant fields.

Return value

static Return this instance for chaining.

Overrides ChannelInterface::applyTokens

File

src/Entity/Email.php, line 124
Contains \Drupal\courier\Entity\Email.

Class

Email
Defines storage for a composed email.

Namespace

Drupal\courier\Entity

Code

public function applyTokens() {
  $tokens = $this
    ->getTokenValues();
  $options = $this
    ->getTokenOptions();
  $this
    ->setSubject(\Drupal::token()
    ->replace($this
    ->getSubject(), $tokens, $options));
  $this
    ->setBody(\Drupal::token()
    ->replace($this
    ->getBody(), $tokens, $options));
  return $this;
}