You are here

public function MailEntity::getTokenContext in Simplenews 8.2

Same name and namespace in other branches
  1. 8 src/Mail/MailEntity.php \Drupal\simplenews\Mail\MailEntity::getTokenContext()
  2. 3.x src/Mail/MailEntity.php \Drupal\simplenews\Mail\MailEntity::getTokenContext()

Returns the token context to be used with token replacements.

Return value

array An array of objects as required by token_replace().

Overrides MailInterface::getTokenContext

3 calls to MailEntity::getTokenContext()
MailEntity::getBodyWithFormat in src/Mail/MailEntity.php
Get the body with the requested format.
MailEntity::getHeaders in src/Mail/MailEntity.php
Returns the mail headers.
MailEntity::getSubject in src/Mail/MailEntity.php
Returns the mail subject.

File

src/Mail/MailEntity.php, line 147

Class

MailEntity
Default mail class for entities.

Namespace

Drupal\simplenews\Mail

Code

public function getTokenContext() {
  return [
    'newsletter' => $this
      ->getNewsletter(),
    'simplenews_subscriber' => $this
      ->getSubscriber(),
    $this
      ->getIssue()
      ->getEntityTypeId() => $this
      ->getIssue(),
  ];
}