better_exposed_filters-8.x-4.x-dev/templates/bef-radios.html.twig
templates/bef-radios.html.twig
{#
Themes a single-select exposed form element as radio buttons.
Available variables:
- wrapper_attributes: attributes for the wrapper element.
- element: The collection of checkboxes.
- children: An array of keys for the children of element.
- is_nested: TRUE if this is to be rendered as a nested list.
- depth: If is_nested is TRUE, this holds an array in the form of
child_id => nesting_level which defines the depth a given element should
appear in the nested list.
#}
{%
set classes = [
'form-radios',
is_nested ? 'bef-nested',
display_inline ? 'form--inline'
]
%}
<div{{ wrapper_attributes.addClass(classes) }}>
{% set current_nesting_level = 0 %}
{% for child in children %}
{% set item = attribute(element, child) %}
{% if is_nested %}
{% set new_nesting_level = attribute(depth, child) %}
{% include '@better_exposed_filters/bef-nested-elements.html.twig' %}
{% set current_nesting_level = new_nesting_level %}
{% else %}
{{ item }}
{% endif %}
{% endfor %}
</div>
