КОНТРОЛЫ/suggest.md


Исходный код

Twig код

<div class="control-wrapper control--suggest {{class_name}}{% if list_separated %} control-suggest_separated{% endif %}"{% if wrapper_id %} id="{{wrapper_id}}"{% endif %} {{ additional_data|raw }}>
  {% if suggest_icon %}
    <span class="control--suggest--icon icon icon-{{suggest_icon}}"></span>
  {% endif %}

  {% if value_id is not defined %}
    {% set value_id = "" %}
  {% endif %}
  {% set value_title = "" %}

  <ul class="control--suggest--list js-control--suggest--list custom-scroll {{ list_class_name }}">
    {% for v in items %}
    <li data-value-id="{% if v.id %}{{v.id}}{% else %}{{v.value}}{% endif %}" class="control--suggest--list--item {% if (selected and (v.id == selected)) or (selected and (v.value == selected)) %}{% set value_id = v.id %}{% set value_title = v.value %}control--suggest--list--item-selected{% elseif not selected and (loop.index0 == 0) %}{% set value_id = v.id %}control--suggest--list--item-selected{% endif %} {{v.custom_class}}">
      <span class="control--suggest--list--item-inner" title="{{v.value}}">{{v.value}}</span>
    </li>
    {% endfor %}
  </ul>

  {% if not selected and value|length and not selected_should_be_empty %}
    {% set selected = value %}
  {% endif %}

  {% block input %}
  <input data-enable-filter="{{disable_filter ? 'n' : 'y'}}" autocomplete="off" name="{{name}}" class="{% if not styled_input %}text-input{% endif %} control--suggest--input {% if ajax is defined %}js-control--suggest--input-ajax{% else %}js-control--suggest--input control--suggest--input-inline{% endif %} {{input_class_name}}" {% if id %}id="{{id}}"{% endif %} type="{{ input_type ? input_type : 'text' }}" placeholder="{{placeholder}}" value="{{value_title|default(selected)}}" data-value-id="{{ value_id }}" data-type="{{type}}" {% if ajax is defined %}data-url="{{ajax.url}}" data-params="{{ajax.params}}" data-headers="{{ajax.headers}}"{% endif %} {% if disabled %}disabled="disabled"{% endif %} {{additional_data|raw}} />
  {% endblock %}

  {% if ajax is not defined and items|length %}
    <b class="control--suggest--down-btn"></b>
  {% endif %}

  {% if closable %}
  <span id="search_clear_button" class="date_field--clear">
    <span class="icon icon-inline icon-search-cancel"></span>
    <span class="icon icon-inline js-search-hide icon-close"></span>
  </span>
  {% endif %}
</div>

Ссылка на вики репозиторий