yeti_theme-8.x-1.x-dev/templates/form/details.html.twig
templates/form/details.html.twig
{#
/**
* @file
* Yeti theme implementation 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.
*
* @see template_preprocess_details()
*
* @ingroup themeable
*/
#}
{{ attach_library('yeti/details') }}
{%
set classes = [
'details',
]
%}
{%
set content_classes = [
'details-content'
]
%}
<div{{ attributes.removeClass('required').addClass(classes) }} data-accordion data-multi-expand="true" data-allow-all-closed="true">
<div class="details-item" data-accordion-item>
{%
set summary_classes = [
required ? 'js-form-required',
required ? 'required',
'details-title',
]
%}
{%- if title and required -%}
<a{{ summary_attributes.addClass(summary_classes) }} href="#">{{ title }}</a>
{%- elseif title -%}
<a{{ summary_attributes.addClass(summary_classes) }} href="#">{{ title }}</a>
{%- endif -%}
{% if errors %}
<div>
{{ errors }}
</div>
{% endif %}
<li{{ content_attributes.addClass(content_classes) }} data-tab-content>
{{ description }}
{{ children }}
{{ value }}
</li>
</div>
</div>
