fieldset--media-library-widget.html.twig

Same filename in this branch
  1. 8.9.x core/themes/claro/templates/media-library/fieldset--media-library-widget.html.twig
Same filename in other branches
  1. 9 core/themes/seven/templates/media-library/fieldset--media-library-widget.html.twig
  2. 9 core/themes/claro/templates/media-library/fieldset--media-library-widget.html.twig
  3. 10 core/themes/claro/templates/media-library/fieldset--media-library-widget.html.twig
  4. 11.x core/themes/claro/templates/media-library/fieldset--media-library-widget.html.twig

Theme override for the media library widget.

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.
  • 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.

See also

seven_preprocess_fieldset__media_library_widget()

template_preprocess_fieldset()

File

core/themes/seven/templates/media-library/fieldset--media-library-widget.html.twig

View source
  1. {#
  2. /**
  3. * @file
  4. * Theme override for the media library widget.
  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 of the legend.
  12. * - attributes: HTML attributes to apply to the legend.
  13. * - description: The description element containing the following properties:
  14. * - content: The description content of the fieldset.
  15. * - attributes: HTML attributes to apply to the description container.
  16. * - children: The rendered child elements of the fieldset.
  17. * - prefix: The content to add before the fieldset children.
  18. * - suffix: The content to add after the fieldset children.
  19. *
  20. * @see seven_preprocess_fieldset__media_library_widget()
  21. * @see template_preprocess_fieldset()
  22. */
  23. #}
  24. {%
  25. set classes = [
  26. 'js-form-item',
  27. 'form-item',
  28. 'js-form-wrapper',
  29. 'form-wrapper',
  30. 'media-library-widget',
  31. ]
  32. %}
  33. <fieldset{{ attributes.addClass(classes) }}>
  34. {%
  35. set legend_span_classes = [
  36. 'fieldset-legend',
  37. required ? 'js-form-required',
  38. required ? 'form-required',
  39. ]
  40. %}
  41. {# Always wrap fieldset legends in a <span> for CSS positioning. #}
  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 class="form-item--error-message">
  48. <strong>{{ errors }}</strong>
  49. </div>
  50. {% endif %}
  51. {% if prefix.empty_selection %}
  52. <p class="media-library-widget-empty-text">{{ prefix.empty_selection }}</p>
  53. {% elseif prefix.weight_toggle %}
  54. {{ prefix.weight_toggle }}
  55. {% endif %}
  56. {{ children }}
  57. {% if suffix %}
  58. <span class="field-suffix">{{ suffix }}</span>
  59. {% endif %}
  60. {% if description.content %}
  61. <div{{ description.attributes.addClass('description') }}>{{ description.content }}</div>
  62. {% endif %}
  63. </div>
  64. </fieldset>

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.