You are here

function MailEntity::getTokenContext in Simplenews 8

Same name and namespace in other branches
  1. 8.2 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 166

Class

MailEntity
Default mail class for entities.

Namespace

Drupal\simplenews\Mail

Code

function getTokenContext() {
  return array(
    'newsletter' => $this
      ->getNewsletter(),
    'simplenews_subscriber' => $this
      ->getSubscriber(),
    $this
      ->getEntity()
      ->getEntityTypeId() => $this
      ->getEntity(),
  );
}