summaryrefslogtreecommitdiffstats
path: root/core/modules/system/templates/field.html.twig
diff options
context:
space:
mode:
Diffstat (limited to 'core/modules/system/templates/field.html.twig')
-rw-r--r--core/modules/system/templates/field.html.twig53
1 files changed, 26 insertions, 27 deletions
diff --git a/core/modules/system/templates/field.html.twig b/core/modules/system/templates/field.html.twig
index 0745f84..1b78574 100644
--- a/core/modules/system/templates/field.html.twig
+++ b/core/modules/system/templates/field.html.twig
@@ -1,7 +1,7 @@
{#
/**
* @file
- * Default theme implementation for a field.
+ * Theme override for a field.
*
* To override output, copy the "field.html.twig" from the templates directory
* to your theme's directory and customize it, just like customizing other
@@ -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,35 +33,34 @@
* - field_type: The type of the field.
* - label_display: The display settings for the label.
*
- * @see template_preprocess_field()
*
- * @ingroup themeable
+ * @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',
- ]
-%}
-{%
- set title_classes = [
- '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 }}>
+ {% for item in items %}
+ <div{{ item.attributes }}>{{ item.content }}</div>
+ {% endfor %}
+ </div>
+ {% else %}
+ {% for item in items %}
+ <div{{ attributes }}>{{ item.content }}</div>
+ {% endfor %}
{% endif %}
- <div{{ content_attributes.addClass('field-items') }}>
+{% else %}
+ <div{{ attributes }}>
+ <div{{ title_attributes }}>{{ label }}</div>
+ {% if multiple %}
+ <div>
+ {% endif %}
{% for item in items %}
- <div{{ item.attributes.addClass('field-item') }}>{{ item.content }}</div>
+ <div{{ item.attributes }}>{{ item.content }}</div>
{% endfor %}
+ {% if multiple %}
+ </div>
+ {% endif %}
</div>
-</div>
+{% endif %}