You are here

dropdown.html.twig in Open Social 8.7

Theme override for a dropdown element.

Available variables:

  • attributes: HTML attributes for the dropdown tag.
  • options: The option element children.

File

themes/socialbase/templates/form/dropdown.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Theme override for a dropdown element.
  5. *
  6. * Available variables:
  7. * - attributes: HTML attributes for the dropdown tag.
  8. * - options: The option element children.
  9. *
  10. * @see template_preprocess_dropdown()
  11. */
  12. #}
  13. <div{{ attributes.addClass('dropdown field--name-field-post-visibility') }}>
  14. {# See PostForm.php we set edit_mode to true so people can't actually change the dropdown button for edit mode. #}
  15. <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">
  16. <svg class="icon-small">
  17. <use id="btnicon" xlink:href="#icon-{{ selected_icon }}"></use>
  18. </svg>
  19. <span class="text">{{ selected }} </span>
  20. {% if not edit_mode %}<span class="caret"></span>{% endif %}
  21. </button>
  22. {% if not edit_mode %}
  23. <ul role="menu" aria-labelledby="post-visibility" class="dropdown-menu dropdown-menu--visibility">
  24. <li class="dropdown-header">{{ label }}</li>
  25. {% for key, child in items %}
  26. <li class="list-item list-item--visibility {% if key == active %}list-item--active{% endif %}"> {{ child }}
  27. </li>
  28. {% endfor %}
  29. </ul>
  30. {% endif %}
  31. </div>