public function UnpublishComment::execute

Executes the plugin.

Overrides ExecutableInterface::execute

File

drupal/core/modules/comment/lib/Drupal/comment/Plugin/Action/UnpublishComment.php, line 28
Contains \Drupal\comment\Plugin\Action\UnpublishComment.

Class

UnpublishComment
Unpublishes a comment.

Namespace

Drupal\comment\Plugin\Action

Code

public function execute($comment = NULL) {
  $comment->status->value = COMMENT_NOT_PUBLISHED;
  $comment
    ->save();
}