fieldset.html.twig

Same filename in this branch
  1. 8.9.x core/profiles/demo_umami/themes/umami/templates/classy/form/fieldset.html.twig
  2. 8.9.x core/themes/seven/templates/classy/form/fieldset.html.twig
  3. 8.9.x core/themes/bartik/templates/classy/form/fieldset.html.twig
  4. 8.9.x core/themes/stable/templates/form/fieldset.html.twig
  5. 8.9.x core/themes/classy/templates/form/fieldset.html.twig
  6. 8.9.x core/modules/system/templates/fieldset.html.twig
Same filename in other branches
  1. 9 core/profiles/demo_umami/themes/umami/templates/classy/form/fieldset.html.twig
  2. 9 core/themes/olivero/templates/form/fieldset.html.twig
  3. 9 core/themes/stable9/templates/form/fieldset.html.twig
  4. 9 core/themes/seven/templates/classy/form/fieldset.html.twig
  5. 9 core/themes/claro/templates/fieldset.html.twig
  6. 9 core/themes/bartik/templates/classy/form/fieldset.html.twig
  7. 9 core/themes/stable/templates/form/fieldset.html.twig
  8. 9 core/themes/starterkit_theme/templates/form/fieldset.html.twig
  9. 9 core/themes/classy/templates/form/fieldset.html.twig
  10. 9 core/modules/system/templates/fieldset.html.twig
  11. 10 core/profiles/demo_umami/themes/umami/templates/classy/form/fieldset.html.twig
  12. 10 core/themes/olivero/templates/form/fieldset.html.twig
  13. 10 core/themes/stable9/templates/form/fieldset.html.twig
  14. 10 core/themes/claro/templates/fieldset.html.twig
  15. 10 core/themes/starterkit_theme/templates/form/fieldset.html.twig
  16. 10 core/modules/system/templates/fieldset.html.twig
  17. 11.x core/profiles/demo_umami/themes/umami/templates/classy/form/fieldset.html.twig
  18. 11.x core/themes/olivero/templates/form/fieldset.html.twig
  19. 11.x core/themes/stable9/templates/form/fieldset.html.twig
  20. 11.x core/themes/claro/templates/fieldset.html.twig
  21. 11.x core/themes/starterkit_theme/templates/form/fieldset.html.twig
  22. 11.x core/modules/system/templates/fieldset.html.twig

Theme override for a fieldset element and its children.

See also

template_preprocess_fieldset()

claro_preprocess_fieldset()

File

core/themes/claro/templates/fieldset.html.twig

View source
  1. {#
  2. /**
  3. * @file
  4. * Theme override for a fieldset element and its children.
  5. *
  6. * @see template_preprocess_fieldset()
  7. * @see claro_preprocess_fieldset()
  8. */
  9. #}
  10. {%
  11. set classes = [
  12. 'fieldset',
  13. attributes.hasClass('fieldgroup') ? 'fieldset--group',
  14. 'js-form-item',
  15. 'form-item',
  16. 'js-form-wrapper',
  17. 'form-wrapper',
  18. ]
  19. %}
  20. {%
  21. set wrapper_classes = [
  22. 'fieldset__wrapper',
  23. attributes.hasClass('fieldgroup') ? 'fieldset__wrapper--group',
  24. ]
  25. %}
  26. {%
  27. set legend_span_classes = [
  28. 'fieldset__label',
  29. attributes.hasClass('fieldgroup') ? 'fieldset__label--group',
  30. required ? 'js-form-required',
  31. required ? 'form-required',
  32. ]
  33. %}
  34. {%
  35. set legend_classes = [
  36. 'fieldset__legend',
  37. attributes.hasClass('fieldgroup') and not attributes.hasClass('form-composite') ? 'fieldset__legend--group',
  38. attributes.hasClass('form-composite') ? 'fieldset__legend--composite',
  39. title_display == 'invisible' ? 'fieldset__legend--invisible' : 'fieldset__legend--visible',
  40. ]
  41. %}
  42. {%
  43. set description_classes = [
  44. 'fieldset__description',
  45. ]
  46. %}
  47. <fieldset{{ attributes.addClass(classes) }}>
  48. {# Always wrap fieldset legends in a <span> for CSS positioning. #}
  49. {% if legend.title %}
  50. <legend{{ legend.attributes.addClass(legend_classes) }}>
  51. <span{{ legend_span.attributes.addClass(legend_span_classes) }}>{{ legend.title }}</span>
  52. </legend>
  53. {% endif %}
  54. <div{{ content_attributes.addClass(wrapper_classes) }}>
  55. {% if inline_items %}
  56. <div class="container-inline">
  57. {% endif %}
  58. {% if prefix %}
  59. <span class="fieldset__prefix">{{ prefix }}</span>
  60. {% endif %}
  61. {{ children }}
  62. {% if suffix %}
  63. <span class="fieldset__suffix">{{ suffix }}</span>
  64. {% endif %}
  65. {% if errors %}
  66. <div class="fieldset__error-message">
  67. {{ errors }}
  68. </div>
  69. {% endif %}
  70. {% if description.content %}
  71. <div{{ description.attributes.addClass(description_classes) }}>{{ description.content }}</div>
  72. {% endif %}
  73. {% if inline_items %}
  74. </div>
  75. {% endif %}
  76. </div>
  77. </fieldset>

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