public function Message::getMessage

Returns the translated message.

Return value

TranslatableMarkup The message.

Overrides MessageInterface::getMessage

File

src/Entity/Message.php, line 92

Class

Message
Entity class for the tmgmt_message entity.

Namespace

Drupal\tmgmt\Entity

Code

public function getMessage() {
  $text = $this->message->value;
  if ($this->variables
    ->first() && $this->variables
    ->first()
    ->toArray()) {
    return new TranslatableMarkup($text, $this->variables
      ->first()
      ->toArray());
  }
  else {
    return new TranslatableMarkup($text);
  }
}