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


Исходный код

Twig код

<div class="switcher_wrapper{% if switcher_wrapper_class %} {{switcher_wrapper_class}}{% endif %}{% if blue %} controls-switcher-blue{% endif %}">
  {% if label_class_name is defined %}
    {% set label_class_name = label_class_name ~ ' switcher' %}
  {% else %}
    {% set label_class_name = 'switcher' %}
  {% endif %}
  {% set checkbox_class_name = 'switcher__checkbox' %}

  {% if disabled %}
    {% set label_class_name = label_class_name ~ ' js-disabled' %}
    {% set checkbox_class_name = checkbox_class_name ~ ' js-disabled' %}
  {% endif %}

  {% if checked %}
    {% set label_class_name = label_class_name ~ ' switcher__on' %}
  {% else %}
    {% set label_class_name = label_class_name ~ ' switcher__off' %}
  {% endif %}

  {% if class_name %}
    {% set checkbox_class_name = checkbox_class_name ~ ' ' ~ class_name %}
  {% endif %}

  {% if custom_class_name %}
    {% set label_class_name = label_class_name ~ ' ' ~ custom_class_name %}
  {% endif %}

	<label for="{{id}}" class="{{ label_class_name }}" id=""></label>
	<input type="checkbox" value="{% if value %}{{ value }}{% else %}Y{% endif %}" name="{{name}}" {% if id %}id="{{id}}"{% endif %} class="{{ checkbox_class_name }}" {% if checked %}checked{% endif %} {% if disabled %}disabled="disabled"{% endif %}>
</div>

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