You are here

entity-selector.html.twig in Opigno Learning path 3.x

{#
/**
 * @see template_preprocess_select()
 * @see template_preprocess_entity_selector()
 */
#}
{% spaceless %}
  <select{{ attributes }}>
    {% for option in options %}
      {% if option.type == 'optgroup' %}
        <optgroup label="{{ option.label }}">
          {% for sub_option in option.options %}
            <option
              value="{{ sub_option.value }}"{{ sub_option.selected ? ' selected="selected"' }}>{{ sub_option.label }}</option>
          {% endfor %}
        </optgroup>
      {% elseif option.type == 'option' %}
        <option value="{{ option.value }}"{{ option.selected ? ' selected="selected"' }}>{{ option.label }}</option>
      {% endif %}
    {% endfor %}
  </select>
{% endspaceless %}

File

modules/opigno_user_selection/templates/entity-selector.html.twig
View source
  1. {#
  2. /**
  3. * @see template_preprocess_select()
  4. * @see template_preprocess_entity_selector()
  5. */
  6. #}
  7. {% spaceless %}
  8. <select{{ attributes }}>
  9. {% for option in options %}
  10. {% if option.type == 'optgroup' %}
  11. <optgroup label="{{ option.label }}">
  12. {% for sub_option in option.options %}
  13. <option
  14. value="{{ sub_option.value }}"{{ sub_option.selected ? ' selected="selected"' }}>{{ sub_option.label }}</option>
  15. {% endfor %}
  16. </optgroup>
  17. {% elseif option.type == 'option' %}
  18. <option value="{{ option.value }}"{{ option.selected ? ' selected="selected"' }}>{{ option.label }}</option>
  19. {% endif %}
  20. {% endfor %}
  21. </select>
  22. {% endspaceless %}