You are here

protected function availability_calendar_handler_filter_availability::fillEmptyValueFromOther in Availability Calendars 7.5

If 1 of the values is empty, try to fill it based on the other value and the (operator) type.

Parameters

string|int|null $value1:

string|int|null $value2:

string $type:

1 call to availability_calendar_handler_filter_availability::fillEmptyValueFromOther()
availability_calendar_handler_filter_availability::accept_exposed_input in views/availability_calendar_handler_filter_availability.inc
Check to see if input from the exposed filters should be accepted.

File

views/availability_calendar_handler_filter_availability.inc, line 605

Class

availability_calendar_handler_filter_availability
Views handler to filter on availability.

Code

protected function fillEmptyValueFromOther(&$value1, &$value2, $type) {
  if ($type === 'to' || $type === 'to1') {
    if (empty($value2)) {

      // Use from value also as to or to1 value, this will also work for to1
      // as this is not corrected by 1 day in op_from_to1().
      $value2 = $value1;
    }
    else {
      if (empty($value1)) {
        if ($type === 'to') {
          $value1 = $value2;
        }
        else {

          // Correct by 1 day for to1;
          $from = availability_calendar_parse_entry_date($value2);
          $from
            ->modify('-1 day');
          $value1 = $from
            ->format(AC_ISODATE);
        }
      }
    }
  }
}