You are here

media-library-element.html.twig in Media Library Form API Element 2.x

Same filename and directory in other branches
  1. 8 templates/media-library-element.html.twig

Default theme implementation for a fieldset element and its children.

Available variables:

  • attributes: HTML attributes for the <fieldset> element.
  • errors: (optional) Any errors for this <fieldset> element, may not be set.
  • required: Boolean indicating whether the <fieldeset> element is required.
  • legend: The <legend> element containing the following properties:
    • title: Title of the <fieldset>, intended for use as the text of the <legend>.
    • attributes: HTML attributes to apply to the <legend> element.
  • description: The description element containing the following properties:
    • content: The description content of the <fieldset>.
    • attributes: HTML attributes to apply to the description container.
  • children: The rendered child elements of the <fieldset>.
  • prefix: The content to add before the <fieldset> children.
  • suffix: The content to add after the <fieldset> children.

File

templates/media-library-element.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation for a fieldset element and its children.
  5. *
  6. * Available variables:
  7. * - attributes: HTML attributes for the <fieldset> element.
  8. * - errors: (optional) Any errors for this <fieldset> element, may not be set.
  9. * - required: Boolean indicating whether the <fieldeset> element is required.
  10. * - legend: The <legend> element containing the following properties:
  11. * - title: Title of the <fieldset>, intended for use as the text
  12. of the <legend>.
  13. * - attributes: HTML attributes to apply to the <legend> element.
  14. * - description: The description element containing the following properties:
  15. * - content: The description content of the <fieldset>.
  16. * - attributes: HTML attributes to apply to the description container.
  17. * - children: The rendered child elements of the <fieldset>.
  18. * - prefix: The content to add before the <fieldset> children.
  19. * - suffix: The content to add after the <fieldset> children.
  20. *
  21. * @see template_preprocess_fieldset()
  22. *
  23. * @ingroup themeable
  24. */
  25. #}
  26. {%
  27. set classes = [
  28. 'js-form-item',
  29. 'form-item',
  30. 'js-form-wrapper',
  31. 'form-wrapper',
  32. ]
  33. %}
  34. <fieldset{{ attributes.addClass(classes) }}>
  35. {%
  36. set legend_span_classes = [
  37. 'fieldset-legend',
  38. required ? 'js-form-required',
  39. required ? 'form-required',
  40. ]
  41. %}
  42. <legend{{ legend.attributes }}>
  43. <span{{ legend_span.attributes.addClass(legend_span_classes) }}>{{ legend.title }}</span>
  44. </legend>
  45. <div class="fieldset-wrapper">
  46. {% if errors %}
  47. <div>
  48. {{ errors }}
  49. </div>
  50. {% endif %}
  51. {% if prefix %}
  52. <span class="field-prefix">{{ prefix }}</span>
  53. {% endif %}
  54. {{ content }}
  55. {% if suffix %}
  56. <span class="field-suffix">{{ suffix }}</span>
  57. {% endif %}
  58. {% if description.content %}
  59. <div{{ description.attributes.addClass('description') }}>{{ description.content }}</div>
  60. {% endif %}
  61. </div>
  62. </fieldset>