You are here

public function TestMessage::applyTokens in Courier 8

Same name and namespace in other branches
  1. 2.x tests/modules/courier_test_message/src/Entity/TestMessage.php \Drupal\courier_test_message\Entity\TestMessage::applyTokens()

Applies tokens to relevant fields.

Return value

static Return this instance for chaining.

Overrides ChannelInterface::applyTokens

File

tests/modules/courier_test_message/src/Entity/TestMessage.php, line 57

Class

TestMessage
Defines storage for a test message.

Namespace

Drupal\courier_test_message\Entity

Code

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