file field-multiple-value-form.html.twig

Default theme implementation for an individual form element.

Available variables for all fields:

  • multiple: Whether there are multiple instances of the field.
Available variables for single cardinality fields:
  • elements: Form elements to be rendered.
Available variables when there are multiple fields.
  • table: Table of field items.
  • description: Description text for the form element.
  • button: "Add another item" button.

See Also

  • template_preprocess_field_multiple_value_form()
Source
  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: Description text for the form element.
  15. * - button: "Add another item" button.
  16. *
  17. * @ingroup templates
  18. *
  19. * @see template_preprocess_field_multiple_value_form()
  20. */
  21. #}
  22. {% if multiple %}
  23. <div class="form-item">
  24. {{ table }}
  25. {% if description.content %}
  26. <div class="description help-block">{{ description.content }}</div>
  27. {% endif %}
  28. {% if button %}
  29. <div class="clearfix">{{ button }}</div>
  30. {% endif %}
  31. </div>
  32. {% else %}
  33. {% for element in elements %}
  34. {{ element }}
  35. {% endfor %}
  36. {% endif %}

Related topics