You are here

public function ContactEmail::getSubject in Contact Emails 8

Get the email subject.

Parameters

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

Return value

string The subject of the email.

Overrides ContactEmailInterface::getSubject

File

src/Entity/ContactEmail.php, line 287

Class

ContactEmail
Defines the Contact Email entity.

Namespace

Drupal\contact_emails\Entity

Code

public function getSubject(MessageInterface $message) {
  $subject = $this
    ->tokenizeString($this
    ->get('subject')->value, $message);

  // Convert any html to plain text.
  $subject = MailFormatHelper::htmlToText($subject);

  // Remove any line breaks as the above method assumes new lines allowed.
  $subject = str_replace("\n", '', $subject);
  return $subject;
}