details--vertical-tabs.html.twig

Same filename in other branches
  1. 9 core/themes/claro/templates/navigation/details--vertical-tabs.html.twig
  2. 8.9.x 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. set classes = [
  25. 'claro-details',
  26. 'claro-details--vertical-tabs-item',
  27. ]
  28. %}
  29. {%
  30. set content_wrapper_classes = [
  31. 'claro-details__wrapper',
  32. 'details-wrapper',
  33. 'claro-details__wrapper--vertical-tabs-item',
  34. ]
  35. %}
  36. {%
  37. set inner_wrapper_classes = [
  38. 'claro-details__content',
  39. 'claro-details__content--vertical-tabs-item',
  40. ]
  41. %}
  42. <details{{ attributes.addClass(classes) }}>
  43. {%- if title -%}
  44. {%
  45. set summary_classes = [
  46. 'claro-details__summary',
  47. 'claro-details__summary--vertical-tabs-item',
  48. required ? 'js-form-required',
  49. required ? 'form-required',
  50. ]
  51. %}
  52. <summary{{ summary_attributes.addClass(summary_classes) }}>
  53. {{- title -}}
  54. </summary>
  55. {%- endif -%}
  56. <div{{ content_attributes.addClass(content_wrapper_classes) }}>
  57. <div{{ create_attribute({class: inner_wrapper_classes}) }}>
  58. {% if errors %}
  59. <div class="form-item form-item__error-message">
  60. {{ errors }}
  61. </div>
  62. {% endif %}
  63. {%- if description -%}
  64. <div class="claro-details__description">{{ description }}</div>
  65. {%- endif -%}
  66. {%- if children -%}
  67. {{ children }}
  68. {%- endif -%}
  69. {%- if value -%}
  70. {{ value }}
  71. {%- endif -%}
  72. </div>
  73. </div>
  74. </details>

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