You are here

public function Subscriber::fillFromAccount in Simplenews 8

Same name and namespace in other branches
  1. 8.2 src/Entity/Subscriber.php \Drupal\simplenews\Entity\Subscriber::fillFromAccount()
  2. 3.x src/Entity/Subscriber.php \Drupal\simplenews\Entity\Subscriber::fillFromAccount()

Fill values from a user account.

Parameters

\Drupal\Core\Session\AccountInterface $account:

Return value

$this

Overrides SubscriberInterface::fillFromAccount

File

src/Entity/Subscriber.php, line 151

Class

Subscriber
Defines the simplenews subscriber entity.

Namespace

Drupal\simplenews\Entity

Code

public function fillFromAccount(AccountInterface $account) {
  $this
    ->setUserId($account
    ->id());
  $this
    ->setMail($account
    ->getEmail());
  $this
    ->setLangcode($account
    ->getPreferredLangcode());
  return $this;
}