You are here

protected function Message::processTokens in Message 8

Replace placeholders with tokens.

Parameters

array $output: The templated text to be replaced.

bool $clear: Determine if unused token should be cleared.

Return value

array The output with placeholders replaced with the token value, if there are indeed tokens.

1 call to Message::processTokens()
Message::getText in src/Entity/Message.php
Replace arguments with their placeholders.

File

src/Entity/Message.php, line 283

Class

Message
Defines the Message entity class.

Namespace

Drupal\message\Entity

Code

protected function processTokens(array $output, $clear) {
  $options = [
    'langcode' => $this->language,
    'clear' => $clear,
  ];
  foreach ($output as $key => $value) {
    $output[$key] = \Drupal::token()
      ->replace($value, [
      'message' => $this,
    ], $options);
  }
  return $output;
}