field--site-setting-entity--field-file--les-logos-du-colloque.html.twig 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation for a field.
  5. *
  6. * To override output, copy the "field.html.twig" from the templates directory
  7. * to your theme's directory and customize it, just like customizing other
  8. * Drupal templates such as page.html.twig or node.html.twig.
  9. *
  10. * Instead of overriding the theming for all fields, you can also just override
  11. * theming for a subset of fields using
  12. * @link themeable Theme hook suggestions. @endlink For example,
  13. * here are some theme hook suggestions that can be used for a field_foo field
  14. * on an article node type:
  15. * - field--node--field-foo--article.html.twig
  16. * - field--node--field-foo.html.twig
  17. * - field--node--article.html.twig
  18. * - field--field-foo.html.twig
  19. * - field--text-with-summary.html.twig
  20. * - field.html.twig
  21. *
  22. * Available variables:
  23. * - attributes: HTML attributes for the containing element.
  24. * - label_hidden: Whether to show the field label or not.
  25. * - title_attributes: HTML attributes for the title.
  26. * - label: The label for the field.
  27. * - multiple: TRUE if a field can contain multiple items.
  28. * - items: List of all the field items. Each item contains:
  29. * - attributes: List of HTML attributes for each item.
  30. * - content: The field item's content.
  31. * - entity_type: The entity type to which the field belongs.
  32. * - field_name: The name of the field.
  33. * - field_type: The type of the field.
  34. * - label_display: The display settings for the label.
  35. *
  36. * @see template_preprocess_field()
  37. *
  38. * @ingroup themeable
  39. */
  40. #}
  41. {%
  42. set title_classes = [
  43. label_display == 'visually_hidden' ? 'visually-hidden',
  44. ]
  45. %}
  46. {% if label_hidden %}
  47. {% if multiple %}
  48. <div class="">
  49. {% for item in items %}
  50. <div class="">{{ item.content }}</div>
  51. {% endfor %}
  52. </div>
  53. {% else %}
  54. {% for item in items %}
  55. <div{{ attributes }}>{{ item.content }}</div>
  56. {% endfor %}
  57. {% endif %}
  58. {% else %}
  59. <div{{ attributes }}>
  60. <div{{ title_attributes.addClass(title_classes) }}>{{ label }}</div>
  61. {% if multiple %}
  62. <div>
  63. {% endif %}
  64. {% for item in items %}
  65. <div{{ item.attributes }}>{{ item.content }}</div>
  66. {% endfor %}
  67. {% if multiple %}
  68. </div>
  69. {% endif %}
  70. </div>
  71. {% endif %}