You are here

public function Message::getPersonalRecipient in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/contact/src/Entity/Message.php \Drupal\contact\Entity\Message::getPersonalRecipient()
  2. 9 core/modules/contact/src/Entity/Message.php \Drupal\contact\Entity\Message::getPersonalRecipient()

Returns the user this message is being sent to.

Return value

\Drupal\user\UserInterface The user entity of the recipient, NULL if this is not a personal message.

Overrides MessageInterface::getPersonalRecipient

File

core/modules/contact/src/Entity/Message.php, line 131

Class

Message
Defines the contact message entity.

Namespace

Drupal\contact\Entity

Code

public function getPersonalRecipient() {
  if ($this
    ->isPersonal()) {
    return $this
      ->get('recipient')->entity;
  }
}