You are here

details--plain.html.twig in Open Social 8

Theme override for a details 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.

File

themes/socialbase/templates/system/details--plain.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Theme override for a details element.
  5. *
  6. * Available variables
  7. * - attributes: A list of HTML attributes for the details element.
  8. * - errors: (optional) Any errors for this details element, may not be set.
  9. * - title: (optional) The title of the element, may not be set.
  10. * - description: (optional) The description of the element, may not be set.
  11. * - children: (optional) The children of the element, may not be set.
  12. * - value: (optional) The value of the element, may not be set.
  13. *
  14. * @see template_preprocess_details()
  15. */
  16. #}
  17. {% set heading = title %}
  18. {% set body = children %}
  19. {%
  20. set classes = [
  21. 'panel',
  22. errors ? 'panel-danger' : 'panel-' ~ panel_type|clean_class,
  23. ]
  24. %}
  25. <div{{ attributes.addClass(classes).removeClass('form-wrapper') }}>
  26. {# Heading #}
  27. {% if heading %}
  28. {% block heading %}
  29. <div class="panel-heading">
  30. <header>
  31. {%
  32. set heading_classes = [
  33. 'panel-title',
  34. ]
  35. %}
  36. {% if collapsible %}
  37. <a{{ heading_attributes.addClass(heading_classes) }} href="{{ target }}">{{ heading }}</a>
  38. {% else %}
  39. <div{{ heading_attributes.addClass(heading_classes) }}>{{ heading }}</div>
  40. {% endif %}
  41. </header>
  42. </div>
  43. {% endblock %}
  44. {% endif %}
  45. {# Body #}
  46. {% block body %}
  47. {%
  48. set body_classes = [
  49. 'panel-body',
  50. collapsible ? 'panel-collapse',
  51. collapsible ? 'collapse',
  52. collapsible ? 'fade',
  53. errors or collapsible and not collapsed ? 'in',
  54. ]
  55. %}
  56. {%
  57. set description_classes = [
  58. 'help-block',
  59. description and description.position == 'invisible' ? 'sr-only',
  60. ]
  61. %}
  62. <div{{ body_attributes.addClass(body_classes) }}>
  63. {% if description and description.position == 'before' %}
  64. <p{{ description.attributes.addClass(description_classes) }}>{{ description.content }}</p>
  65. {% endif %}
  66. {{ body }}
  67. {% if description and description.position == 'after' or description.position == 'invisible' %}
  68. <p{{ description.attributes.addClass(description_classes) }}>{{ description.content }}</p>
  69. {% endif %}
  70. </div>
  71. {% endblock %}
  72. {# Footer #}
  73. {% if footer %}
  74. {% block footer %}
  75. {%
  76. set footer_classes = [
  77. 'panel-footer',
  78. ]
  79. %}
  80. <div{{ footer_attributes.addClass(footer_classes) }}>{{ footer }}</div>
  81. {% endblock %}
  82. {% endif %}
  83. </div>