You are here

cshs.html.twig in Client-side Hierarchical Select 8.3

Same filename and directory in other branches
  1. 8 templates/cshs.html.twig
  2. 8.2 templates/cshs.html.twig

Default theme implementation for a CSHS select element.

Available variables:

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

See also

cshs_theme()

File

templates/cshs.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation for a CSHS select element.
  5. *
  6. * Available variables:
  7. * - attributes: HTML attributes for the select tag.
  8. * - options: The option element children.
  9. *
  10. * @see cshs_theme()
  11. *
  12. * @ingroup themeable
  13. */
  14. #}
  15. <select{{ attributes }}>
  16. {% for option in options %}
  17. {% if option.type == 'optgroup' %}
  18. <optgroup label="{{ option.label }}">
  19. {% for sub_option in option.options %}
  20. <option value="{{ sub_option.value }}" data-parent="{{ sub_option.parent }}"{{ sub_option.selected ? ' selected="selected"' }}>
  21. {{ sub_option.label }}
  22. </option>
  23. {% endfor %}
  24. </optgroup>
  25. {% elseif option.type == 'option' %}
  26. <option value="{{ option.value }}" data-parent="{{ option.parent }}"{{ option.selected ? ' selected="selected"' }}>
  27. {{ option.label }}
  28. </option>
  29. {% endif %}
  30. {% endfor %}
  31. </select>