Comment::setPublished

public Comment::setPublished($status)

Sets the published status of the comment entity.

Parameters

bool $status: Set to TRUE to publish the comment, FALSE to unpublish.

Return value

\Drupal\comment\CommentInterface The class instance that this method is called on.

Overrides CommentInterface::setPublished

File

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

Class

Comment
Defines the comment entity class.

Namespace

Drupal\comment\Entity

Code

public function setPublished($status) {
  $this->set('status', $status ? CommentInterface::PUBLISHED : CommentInterface::NOT_PUBLISHED);
  return $this;
}
doc_Drupal
2016-10-29 08:50:25
Comments
Leave a Comment

Please login to continue.