summaryrefslogtreecommitdiffstats
path: root/core/themes/classy/templates/field/field.html.twig
diff options
context:
space:
mode:
Diffstat (limited to 'core/themes/classy/templates/field/field.html.twig')
-rw-r--r--core/themes/classy/templates/field/field.html.twig43
1 files changed, 29 insertions, 14 deletions
diff --git a/core/themes/classy/templates/field/field.html.twig b/core/themes/classy/templates/field/field.html.twig
index 5ab1e92..216fe70 100644
--- a/core/themes/classy/templates/field/field.html.twig
+++ b/core/themes/classy/templates/field/field.html.twig
@@ -24,7 +24,7 @@
* - label_hidden: Whether to show the field label or not.
* - title_attributes: HTML attributes for the title.
* - label: The label for the field.
- * - content_attributes: HTML attributes for the content.
+ * - multiple: TRUE if a field can contain multiple items.
* - items: List of all the field items. Each item contains:
* - attributes: List of HTML attributes for each item.
* - content: The field item's content.
@@ -33,33 +33,48 @@
* - field_type: The type of the field.
* - label_display: The display settings for the label.
*
+ *
* @see template_preprocess_field()
*/
#}
-{% set field_name_class = field_name|clean_class %}
{%
set classes = [
'field',
- 'field-' ~ entity_type|clean_class ~ '--' ~ field_name_class,
- 'field-name-' ~ field_name_class,
- 'field-type-' ~ field_type|clean_class,
- 'field-label-' ~ label_display,
- label_display == 'inline' ? 'clearfix',
+ 'field--name-' ~ field_name|clean_class,
+ 'field--type-' ~ field_type|clean_class,
+ 'field--label-' ~ label_display,
]
%}
{%
set title_classes = [
- 'field-label',
+ 'field__label',
label_display == 'visually_hidden' ? 'visually-hidden',
]
%}
-<div{{ attributes.addClass(classes) }}>
- {% if not label_hidden %}
- <div{{ title_attributes.addClass(title_classes) }}>{{ label }}</div>
+
+{% if label_hidden %}
+ {% if multiple %}
+ <div{{ attributes.addClass(classes).addClass('field__items') }}>
+ {% for item in items %}
+ <div{{ item.attributes.addClass(classes).addClass('field__item') }}>{{ item.content }}</div>
+ {% endfor %}
+ </div>
+ {% else %}
+ {% for item in items %}
+ <div{{ attributes.addClass(classes).addClass('field__item') }}>{{ item.content }}</div>
+ {% endfor %}
{% endif %}
- <div{{ content_attributes.addClass('field-items') }}>
+{% else %}
+ <div{{ attributes.addClass(classes) }}>
+ <div{{ title_attributes.addClass(title_classes) }}>{{ label }}</div>
+ {% if multiple %}
+ <div class='field__items'>
+ {% endif %}
{% for item in items %}
- <div{{ item.attributes.addClass('field-item') }}>{{ item.content }}</div>
+ <div{{ item.attributes.addClass('field__item') }}>{{ item.content }}</div>
{% endfor %}
+ {% if multiple %}
+ </div>
+ {% endif %}
</div>
-</div>
+{% endif %}