field--node--field-tags.html.twig 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. {#
  2. /**
  3. * @file
  4. * Bartik theme override for taxonomy term fields.
  5. *
  6. * Available variables:
  7. * - attributes: HTML attributes for the containing element.
  8. * - label_hidden: Whether to show the field label or not.
  9. * - title_attributes: HTML attributes for the label.
  10. * - label: The label for the field.
  11. * - content_attributes: HTML attributes for the content.
  12. * - items: List of all the field items. Each item contains:
  13. * - attributes: List of HTML attributes for each item.
  14. * - content: The field item's content.
  15. * - entity_type: The entity type to which the field belongs.
  16. * - field_name: The name of the field.
  17. * - field_type: The type of the field.
  18. * - label_display: The display settings for the label.
  19. *
  20. * @see template_preprocess_field()
  21. */
  22. #}
  23. {%
  24. set classes = [
  25. 'field',
  26. 'field--name-' ~ field_name|clean_class,
  27. 'field--type-' ~ field_type|clean_class,
  28. 'field--label-' ~ label_display,
  29. 'clearfix',
  30. ]
  31. %}
  32. {%
  33. set title_classes = [
  34. 'field__label',
  35. label_display == 'inline' ? 'inline',
  36. ]
  37. %}
  38. <div{{ attributes.addClass(classes) }}>
  39. {% if not label_hidden %}
  40. <h3{{ title_attributes.addClass(title_classes) }}>{{ label }}</h3>
  41. {% endif %}
  42. <ul class="links field__items">
  43. {% for item in items %}
  44. <li{{ item.attributes }}>{{ item.content }}</li>
  45. {% endfor %}
  46. </ul>
  47. </div>