iu-8.x-1.x-dev/templates/field/field--viewsreference.html.twig

templates/field/field--viewsreference.html.twig
{#
/**
 * @file
 * Theme override for a field.
 *
 * Available variables:
 * - attributes: HTML attributes for the containing element.
 * - label_hidden: Whether to show the field label or not.
 * - title_attributes: HTML attributes for the title.
 * - label: The label for the field.
 * - 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.
 * - entity_type: The entity type to which the field belongs.
 * - field_name: The name of the field.
 * - field_type: The type of the field.
 * - label_display: The display settings for the label.
 *
 * @see template_preprocess_field()
 */
#}

{%
  set field_name = ('field_' in field_name) ? field_name : 'field_' ~ field_name
%}

{%
  set classes = [
    field_name|clean_class,
    'field-type-' ~ field_type|clean_class,
    'field-label-is-' ~ label_display|clean_class,
  ]
%}

{%
  set title_classes = [
    'field-label',
    label_display|clean_class
  ]
%}

{% if label_hidden %}
  {% if multiple %}
    <div{{ attributes.addClass(classes) }}>
      {% for item in items %}
        <div{{ item.attributes }}>{{ item.content }}</div>
      {% endfor %}
    </div>
  {% else %}
    {% for item in items %}
      <div{{ attributes.addClass(classes) }}>{{ item.content }}</div>
    {% endfor %}
  {% endif %}
{% else %}
  <div{{ attributes.addClass(classes) }}>
    <strong{{ title_attributes.addClass(title_classes) }}>{{ label }}:</strong>
    {% if multiple %}
      <div class="field-multiple">
    {% endif %}
    {% for item in items %}
      <div{{ item.attributes }}>{{ item.content }}</div>
    {% endfor %}
    {% if multiple %}
      </div>
    {% endif %}
  </div>
{% endif %}

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

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