function Comment::getAuthorEmail

Same name in other branches
  1. 9 core/modules/comment/src/Entity/Comment.php \Drupal\comment\Entity\Comment::getAuthorEmail()
  2. 10 core/modules/comment/src/Entity/Comment.php \Drupal\comment\Entity\Comment::getAuthorEmail()
  3. 11.x core/modules/comment/src/Entity/Comment.php \Drupal\comment\Entity\Comment::getAuthorEmail()

Overrides CommentInterface::getAuthorEmail

File

core/modules/comment/src/Entity/Comment.php, line 425

Class

Comment
Defines the comment entity class.

Namespace

Drupal\comment\Entity

Code

public function getAuthorEmail() {
    $mail = $this->get('mail')->value;
    if ($this->get('uid')->target_id != 0) {
        $mail = $this->get('uid')->entity
            ->getEmail();
    }
    return $mail;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.