You are here

public function MailEntity::setEntity in Simplenews 8

Set the entity of this mail.

Parameters

\Drupal\Core\Entity\ContentEntityInterface $entity: The entity of this mail.

1 call to MailEntity::setEntity()
MailEntity::__construct in src/Mail/MailEntity.php
Constructs a MailEntity object.

File

src/Mail/MailEntity.php, line 77

Class

MailEntity
Default mail class for entities.

Namespace

Drupal\simplenews\Mail

Code

public function setEntity(ContentEntityInterface $entity) {
  $this->entity = $entity;
  if ($this->entity
    ->hasTranslation($this
    ->getLanguage())) {
    $this->entity = $this->entity
      ->getTranslation($this
      ->getLanguage());
  }
}