templates/Form/Includes/date-picker.html.twig line 1

Open in your IDE?
  1. {% do jsConfig().add('datepicker', true) %}
  2. {% set errors = errors | default([]) %}
  3. <div class="form-group js-datepicker datepicker {{ (errors | length > 0) ? 'has-error': '' }} {{ styleModifier|default('') }}"
  4.     {% if min|default(false) %}
  5.         data-datepicker-min-date="{{ min }}"
  6.     {% endif %}
  7.     {% if max|default(false) %}
  8.         data-datepicker-min-date="{{ max }}"
  9.     {% endif %}
  10.     {% if numberOfMonths|default(false) %}
  11.         data-datepicker-number-of-months="{{ numberOfMonths }}"
  12.     {% endif %}
  13. >
  14.     <div class="{{ inputWrapperModifier|default('') }}">
  15.         {# This input contains the formatted date (according to locale) - don't use it in backend #}
  16.         <input
  17.             class="js-datepicker__input form-control {{ (errors | length > 0 )? 'is-invalid': '' }} {{ inputModifier|default('') }}"
  18.             name="{{ name }}-fake"
  19.             id="{{ id }}"
  20.             value=""
  21.             {{ required|default(false) ? 'required' : '' }}
  22.             {{ disabled|default(false) ? 'disabled' : '' }}
  23.             readonly
  24.             {{ helpText | default(null) ? 'aria-describedby="' ~ id ~'-help-block"' : '' }}
  25.             {% for key, value in inputAttributes | default([]) %}
  26.                 {{key}}="{{value}}"
  27.             {% endfor %}
  28.         >
  29.     
  30.         {{ include('Form/Includes/form-control-label.html.twig', _context) }}
  31.     
  32.         {# Use the value of the following input in backend. It contains the selected date in the format 'Y-m-d\TH:i:s' (like ISO 8601 without timezone) #}
  33.         <input type="hidden"
  34.                name="{{ name }}"
  35.                value="{{ value }}"
  36.                class="form-control js-datepicker__alt-field {{ inputHiddenModifier|default('') }}"
  37.                readonly>
  38.     </div>
  39.     {{ include('Form/Includes/form-errors.html.twig', _context) }}
  40.     {{ include('Form/Includes/form-control-help-text.html.twig', _context) }}
  41. </div>