You are here

protected function ContactEmail::tokenizeString in Contact Emails 8

Apply tokens to body value.

Parameters

string $string: The string value such as the subject or body.

\Drupal\contact\MessageInterface $message: The contact message.

Return value

string The tokenized value.

2 calls to ContactEmail::tokenizeString()
ContactEmail::getBody in src/Entity/ContactEmail.php
Get the email body.
ContactEmail::getSubject in src/Entity/ContactEmail.php
Get the email subject.

File

src/Entity/ContactEmail.php, line 384

Class

ContactEmail
Defines the Contact Email entity.

Namespace

Drupal\contact_emails\Entity

Code

protected function tokenizeString($string, MessageInterface $message) {
  $data = [
    'contact_message' => $message,
  ];
  $options = [
    'clear' => TRUE,
  ];
  return \Drupal::token()
    ->replace($string, $data, $options);
}