field-multiple-value-form.html.twig 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation for an individual form element.
  5. *
  6. * Available variables for all fields:
  7. * - multiple: Whether there are multiple instances of the field.
  8. *
  9. * Available variables for single cardinality fields:
  10. * - elements: Form elements to be rendered.
  11. *
  12. * Available variables when there are multiple fields.
  13. * - table: Table of field items.
  14. * - description: The description element containing the following properties:
  15. * - content: The description content of the form element.
  16. * - attributes: HTML attributes to apply to the description container.
  17. * - button: "Add another item" button.
  18. *
  19. * @see template_preprocess_field_multiple_value_form()
  20. *
  21. * @ingroup themeable
  22. */
  23. #}
  24. {% if multiple %}
  25. {%
  26. set classes = [
  27. 'js-form-item',
  28. 'form-item'
  29. ]
  30. %}
  31. <div{{ attributes.addClass(classes) }}>
  32. {{ table }}
  33. {% if description.content %}
  34. <div{{ description.attributes.addClass('description') }} >{{ description.content }}</div>
  35. {% endif %}
  36. {% if button %}
  37. <div class="clearfix">{{ button }}</div>
  38. {% endif %}
  39. </div>
  40. {% else %}
  41. {% for element in elements %}
  42. {{ element }}
  43. {% endfor %}
  44. {% endif %}