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


Исходный код

Twig код

<span class="date_field_wrapper {% if control_class_name %}{{ control_class_name }}{% else %}js-control-date{% endif %} {{class_name}}" data-kalendae-classname="{{ kalendae_class }}">

  {% if type == 'range' %}
    {% set value_splitted = value|split(' - ') %}
    {% if value_splitted|length == 1 %}
      {% set value_splitted = value_splitted[0]|split('-') %}
    {% endif %}
    <input type="hidden" class="date_field__range_0" name="{{name.from}}" value="{{ value_splitted[0] }}" />
    <input type="hidden" class="date_field__range_1" name="{{name.to}}" value="{{ value_splitted[1] }}" />
  {% endif %}

  {% set max_length = max_length|default(10) %}

  <input class="date_field {{input_class}} {% if not value %}empty{% endif %} {% if type == 'range' %}range{% endif %}" {% if id %}id="{{id}}"{% endif %} type="text" {% if type != 'range' %}maxlength="{{max_length}}"{% endif %} {% if type == 'single' %}name="{{name}}"{% endif %} {% if title_format %}data-title-format="{{title_format}}"{% endif %} {% if hide_disabled %}data-hide-disabled{% endif %} {% if blackout %} data-blackout="{{ blackout }}" {% endif %} {% if direction %}data-direction="{{ direction }}"{% endif %} {% if data_format %}data-format="{{data_format}}"{% endif %} value="{{value}}" placeholder="{{placeholder}}" {% if disabled %}disabled="disabled"{% endif %} {% if comfort_zone %} data-comfort-zone = "{{comfort_zone}}" {% endif %}/>

  {% if show_icon %}<span class="date_field-js tasks-date__caption__icon"></span>{% endif %}
  {% if not readonly %}
    <div class="date_field_wrapper--calendar">
      <svg class="svg-card-calendar-dims"><use xlink:href="#card-calendar"></use></svg>
    </div>
  {% endif %}
</span>

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