drupal/core/modules/comment/templates/comment-wrapper.html.twig

53 lines
1.8 KiB
Twig

{#
/**
* @file
* Default theme implementation for a comments container.
*
* Available variables:
* - comments: List of comments rendered through comment.html.twig.
* - form: The 'Add new comment' form.
* - content: The content-related elements for the comment display. Use
* 'content' to print them all, or print a subset such as
* 'content.comment_form'.
* - attributes: Remaining HTML attributes for the containing element.
* It includes the 'class' information, which includes:
* - comment-wrapper: The current template type, i.e., "theming hook".
* - title_prefix: Additional output populated by modules, intended to be
* displayed in front of the main title tag that appears in the template.
* - title_suffix: Additional title output populated by modules, intended to
* be displayed after the main title tag that appears in the template.
*
* The following variables are provided for contextual information.
* - entity: The entity to which the comments belong.
* - display_mode: The display mode for the comment listing, flat or threaded.
* The constants below show the possible values and should be used for
* comparison, as in the following example:
* @code
* {% if display_mode is constant('COMMENT_MODE_THREADED') %}
* <h3>{{ 'These comments are displayed in a threaded list.'|t }}</h3>
* {% endif %}
* @endcode
* - COMMENT_MODE_FLAT
* - COMMENT_MODE_THREADED
*
* @see template_preprocess_comment_wrapper()
*
* @ingroup themeable
*/
#}
<section{{ attributes }}>
{% if comments and (entity.entityType != 'node' or entity.bundle != 'forum') %}
{{ title_prefix }}
<h2 class="title">{{ 'Comments'|t }}</h2>
{{ title_suffix }}
{% endif %}
{{ comments }}
{% if form %}
<h2 class="title comment-form">{{ 'Add new comment'|t }}</h2>
{{ form }}
{% endif %}
</section>