Open fallcool opened 8 years ago
Just overriding the file
friendsofsymfony/comment-bundle/FOS/CommentBundle/Resources/views/Thread/comments.html.twig
by copying it to
app/Resources/FOSCommentBundle/views/Thread
(you will need to create that directory), then modifying that template to relocate the comment form anywhere you want.
In your case - to put it to the bottom - the template should looks like this
{% set depth = depth|default(0) %}
{% set view = view|default('tree') %}
{% if depth == 0 %}
{% if fos_comment_can_edit_thread(thread) %}
<div class="fos_comment_thread_commentable">
<button data-url="{{ url('fos_comment_edit_thread_commentable', {'id': thread.id, 'value': not thread.commentable}) }}" class="fos_comment_thread_commentable_action">
{{ (thread.commentable ? 'fos_comment_thread_close' : 'fos_comment_thread_open') | trans({}, 'FOSCommentBundle') }}
</button>
</div>
{% endif %}
{% set count = thread.numComments %}
<h3>{% transchoice count with {'%count%': count} from "FOSCommentBundle" %}fos_comment_thread_comment_count{% endtranschoice %}</h3>
{% endif %}
{% for commentinfo in comments %}
{% include "FOSCommentBundle:Thread:comment.html.twig" with { "children": commentinfo.children, "comment": commentinfo.comment, "depth": depth, "view": view } %}
{% endfor %}
{% if depth == 0 %}
{% if fos_comment_can_comment_thread(thread) %}
{{ render(url('fos_comment_new_thread_comments', {"id": thread.id})) }}
{% endif %}
{% endif %}
I want to display the threads above the comment form. I checked all the templates in the bundle, but no luck. anyone know how to do it?