You are here

public function User::applyIdentity in Courier 2.x

Same name in this branch
  1. 2.x src/Plugin/IdentityChannel/CourierEmail/User.php \Drupal\courier\Plugin\IdentityChannel\CourierEmail\User::applyIdentity()
  2. 2.x tests/modules/courier_test_message/src/Plugin/IdentityChannel/TestMessage/User.php \Drupal\courier_test_message\Plugin\IdentityChannel\TestMessage\User::applyIdentity()
Same name and namespace in other branches
  1. 8 tests/modules/courier_test_message/src/Plugin/IdentityChannel/TestMessage/User.php \Drupal\courier_test_message\Plugin\IdentityChannel\TestMessage\User::applyIdentity()

Inserts the identity into the message.

Parameters

\Drupal\courier\ChannelInterface $message: The message. Passed by reference.

\Drupal\Core\Entity\EntityInterface $identity: The identity.

Throws

\Drupal\courier\Exception\IdentityException Thrown when an identity cannot be applied. Message is discarded, it does not stop creation of remaining messages in collection.

Overrides IdentityChannelPluginInterface::applyIdentity

File

tests/modules/courier_test_message/src/Plugin/IdentityChannel/TestMessage/User.php, line 25

Class

User
Supports core user entities.

Namespace

Drupal\courier_test_message\Plugin\IdentityChannel\TestMessage

Code

public function applyIdentity(ChannelInterface &$message, EntityInterface $identity) {

  /** @var \Drupal\user\UserInterface $identity */

  /** @var \Drupal\courier_test_message\Entity\TestMessageInterface $message */
  $message
    ->setUid($identity
    ->id());
}