You are here

field-multiple-value-form--paragraphs-sets.html.twig in Paragraphs Sets 8.2

Same filename and directory in other branches
  1. 8 templates/field-multiple-value-form--paragraphs-sets.html.twig

Theme override for an individual form element of paragraphs_sets.

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: The description element containing the following properties:
    • content: The description content of the form element.
    • attributes: HTML attributes to apply to the description container.
  • button: "Add another item" button.
  • selection: Set selection button.

See also

template_preprocess_field_multiple_value_form__paragraphs_sets()

File

templates/field-multiple-value-form--paragraphs-sets.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Theme override for an individual form element of paragraphs_sets.
  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. * - selection: Set selection button.
  19. *
  20. * @see template_preprocess_field_multiple_value_form__paragraphs_sets()
  21. */
  22. #}
  23. {% if multiple %}
  24. {%
  25. set classes = [
  26. 'js-form-item',
  27. 'form-item'
  28. ]
  29. %}
  30. <div{{ attributes.addClass(classes) }}>
  31. {% if selection %}
  32. <div class="clearfix set-selection-wrapper">{{ selection }}</div>
  33. {% endif %}
  34. {{ table }}
  35. {% if description.content %}
  36. <div{{ description.attributes.addClass('description') }} >{{ description.content }}</div>
  37. {% endif %}
  38. {% if button %}
  39. <div class="clearfix button-wrapper">{{ button }}</div>
  40. {% endif %}
  41. </div>
  42. {% else %}
  43. {% if selection %}
  44. <div class="clearfix">{{ selection }}</div>
  45. {% endif %}
  46. {% for element in elements %}
  47. {{ element }}
  48. {% endfor %}
  49. {% endif %}