public CommentController::commentApprove(CommentInterface $comment)
Publishes the specified comment.
Parameters
\Drupal\comment\CommentInterface $comment: A comment entity.
Return value
\Symfony\Component\HttpFoundation\RedirectResponse
File
- core/modules/comment/src/Controller/CommentController.php, line 84
Class
- CommentController
- Controller for the comment entity.
Namespace
Drupal\comment\Controller
Code
public function commentApprove(CommentInterface $comment) {
$comment->setPublished(TRUE);
$comment->save();
drupal_set_message($this->t('Comment approved.'));
$permalink_uri = $comment->permalink();
$permalink_uri->setAbsolute();
return new RedirectResponse($permalink_uri->toString());
}
Please login to continue.