function CommentController::commentApprove
Publishes the specified comment.
Parameters
\Drupal\comment\CommentInterface $comment: A comment entity.
Return value
\Symfony\Component\HttpFoundation\RedirectResponse
1 string reference to 'CommentController::commentApprove'
- comment.routing.yml in core/
modules/ comment/ comment.routing.yml - core/modules/comment/comment.routing.yml
File
-
core/
modules/ comment/ src/ Controller/ CommentController.php, line 88
Class
- CommentController
- Controller for the comment entity.
Namespace
Drupal\comment\ControllerCode
public function commentApprove(CommentInterface $comment) {
$comment->setPublished();
$comment->save();
$this->messenger()
->addStatus($this->t('Comment approved.'));
$permalink_uri = $comment->permalink();
$permalink_uri->setAbsolute();
return new RedirectResponse($permalink_uri->toString());
}