socialbase-1.1.0/templates/form/dropdown.html.twig
templates/form/dropdown.html.twig
{#
/**
* @file
* Theme override for a dropdown element.
*
* Available variables:
* - attributes: HTML attributes for the dropdown tag.
* - options: The option element children.
*
* @see template_preprocess_dropdown()
*/
#}
<div{{ attributes.addClass('dropdown field--name-field-post-visibility') }}>
{# See PostForm.php we set edit_mode to true so people can't actually change the dropdown button for edit mode. #}
<button id="post-visibility" type="button" {% if edit_mode %}disabled{% endif %} data-toggle="dropdown" aria-expanded="false" aria-haspopup="true" class="btn btn-default dropdown-toggle">
<svg class="icon-small" aria-hidden="true">
<use class="btnicon" xlink:href="#icon-{{ selected_icon }}"></use>
</svg>
<span class="text">{{ selected }} </span>
{% if not edit_mode %}<span class="caret"></span>{% endif %}
</button>
{% if not edit_mode %}
<ul role="menu" aria-labelledby="post-visibility" class="dropdown-menu dropdown-menu--visibility">
<li class="dropdown-header">{{ label }}</li>
{% for key, child in items %}
<li class="list-item list-item--visibility {% if key == active %}list-item--active{% endif %}">
<a href="" role="button">
{{ child }}
</a>
</li>
{% endfor %}
</ul>
{% endif %}
</div>
