annotate core/themes/classy/templates/field/field--comment.html.twig @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 4c8ae668cc8c
children
rev   line source
Chris@0 1 {#
Chris@0 2 /**
Chris@0 3 * @file
Chris@0 4 * Theme override for comment fields.
Chris@0 5 *
Chris@0 6 * Available variables:
Chris@0 7 * - attributes: HTML attributes for the containing element.
Chris@0 8 * - label_hidden: Whether to show the field label or not.
Chris@0 9 * - title_attributes: HTML attributes for the title.
Chris@0 10 * - label: The label for the field.
Chris@0 11 * - title_prefix: Additional output populated by modules, intended to be
Chris@0 12 * displayed in front of the main title tag that appears in the template.
Chris@0 13 * - title_suffix: Additional title output populated by modules, intended to
Chris@0 14 * be displayed after the main title tag that appears in the template.
Chris@0 15 * - comments: List of comments rendered through comment.html.twig.
Chris@0 16 * - comment_form: The 'Add new comment' form.
Chris@0 17 * - comment_display_mode: Is the comments are threaded.
Chris@0 18 * - comment_type: The comment type bundle ID for the comment field.
Chris@0 19 * - entity_type: The entity type to which the field belongs.
Chris@0 20 * - field_name: The name of the field.
Chris@0 21 * - field_type: The type of the field.
Chris@0 22 * - label_display: The display settings for the label.
Chris@0 23 *
Chris@0 24 * @see template_preprocess_field()
Chris@0 25 * @see comment_preprocess_field()
Chris@0 26 */
Chris@0 27 #}
Chris@0 28 {%
Chris@0 29 set classes = [
Chris@0 30 'field',
Chris@0 31 'field--name-' ~ field_name|clean_class,
Chris@0 32 'field--type-' ~ field_type|clean_class,
Chris@0 33 'field--label-' ~ label_display,
Chris@0 34 'comment-wrapper',
Chris@0 35 ]
Chris@0 36 %}
Chris@0 37 {%
Chris@0 38 set title_classes = [
Chris@0 39 'title',
Chris@0 40 label_display == 'visually_hidden' ? 'visually-hidden',
Chris@0 41 ]
Chris@0 42 %}
Chris@0 43 <section{{ attributes.addClass(classes) }}>
Chris@0 44 {% if comments and not label_hidden %}
Chris@0 45 {{ title_prefix }}
Chris@0 46 <h2{{ title_attributes.addClass(title_classes) }}>{{ label }}</h2>
Chris@0 47 {{ title_suffix }}
Chris@0 48 {% endif %}
Chris@0 49
Chris@0 50 {{ comments }}
Chris@0 51
Chris@0 52 {% if comment_form %}
Chris@0 53 <h2 class="title comment-form__title">{{ 'Add new comment'|t }}</h2>
Chris@0 54 {{ comment_form }}
Chris@0 55 {% endif %}
Chris@0 56
Chris@0 57 </section>