details--vertical-tabs.html.twig

Same filename in other branches
  1. 8.9.x core/themes/claro/templates/navigation/details--vertical-tabs.html.twig
  2. 10 core/themes/claro/templates/navigation/details--vertical-tabs.html.twig
  3. 11.x core/themes/claro/templates/navigation/details--vertical-tabs.html.twig

Theme override for a details element.

This variation is used for theming the details of a Vertical Tabs element.

Available variables

  • attributes: A list of HTML attributes for the details element.
  • errors: (optional) Any errors for this details element, may not be set.
  • title: (optional) The title of the element, may not be set.
  • description: (optional) The description of the element, may not be set.
  • children: (optional) The children of the element, may not be set.
  • value: (optional) The value of the element, may not be set.
  • accordion: whether the details element should look as an accordion.
  • accordion_item: whether the details element is an item of an accordion list.

See also

template_preprocess_details()

claro_preprocess_details()

File

core/themes/claro/templates/navigation/details--vertical-tabs.html.twig

View source
  1. {#
  2. /**
  3. * @file
  4. * Theme override for a details element.
  5. *
  6. * This variation is used for theming the details of a Vertical Tabs element.
  7. *
  8. * Available variables
  9. * - attributes: A list of HTML attributes for the details element.
  10. * - errors: (optional) Any errors for this details element, may not be set.
  11. * - title: (optional) The title of the element, may not be set.
  12. * - description: (optional) The description of the element, may not be set.
  13. * - children: (optional) The children of the element, may not be set.
  14. * - value: (optional) The value of the element, may not be set.
  15. * - accordion: whether the details element should look as an accordion.
  16. * - accordion_item: whether the details element is an item of an accordion
  17. * list.
  18. *
  19. * @see template_preprocess_details()
  20. * @see claro_preprocess_details()
  21. */
  22. #}
  23. {#
  24. Prefix 'details' class to avoid collision with Modernizr.
  25. @todo Remove prefix after https://www.drupal.org/node/2981732 has been solved.
  26. #}
  27. {%
  28. set classes = [
  29. 'claro-details',
  30. 'claro-details--vertical-tabs-item',
  31. ]
  32. %}
  33. {%
  34. set content_wrapper_classes = [
  35. 'claro-details__wrapper',
  36. 'details-wrapper',
  37. 'claro-details__wrapper--vertical-tabs-item',
  38. ]
  39. %}
  40. {%
  41. set inner_wrapper_classes = [
  42. 'claro-details__content',
  43. 'claro-details__content--vertical-tabs-item',
  44. ]
  45. %}
  46. <details{{ attributes.addClass(classes) }}>
  47. {%- if title -%}
  48. {%
  49. set summary_classes = [
  50. 'claro-details__summary',
  51. 'claro-details__summary--vertical-tabs-item',
  52. required ? 'js-form-required',
  53. required ? 'form-required',
  54. ]
  55. %}
  56. <summary{{ summary_attributes.addClass(summary_classes) }}>
  57. {{- title -}}
  58. </summary>
  59. {%- endif -%}
  60. <div{{ content_attributes.addClass(content_wrapper_classes) }}>
  61. <div{{ create_attribute({class: inner_wrapper_classes}) }}>
  62. {% if errors %}
  63. <div class="form-item form-item--error-message">
  64. {{ errors }}
  65. </div>
  66. {% endif %}
  67. {%- if description -%}
  68. <div class="claro-details__description">{{ description }}</div>
  69. {%- endif -%}
  70. {%- if children -%}
  71. {{ children }}
  72. {%- endif -%}
  73. {%- if value -%}
  74. {{ value }}
  75. {%- endif -%}
  76. </div>
  77. </div>
  78. </details>

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