Integrate a comment form

Below is an example of how to set up a commenting form in Bootstrap 4.


{# @var commentsWork \twentyfourhoursmedia\commentswork\services\CommentsWorkService #}
{% set commentsWork = craft.commentsWork.service %}

{% if not currentUser and not commentsWork.allowAnonymous(entry) %}
    <p>Anonymous commenting is not allowed. Please login.</p>
{% else %}
    <div class="card bg-light">
        <div class="card-header">
            Leave a comment
        </div>
        <div class="card-body">
            <form method="post" action="{{ url('/actions/comments-work/default/post-comment') }}">
                {{ csrfInput() }}
                {{ signCommentForm(entry) }}
                <input name="redirect" value="{{ craft.app.request.url }}#comments" type="hidden"/>
                <input name="elementId" value="{{ entry.id }}" type="hidden"/>
                <input name="siteId" value="{{ entry.siteId }}" type="hidden"/>
                <input name="commentFormat" value="text" type="hidden"/>

                <div class="form-group">
                    <label for="comment-title">Title</label>
                    <input name="title" id="comment-title" type="text" class="form-control"/>
                </div>
                <div class="form-group">
                    <label for="comment-content">Comment</label>
                    <textarea name="comment" rows="5" id="comment-content" class="form-control"></textarea>
                </div>

                <div>
                    <input type="submit" class="btn btn-primary" value="Post comment"/>
                </div>
            </form>
        </div>
    </div>
{% endif %}