Airship\Cabin\Bridge\Landing\Blog::viewComment PHP Method

viewComment() public method

View a comment
public viewComment ( string $commentId = '' )
$commentId string
    public function viewComment(string $commentId = '')
    {
        $commentId = (int) $commentId;
        $post = $this->post(new CommentFilter());
        if (!empty($post)) {
            switch ($post['comment_btn']) {
                case 'publish':
                    if ($this->can('publish')) {
                        $this->blog->publishComment($commentId);
                    }
                    break;
                case 'hide':
                    if ($this->can('publish')) {
                        $this->blog->hideComment($commentId);
                    }
                    break;
                case 'delete':
                    if ($this->can('delete')) {
                        if ($this->blog->deleteComment($commentId)) {
                            \Airship\redirect($this->airship_cabin_prefix . '/blog/comments');
                        }
                    }
                    break;
            }
        }
        $this->lens('blog/comments_view', ['active_link' => 'bridge-link-blog-comments', 'comment' => $this->blog->getCommentById((int) $commentId)]);
    }