details.html.twig 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. {#
  2. /**
  3. * @file
  4. * Theme override for a details element.
  5. *
  6. * Available variables
  7. * - attributes: A list of HTML attributes for the details element.
  8. * - errors: (optional) Any errors for this details element, may not be set.
  9. * - title: (optional) The title of the element, may not be set.
  10. * - description: (optional) The description of the element, may not be set.
  11. * - children: (optional) The children of the element, may not be set.
  12. * - value: (optional) The value of the element, may not be set.
  13. *
  14. * @see template_preprocess_details()
  15. */
  16. #}
  17. <details{{ attributes }}>
  18. {%- if title -%}
  19. {%
  20. set summary_classes = [
  21. required ? 'js-form-required',
  22. required ? 'form-required',
  23. ]
  24. %}
  25. <summary{{ summary_attributes.addClass(summary_classes) }}>{{ title }}</summary>
  26. {%- endif -%}
  27. <div class="details-wrapper">
  28. {% if errors %}
  29. <div class="form-item--error-message">
  30. <strong>{{ errors }}</strong>
  31. </div>
  32. {% endif %}
  33. {%- if description -%}
  34. <div class="details-description">{{ description }}</div>
  35. {%- endif -%}
  36. {%- if children -%}
  37. {{ children }}
  38. {%- endif -%}
  39. {%- if value -%}
  40. {{ value }}
  41. {%- endif -%}
  42. </div>
  43. </details>