You are here

field.html.twig in Fences 8.2

Theme override for a field.

File

field.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Theme override for a field.
  5. */
  6. #}
  7. {%
  8. set classes = [
  9. 'field',
  10. 'field--name-' ~ field_name|clean_class,
  11. 'field--type-' ~ field_type|clean_class,
  12. 'field--label-' ~ label_display,
  13. ]
  14. %}
  15. {%
  16. set title_classes = [
  17. 'field__label',
  18. label_display == 'visually_hidden' ? 'visually-hidden',
  19. ]
  20. %}
  21. {% if display_field_tag %}
  22. <{{ field_tag|default('div') }}{{ attributes.addClass(classes, 'field__items') }}>
  23. {% endif %}
  24. {% if not label_hidden and display_label_tag %}
  25. <{{ label_tag|default('div') }}{{ title_attributes.addClass(title_classes) }}>{{ label }}</{{ label_tag|default('div') }}>
  26. {% endif %}
  27. {% for item in items %}
  28. {% if display_item_tag %}
  29. <{{ field_item_tag|default('div') }}{{ item.attributes.addClass('field__item') }}>
  30. {% endif %}
  31. {{ item.content }}
  32. {% if display_item_tag %}
  33. </{{ field_item_tag|default('div') }}>
  34. {% endif %}
  35. {% endfor %}
  36. {% if display_field_tag %}
  37. </{{ field_tag|default('div') }}>
  38. {% endif %}