/** * Publishes the specified comment. * * @param \Drupal\comment\CommentInterface $comment * A comment entity. * * @return \Symfony\Component\HttpFoundation\RedirectResponse. * Redirects to the permalink URL for this comment. */ 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()); }