fdk-8.x-1.0/templates/field.html.twig

templates/field.html.twig
{#
/**
 * @file
 * Theme override for a field based on the @stable field template. See that
 * file for full documentation.
 *
 * field_label supplies one additional variable:
 * - label_tag: The label wrapper tag as chosen in the field_label.
 *
 * This template won't used if your theme overrides field.html.twig. Modify
 * your own template to use the label_tag, e.g.:
 *
 *   <{{ label_tag|default('div') }}>
 *     {{ label }}
 *   </{{ label_tag|default('div') }}>
 *
 * @see field_label_preprocess_field()
 */
#}
{%
  set classes = [
    'field',
    'field--name-' ~ field_name|clean_class,
    'field--type-' ~ field_type|clean_class,
    'field--label-' ~ label_display,
  ]
%}
{%
  set title_classes = [
    'field__label',
    label_display == 'visually_hidden' ? 'visually-hidden',
  ]
%}

{% if label_hidden %}
  {% if multiple %}
    <{{ field_wrapper_tag }}{{ attributes.addClass(classes, 'field__items').merge(field_wrapper_attributes) }}>
      {% for item in items %}
        {% if loop.length > 1 and loop.last and field_delimiter.enabled and field_delimiter.include_and %}{{ field_delimiter.and_value }}{% endif %}
        <{{ field_item_wrapper_tag }}{{ item.attributes.addClass('field__item') }}>{{ item.content }}</{{ field_item_wrapper_tag }}>{% if loop.revindex > 2 and field_delimiter.enabled %}{{- field_delimiter.value }}{% endif %}
      {% endfor %}
    </{{ field_wrapper_tag }}>
  {% else %}
    {% for item in items %}
      {% if loop.length > 1 and  loop.last and field_delimiter.enabled and field_delimiter.include_and %}{{ field_delimiter.and_value }}{% endif %}
      <{{ field_item_wrapper_tag }}{{ attributes.addClass(classes, 'field__item').merge(item.attributes) }}>{{ item.content }}</{{ field_item_wrapper_tag }}>{% if loop.revindex > 2 and field_delimiter.enabled %}{{- field_delimiter.value }}{% endif %}
    {% endfor %}
  {% endif %}
{% else %}
  <{{ field_wrapper_tag }}{{ attributes.addClass(classes).merge(field_wrapper_attributes) }}>
    <{{ label_tag|default('div') }}{{ title_attributes.addClass(title_classes) }}>{{ label }}</{{ label_tag|default('div') }}>
    {% if multiple %}
      <div class="field__items">
    {% endif %}
    {% for item in items %}
      {% if loop.length > 1 and  loop.last and field_delimiter.enabled and field_delimiter.include_and %}{{ field_delimiter.and_value }}{% endif %}
      <{{ field_item_wrapper_tag }}{{ item.attributes.addClass('field__item') }}>{{ item.content }}</{{ field_item_wrapper_tag }}>{% if loop.revindex > 2 and field_delimiter.enabled %}{{- field_delimiter.value }}{% endif %}
    {% endfor %}
    {% if multiple %}
      </div>
    {% endif %}
  </{{ field_wrapper_tag }}>
{% endif %}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc