<?php if($field->visible) { ?>
  <div <?php echo MtHaml\Runtime::renderAttributes(array(array('class', 'control-group'), array('title', ($field->description))), 'html5', 'UTF-8'); ?>>
    <div class="btn-group" id="when-buttons">
      <button <?php echo MtHaml\Runtime::renderAttributes(array(array('class', 'btn'), array('type', ('button')), array('data-behavior', ('DateRangeSetter')), array('data-daterange-setter-when', ('today')), array('data-daterange-setter-start-date', ('#field_validity_startDate')), array('data-daterange-setter-start-time', ('#field_validity_startTime')), array('data-daterange-setter-end-date', ('#field_validity_endDate')), array('data-daterange-setter-end-time', ('#field_validity_endTime'))), 'html5', 'UTF-8'); ?>>
        <?php echo htmlspecialchars(t('Today'),ENT_QUOTES,'UTF-8'); ?>
      </button>
      <button <?php echo MtHaml\Runtime::renderAttributes(array(array('class', 'btn'), array('type', ('button')), array('data-behavior', ('DateRangeSetter')), array('data-daterange-setter-when', ('thisweek')), array('data-daterange-setter-start-date', ('#field_validity_startDate')), array('data-daterange-setter-start-time', ('#field_validity_startTime')), array('data-daterange-setter-end-date', ('#field_validity_endDate')), array('data-daterange-setter-end-time', ('#field_validity_endTime'))), 'html5', 'UTF-8'); ?>>
        <?php echo htmlspecialchars(t('This week'),ENT_QUOTES,'UTF-8'); ?>
      </button>
      <button <?php echo MtHaml\Runtime::renderAttributes(array(array('class', 'btn'), array('type', ('button')), array('data-behavior', ('DateRangeSetter')), array('data-daterange-setter-when', ('thismonth')), array('data-daterange-setter-start-date', ('#field_validity_startDate')), array('data-daterange-setter-start-time', ('#field_validity_startTime')), array('data-daterange-setter-end-date', ('#field_validity_endDate')), array('data-daterange-setter-end-time', ('#field_validity_endTime'))), 'html5', 'UTF-8'); ?>>
        <?php echo htmlspecialchars(t('This month'),ENT_QUOTES,'UTF-8'); ?>
      </button>
      <button <?php echo MtHaml\Runtime::renderAttributes(array(array('class', 'btn'), array('type', ('button')), array('data-behavior', ('DateRangeSetter')), array('data-daterange-setter-when', ('thisyear')), array('data-daterange-setter-start-date', ('#field_validity_startDate')), array('data-daterange-setter-start-time', ('#field_validity_startTime')), array('data-daterange-setter-end-date', ('#field_validity_endDate')), array('data-daterange-setter-end-time', ('#field_validity_endTime'))), 'html5', 'UTF-8'); ?>>
        <?php echo htmlspecialchars(t('This year'),ENT_QUOTES,'UTF-8'); ?>
      </button>
    </div>
  </div>
  <div class="control-group">
    <div class="btn-group" id="when-buttons">
      <button <?php echo MtHaml\Runtime::renderAttributes(array(array('class', 'btn'), array('type', ('button')), array('data-behavior', ('DateRangeSetter')), array('data-daterange-setter-when', ('tomorrow')), array('data-daterange-setter-start-date', ('#field_validity_startDate')), array('data-daterange-setter-start-time', ('#field_validity_startTime')), array('data-daterange-setter-end-date', ('#field_validity_endDate')), array('data-daterange-setter-end-time', ('#field_validity_endTime'))), 'html5', 'UTF-8'); ?>>
        <?php echo htmlspecialchars(t('Tomorrow'),ENT_QUOTES,'UTF-8'); ?>
      </button>
      <button <?php echo MtHaml\Runtime::renderAttributes(array(array('class', 'btn'), array('type', ('button')), array('data-behavior', ('DateRangeSetter')), array('data-daterange-setter-when', ('nextweek')), array('data-daterange-setter-start-date', ('#field_validity_startDate')), array('data-daterange-setter-start-time', ('#field_validity_startTime')), array('data-daterange-setter-end-date', ('#field_validity_endDate')), array('data-daterange-setter-end-time', ('#field_validity_endTime'))), 'html5', 'UTF-8'); ?>>
        <?php echo htmlspecialchars(t('Next week'),ENT_QUOTES,'UTF-8'); ?>
      </button>
      <button <?php echo MtHaml\Runtime::renderAttributes(array(array('class', 'btn'), array('type', ('button')), array('data-behavior', ('DateRangeSetter')), array('data-daterange-setter-when', ('nextmonth')), array('data-daterange-setter-start-date', ('#field_validity_startDate')), array('data-daterange-setter-start-time', ('#field_validity_startTime')), array('data-daterange-setter-end-date', ('#field_validity_endDate')), array('data-daterange-setter-end-time', ('#field_validity_endTime'))), 'html5', 'UTF-8'); ?>>
        <?php echo htmlspecialchars(t('Next month'),ENT_QUOTES,'UTF-8'); ?>
      </button>
      <button <?php echo MtHaml\Runtime::renderAttributes(array(array('class', 'btn'), array('type', ('button')), array('data-behavior', ('DateRangeSetter')), array('data-daterange-setter-when', ('nextyear')), array('data-daterange-setter-start-date', ('#field_validity_startDate')), array('data-daterange-setter-start-time', ('#field_validity_startTime')), array('data-daterange-setter-end-date', ('#field_validity_endDate')), array('data-daterange-setter-end-time', ('#field_validity_endTime'))), 'html5', 'UTF-8'); ?>>
        <?php echo htmlspecialchars(t('Next year'),ENT_QUOTES,'UTF-8'); ?>
      </button>
    </div>
  </div>
  <?php $customValidityPeriods = $field->valuesArray; ?>
  <?php if(is_array_ex($customValidityPeriods,true)) { ?>
    <div class="control-group">
      <div class="btn-group" id="when-buttons">
        <?php $btnCVPindex=0; ?>
        <?php foreach($customValidityPeriods as $cvpLabel => $cvpDate) { ?>
          <button <?php echo MtHaml\Runtime::renderAttributes(array(array('class', 'btn'), array('type', ('button')), array('data-behavior', ('DateRangeSetter')), array('data-daterange-setter-when', $cvpDate), array('data-daterange-setter-start-date', ('#field_validity_startDate')), array('data-daterange-setter-start-time', ('#field_validity_startTime')), array('data-daterange-setter-end-date', ('#field_validity_endDate')), array('data-daterange-setter-end-time', ('#field_validity_endTime'))), 'html5', 'UTF-8'); ?>>
            <?php echo htmlspecialchars($cvpLabel,ENT_QUOTES,'UTF-8'); ?>
          </button>
          <?php $btnCVPindex++; ?>
          <?php if($btnCVPindex % 4 == 0 && $btnCVPindex > 0) { ?>
            <br />
          <?php } ?>
        <?php } ?>
      </div>
    </div>
  <?php } ?>
<?php } ?>
