You are here

class availability_calendar_handler_filter_availability in Availability Calendars 7.5

Same name and namespace in other branches
  1. 7.3 availability_calendar_handler_filter_availability.inc \availability_calendar_handler_filter_availability
  2. 7.4 views/availability_calendar_handler_filter_availability.inc \availability_calendar_handler_filter_availability

Views handler to filter on availability.

This filter inherits from views_handler_filter as inheriting from views_handler_filter_numeric or views_handler_filter_date did not turn out to be a lot easier.

This filter allows to filter on availability by accepting the following values:

  • 1 date (for availability at that given date).
  • Begin and end date (end date inclusive).
  • Arrival and departure date (departure date not inclusive).
  • Start date and duration.

Hierarchy

Expanded class hierarchy of availability_calendar_handler_filter_availability

2 string references to 'availability_calendar_handler_filter_availability'
AvailabilityCalendarViewsController::views_data in views/availability_calendar_views_controller.inc
Overrides the result for hook_views_data().
availability_calendar_field_views_data_alter in views/availability_calendar.views.inc
Implements hook_field_views_data_alter().

File

views/availability_calendar_handler_filter_availability.inc, line 16

View source
class availability_calendar_handler_filter_availability extends views_handler_filter {
  public static $instance;

  /** @var bool */
  protected $autoSubmit = FALSE;
  public function __construct() {
    self::$instance = $this;
    $this->always_multiple = TRUE;
    module_load_include('inc', 'availability_calendar');
  }
  public function option_definition() {
    $options = parent::option_definition();
    $options['value'] = array(
      'contains' => array(
        'from' => array(
          'default' => '',
        ),
        'to' => array(
          'default' => '',
        ),
        'to1' => array(
          'default' => '',
        ),
        'duration' => array(
          'default' => '',
        ),
      ),
    );
    $options['operator'] = array(
      'default' => 'from_duration',
    );
    return $options;
  }

  /** @noinspection PhpMethodMayBeStaticInspection */
  public function operators() {
    $operators = array(
      'at' => array(
        'title' => t('At (date)'),
        'method' => 'op_at',
        'summary' => t('at %from'),
        'values' => array(
          'from',
        ),
      ),
      'from_to' => array(
        'title' => t('From begin up to and including end'),
        'method' => 'op_from_to',
        'summary' => t('From %from to %to'),
        'values' => array(
          'from',
          'to',
        ),
      ),
      'from_to1' => array(
        'title' => t('From arrival to departure'),
        'method' => 'op_from_to1',
        'summary' => t('From %from to %to1'),
        'values' => array(
          'from',
          'to1',
        ),
      ),
      'from_duration' => array(
        'title' => t('From begin during duration'),
        'method' => 'op_from_duration',
        'summary' => t('From %from during %duration days'),
        'values' => array(
          'from',
          'duration',
        ),
      ),
    );
    return $operators;
  }

  /**
   * Provides a list of all the availability operators, optionally restricted
   * to only the given property of the operators.
   *
   * @param string $which
   *
   * @return array
   */
  public function operator_options($which = 'title') {
    $options = array();
    foreach ($this
      ->operators() as $id => $operator) {
      $options[$id] = $operator[$which];
    }
    return $options;
  }

  /**
   * Add validation and date popup(s) to the value form.
   *
   * @param array $form
   * @param array $form_state
   */
  public function value_form(&$form, &$form_state) {
    $form['value']['#tree'] = TRUE;
    if (empty($form_state['exposed'])) {

      // We're in Views edit mode self. Add validator here. When we're in an
      // exposed form, validation will go via exposed_validate().
      $form['value']['#element_validate'][] = 'availability_calendar_handler_filter_availability_validate_value';
    }

    // Determine the operators to add.
    $dependent_element = '';
    $operators = $this
      ->operators();
    if (!empty($form_state['exposed'])) {
      if (empty($this->options['expose']['use_operator']) || empty($this->options['expose']['operator_id'])) {

        // Exposed form with operator not exposed: only add values for the set
        // operator.
        $operators = array_intersect_key($operators, array(
          $this->operator => 0,
        ));
      }
      else {

        // Exposed form with operator exposed: add all values and dependencies.
        $dependent_element = $this->options['expose']['operator_id'];
      }
    }
    else {

      // Views UI.
      if (!empty($form['operator'])) {
        $dependent_element = 'operator';
      }
    }
    if ($dependent_element) {
      $dependent_name = str_replace('_', '-', $dependent_element);
      $dependency_source = $form[$dependent_element]['#type'] === 'radios' ? "radio:options[{$dependent_name}]" : "edit-{$dependent_name}";
    }
    else {
      $dependency_source = NULL;
    }

    // Determine values to add and their dependencies.
    // Add value fields. As the title is based on both the type of value and the
    // operator, we add fields per operator, even if the type of value is the
    // same.
    $values = array();
    foreach ($operators as $operator => $options) {
      foreach ($options['values'] as $value) {
        if (isset($values[$value])) {
          $values[$value][] = $operator;
        }
        else {
          $values[$value] = array(
            $operator,
          );
        }
      }
    }
    foreach ($values as $value => $operators) {
      if ($value !== 'duration') {
        $form['value'][$value] = $this
          ->value_form_date_field($values[$value], $value, $dependency_source);
      }
      else {
        $form['value'][$value] = $this
          ->value_form_duration_field($values[$value], $value, $dependency_source);
      }
    }
    if (module_exists('date_popup')) {

      // If we have exactly 1 to field (to or to1) we turn the 2 date pickers
      // into 1 date range picker.
      if (!empty($form['value']['to'])) {
        if (empty($form['value']['to1'])) {
          $this
            ->change_elements_into_date_range_picker($form['value']['from'], 'to');
        }
      }
      else {
        if (!empty($form['value']['to1'])) {
          $this
            ->change_elements_into_date_range_picker($form['value']['from'], 'to1');
        }
      }
    }
  }

  /**
   * Returns a date form field definition for the given operand
   *
   * @param string[] $operators
   *   The names of the possible operators for this operand in the given
   *   context: at, from_to, from_to1, from_duration
   * @param string $operand
   *   The name of the operand: from, to, to1, duration
   * @param string $dependency_source
   *   The name of the dependency source
   *
   * @return array
   *   A form field definition.
   */
  protected function value_form_date_field($operators, $operand, $dependency_source) {
    $operator = in_array($this->operator, $operators) ? $this->operator : reset($operators);
    $variable_name = "availability_calendar_views_op_{$operator}_{$operand}";
    $element = array(
      '#type' => 'textfield',
      '#title' => availability_calendar_get_customizable_text($variable_name),
      '#size' => 12,
      '#default_value' => $this->value[$operand],
    );
    if (module_exists('date_popup')) {
      $this
        ->change_element_into_date_popup($element);
    }
    else {
      $date_example = new DateTime();
      if ($operand === 'to') {
        $date_example
          ->modify('+6');
      }
      else {
        if ($operand === 'to1') {
          $date_example
            ->modify('+7');
        }
      }
      $date_example = availability_calendar_format_entry_date($date_example);
      $element['#description'] = t('E.g., @date', array(
        '@date' => $date_example,
      ));
    }
    if ($dependency_source !== NULL) {
      $element['#dependency'] = array(
        $dependency_source => $operators,
      );
    }
    return $element;
  }

  /**
   * Returns a duration form field definition for the given operand
   *
   * @param string[] $operators
   *   The names of the possible operators for this operand in the given
   *   context: (at, from_to, from_to1,) from_duration
   * @param string $operand
   *   The name of the operand: (from, to, to1,) duration
   * @param string $dependency_source
   *   The name of the dependency source
   *
   * @return array
   *   A form field definition.
   */
  protected function value_form_duration_field($operators, $operand, $dependency_source) {
    $operator = in_array($this->operator, $operators) ? $this->operator : reset($operators);
    $options = array(
      0 => t('- Select duration -'),
    );
    for ($i = 1; $i <= 28; $i++) {
      if ($i % 7 === 0) {
        $options[$i] = format_plural($i / 7, '1 week', '@count weeks');
      }
      else {
        if ($i <= 20) {
          if ($this->definition['allocation_type'] === AC_ALLOCATION_TYPE_FULLDAY) {
            $options[$i] = format_plural($i, '1 day', '@count days');
          }
          else {
            $options[$i] = format_plural($i, '1 night', '@count nights');
          }
        }
      }
    }
    $variable_name = "availability_calendar_views_op_{$operator}_{$operand}";
    $element = array(
      '#type' => 'select',
      '#title' => availability_calendar_get_customizable_text($variable_name),
      '#options' => $options,
      '#default_value' => $this->value[$operand],
    );
    if ($dependency_source !== NULL) {
      $element['#dependency'] = array(
        $dependency_source => $operators,
      );
    }
    return $element;
  }

  /**
   * Changes a (text) form element into a date popup element.
   *
   * @param array $element
   */
  protected function change_element_into_date_popup(&$element) {
    $element['#type'] = 'date_popup';
    $element['#date_label_position'] = 'none';
    $element['#date_type'] = 'DATE_ISO';
    $element['#date_format'] = variable_get('date_format_availability_calendar_date_entry', AC_DATE_ENTRY);
    $element['#datepicker_options'] = $this
      ->get_date_popup_options();
  }

  /**
   * Changes a (text) form element into a date popup element.
   *
   * @param array $elementFrom
   * @param string $operand
   */
  protected function change_elements_into_date_range_picker(array &$elementFrom, $operand) {
    $elementFrom['#datepicker_options'] += $this
      ->get_date_range_picker_options($operand);
    $elementFrom['#attributes'] = array(
      'data-date-range-end' => "[from] [{$operand}]",
    );
    $elementFrom['#attached']['js'][] = drupal_get_path('module', 'availability_calendar') . '/BuroRaDer.DateRangePicker.js';
    $elementFrom['#attached']['css'][] = drupal_get_path('module', 'availability_calendar') . '/BuroRaDer.DateRangePicker.css';
    $elementFrom['#attached']['js'][] = drupal_get_path('module', 'availability_calendar') . '/availability_calendar.date-range-picker.js';
  }

  /**
   * Returns an array of options for the date (range) picker.
   *
   * @return array
   */
  protected function get_date_popup_options() {
    $field_info = availability_calendar_get_field_instance_info($this->real_field);
    $show_number_of_months = NULL;
    $show_week_number = FALSE;
    $first_day_of_week = NULL;
    foreach ($field_info['bundles'] as $entity_type => $bundles) {
      foreach ($bundles as $bundle => $field_instance_info) {
        $settings = $field_instance_info['display']['default']['settings'];
        if (isset($settings['show_number_of_months'])) {
          $show_number_of_months = $show_number_of_months === NULL ? $settings['show_number_of_months'] : min($show_number_of_months, (int) $settings['show_number_of_months']);
        }
        if (isset($settings['first_day_of_week'])) {
          if ($first_day_of_week !== FALSE) {
            if ($first_day_of_week === NULL) {
              $first_day_of_week = (int) $settings['first_day_of_week'];
            }
            else {
              if ($first_day_of_week != (int) $settings['first_day_of_week']) {
                $first_day_of_week = FALSE;
              }
            }
          }
        }
        if (isset($settings['show_week_number'])) {
          $show_week_number = $show_week_number || (bool) $settings['show_week_number'];
        }
      }
    }
    if ($first_day_of_week === NULL | $first_day_of_week === FALSE) {
      $first_day_of_week = variable_get('date_first_day', 6);
    }
    return array(
      'firstDay' => $first_day_of_week,
      'minDate' => 0,
      'maxDate' => sprintf('+%dm', $show_number_of_months),
      'showWeek' => $show_week_number,
    );
  }

  /**
   * Returns an array of options for the date (range) picker.
   *
   * @param string $operand
   *
   * @return array
   */
  protected function get_date_range_picker_options($operand) {
    $field_info = availability_calendar_get_field_instance_info($this->real_field);
    $show_split_day = TRUE;
    $first_day_of_week = NULL;
    foreach ($field_info['bundles'] as $entity_type => $bundles) {
      foreach ($bundles as $bundle => $field_instance_info) {
        $show_split_day = $show_split_day && (bool) $field_instance_info['display']['default']['settings']['show_split_day'];
      }
    }
    return array(
      'showSplitDay' => $show_split_day,
      'isTo1' => $operand === 'to1',
      'minRangeDuration' => $operand === 'to1' ? 1 : 0,
      'doneText' => availability_calendar_get_customizable_text('availability_calendar_date_range_picker_done'),
      'clearText' => availability_calendar_get_customizable_text('availability_calendar_date_range_picker_clear'),
    );
  }

  /**
   * Validates our part of the exposed form.
   *
   * What we accept as valid depends on the situation.
   * Always:
   * - A non empty date or duration must have a valid value.
   * - If this filter is not required, both from and to/to1/duration may be
   *   empty.
   * For non auto-submit forms:
   * - From and to/to1/duration should both be filled in or both be empty.
   * For auto-submit forms:
   * - It may be that only 1 value is filled in. If the input is accepted and
   *   how it is processed depends on what is filled in,
   *
   * {@see accept_exposed_input()}.
   *
   * Overrides {@see views_handler::exposed_validate()}.
   *
   * @param array $form
   * @param array $form_state
   */
  public function exposed_validate(&$form, &$form_state) {
    if (empty($this->options['exposed'])) {
      return;
    }
    $this
      ->validate_value($form[$this->options['expose']['identifier']], $form_state);

    // We need this information later on in accept_exposed_input().
    $this->autoSubmit = (bool) (!empty($form_state['exposed'])) && $form_state['exposed_form_plugin']->options['autosubmit'];
  }

  /**
   * Validate that the values convert to something usable.
   *
   * @param array $element
   * @param array $form_state
   */
  public function validate_value(&$element, $form_state) {
    if (empty($form_state['exposed'])) {

      // In Views UI, the value is required if the filter is not exposed,
      // otherwise we don't validate at all (so people can place "help texts" in
      // the inputs.)
      if ($form_state['values']['options']['expose_button']['checkbox']['checkbox']) {
        return;
      }
      $required = FALSE;
      $autoSubmit = FALSE;
      $operator = $form_state['values']['options']['operator'];
    }
    else {

      // In exposed forms, values are required if "Required" was checked and if
      // this is not an auto-submitted form.
      $required = (bool) $this->options['expose']['required'];
      $autoSubmit = (bool) $form_state['exposed_form_plugin']->options['autosubmit'];
      $operator = empty($this->options['expose']['use_operator']) ? $this->operator : $form_state['values'][$this->options['expose']['operator_id']];
    }
    $operators = $this
      ->operators();
    $values = empty($operator) ? array(
      'from',
      'to',
      'to1',
      'duration',
    ) : $operators[$operator]['values'];

    // Set time to midnight as other dates are also set to that time.
    $today = new DateTime();
    $today
      ->setTime(0, 0, 0);
    $value = drupal_array_get_nested_value($form_state['values'], $element['#parents']);
    $from_valid = FALSE;
    $requireFrom = FALSE;
    if (in_array('from', $values) && array_key_exists('from', $value)) {
      $from_valid = $this
        ->validate_valid_time_1($element['from'], $value['from'], $required && !$autoSubmit, $today, t('Only future availability can be searched.'));
    }
    if (in_array('to', $values) && array_key_exists('to', $value)) {
      $to_valid = $this
        ->validate_valid_time_1($element['to'], $value['to'], ($required || $from_valid instanceof DateTime) && !$autoSubmit, $from_valid, t('The end date should be on or after the start date.'));
      if ($to_valid instanceof DateTime) {
        $requireFrom = TRUE;
      }
    }
    if (in_array('to1', $values) && array_key_exists('to1', $value)) {
      $to1_valid = $this
        ->validate_valid_time_1($element['to1'], $value['to1'], ($required || $from_valid instanceof DateTime) && !$autoSubmit, $from_valid, t('The departure date should be after the arrival date.'));
      if ($to1_valid instanceof DateTime) {
        $requireFrom = TRUE;
      }
    }
    if (in_array('duration', $values) && array_key_exists('duration', $value)) {
      $duration_valid = $this
        ->validate_valid_duration($element['duration'], $value['duration'], ($required || $from_valid instanceof DateTime) && !$autoSubmit);
      if ($duration_valid && !empty($value['duration'])) {
        $requireFrom = TRUE;
      }
    }

    // Do a 2nd check on from based on whether a 2nd operand was filled in,
    // making from required for non auto submitting forms.
    if ($from_valid && $requireFrom && !$autoSubmit && empty($value['from'])) {
      form_error($element['from'], t('Field %field is required.', array(
        '%field' => $element['from']['#title'],
      )));
    }
  }

  /**
   * @param array $element
   * @param array|string $value
   * @param bool $required
   * @param DateTime|bool $minimum
   * @param string $minimum_error_message
   *
   * @return DateTime|bool
   *   A DateTime if the value could be parsed into a Datetime, true if the
   *   value could not be parsed into a valid date but is valid anyway (empty,
   *   default value), false otherwise.
   */
  protected function validate_valid_time_1(&$element, $value, $required, $minimum, $minimum_error_message) {

    // If date popup is enabled, the value will be an array (with a date and
    // time component).
    if (is_array($value)) {
      $value = $value['date'];
    }
    if (empty($value)) {
      $result = !$required;
      if ($required) {
        form_error($element, t('Field %field is required.', array(
          '%field' => $element['#title'],
        )));
      }
    }
    else {
      if (($result = availability_calendar_parse_entry_date($value)) === FALSE) {

        // We accept non valid default values and treat them as empty, so they
        // can be filled with a "help text".
        $result = $value == $element['#default_value'];
        if (!$result) {
          form_error($element, t('Invalid date format.'));
        }
      }
      else {
        if ($minimum instanceof DateTime && $result < $minimum) {
          form_error($element, $minimum_error_message);
          $result = FALSE;
        }
      }
    }
    return $result;
  }

  /**
   * @param array $element
   * @param string|int $value
   * @param bool $required
   *
   * @return bool
   *   Whether the duration field has tobe considered valid.
   */
  protected function validate_valid_duration(&$element, $value, $required) {
    $valid = TRUE;
    if (empty($value)) {
      if ($required) {
        form_error($element, t('Field %field is required.', array(
          '%field' => $element['#title'],
        )));
        $valid = FALSE;
      }
    }
    else {
      if (!is_int($value) && !ctype_digit($value) || $value <= 0) {
        form_error($element, t('Duration must be a positive number of days.'));
        $valid = FALSE;
      }
    }
    return $valid;
  }

  /**
   * Check to see if input from the exposed filters should be accepted.
   *
   * For non auto-submit forms:
   * - from and to/to1/duration should both be filled in.
   * For auto-submit forms:
   * - if only from is filled in and to/to1/duration is empty, the duration is
   *   taken as 1; to is taken as from; or to1 is taken as from + 1.
   * - if only to is filled in, from is taken as to
   * - if only to1 is filled in, from is taken as to1 - 1
   * - if only duration is filled in, we validated as correct but do not accept
   *   the exposed input.
   *
   * @param array $input
   *
   * @return bool
   */
  public function accept_exposed_input($input) {
    if (empty($this->options['exposed'])) {
      return TRUE;
    }
    if (!empty($this->options['expose']['use_operator']) && !empty($this->options['expose']['operator_id']) && isset($input[$this->options['expose']['operator_id']])) {

      // Fetch operator from form (instead of from $this object)
      $this->operator = $input[$this->options['expose']['operator_id']];
    }
    if (!empty($this->options['expose']['identifier'])) {

      // Fetch values from form (instead of from $this object).
      $this->value = $input[$this->options['expose']['identifier']];
      $operators = $this
        ->operators();
      $values = $operators[$this->operator]['values'];

      // Get valid or emptied value for from.
      $from =& $this
        ->getValidOrEmptyValue($this->value[$values[0]], $values[0]);
      if (count($values) === 1) {
        return !empty($from);
      }
      else {

        // Get valid or emptied value for other value (to/to1/duration).
        $other =& $this
          ->getValidOrEmptyValue($this->value[$values[1]], $values[1]);

        // Try to fill an empty value based on the value of the other operand.
        if ($this->autoSubmit) {
          $this
            ->fillEmptyValueFromOther($from, $other, $values[1]);
        }

        // We can now accept the exposed input if both values are not empty.
        return !empty($from) && !empty($other);
      }
    }
    return TRUE;
  }

  /**
   * Returns the given value if it is valid or an empty value otherwise.
   *
   * @param string|int $value
   * @param string $type
   *
   * @return string|int|null
   *
   */
  protected function &getValidOrEmptyValue(&$value, $type) {
    $empty = empty($value);
    if (!$empty) {

      // If the value is not empty but does not validate, it apparently is
      // the default value ("help text") that should be treated as empty.
      $valid = $type === 'duration' ? (is_int($value) || ctype_digit($value)) && $value > 0 : availability_calendar_parse_entry_date($value) !== FALSE;
      if (!$valid) {
        $value = NULL;
      }
    }
    return $value;
  }

  /**
   * If 1 of the values is empty, try to fill it based on the other value and
   * the (operator) type.
   *
   * @param string|int|null $value1
   * @param string|int|null $value2
   * @param string $type
   */
  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);
          }
        }
      }
    }
  }
  public function query() {
    $operators = $this
      ->operators();
    if (isset($operators[$this->operator]['method'])) {
      $this
        ->{$operators[$this->operator]['method']}();
    }
  }
  protected function op_at() {
    $this->value['duration'] = 1;
    $this
      ->op_from_duration();
  }
  protected function op_from_to() {
    $this
      ->build_query(availability_calendar_parse_entry_date($this->value['from']), availability_calendar_parse_entry_date($this->value['to']));
  }
  protected function op_from_to1() {
    $from = availability_calendar_parse_entry_date($this->value['from']);
    $to = availability_calendar_parse_entry_date($this->value['to1']);
    if ($from instanceof DateTime && $to instanceof DateTime) {

      // Departure date (to1) is not inclusive. So we modify it by 1 day.
      // But we do accept the same dates for arrival (from) and departure (to1).
      // In that case we leave the to date as is (equal to the from date).
      if ($to > $from) {
        $to
          ->modify('-1 day');
      }
      $this
        ->build_query($from, $to);
    }
  }
  protected function op_from_duration() {
    $this
      ->build_query(availability_calendar_parse_entry_date($this->value['from']), (int) $this->value['duration']);
  }

  /**
   * Helper method for the op_... methods that builds the query.
   *
   * @param DateTime $from
   * @param DateTime|integer $to_or_duration
   */
  protected function build_query($from, $to_or_duration) {
    $this
      ->ensure_my_table();

    /** @noinspection PhpParamsInspection */
    availability_calendar_query_available($this->query, $this->table_alias, $this->real_field, $from, $to_or_duration, $this->definition['default_state']);
  }
  public function admin_summary() {
    $output = '';
    if (!empty($this->options['exposed'])) {
      $output = t('exposed');
    }
    else {
      $operators = $this
        ->operators();
      if (isset($operators[$this->operator]['summary'])) {
        $arguments = array();
        foreach ($this->value as $key => $value) {
          $arguments["%{$key}"] = $value;
        }
        $output = format_string($operators[$this->operator]['summary'], $arguments);
      }
    }
    return $output;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
availability_calendar_handler_filter_availability::$autoSubmit protected property @var bool
availability_calendar_handler_filter_availability::$instance public static property
availability_calendar_handler_filter_availability::accept_exposed_input public function Check to see if input from the exposed filters should be accepted. Overrides views_handler_filter::accept_exposed_input
availability_calendar_handler_filter_availability::admin_summary public function Display the filter on the administrative summary. Overrides views_handler_filter::admin_summary
availability_calendar_handler_filter_availability::build_query protected function Helper method for the op_... methods that builds the query. 1
availability_calendar_handler_filter_availability::change_elements_into_date_range_picker protected function Changes a (text) form element into a date popup element.
availability_calendar_handler_filter_availability::change_element_into_date_popup protected function Changes a (text) form element into a date popup element.
availability_calendar_handler_filter_availability::exposed_validate public function Validates our part of the exposed form. Overrides views_handler::exposed_validate
availability_calendar_handler_filter_availability::fillEmptyValueFromOther protected function If 1 of the values is empty, try to fill it based on the other value and the (operator) type.
availability_calendar_handler_filter_availability::getValidOrEmptyValue protected function Returns the given value if it is valid or an empty value otherwise.
availability_calendar_handler_filter_availability::get_date_popup_options protected function Returns an array of options for the date (range) picker.
availability_calendar_handler_filter_availability::get_date_range_picker_options protected function Returns an array of options for the date (range) picker.
availability_calendar_handler_filter_availability::operators public function @noinspection PhpMethodMayBeStaticInspection
availability_calendar_handler_filter_availability::operator_options public function Provides a list of all the availability operators, optionally restricted to only the given property of the operators. Overrides views_handler_filter::operator_options
availability_calendar_handler_filter_availability::option_definition public function Information about options for all kinds of purposes will be held here. Overrides views_handler_filter::option_definition
availability_calendar_handler_filter_availability::op_at protected function
availability_calendar_handler_filter_availability::op_from_duration protected function
availability_calendar_handler_filter_availability::op_from_to protected function
availability_calendar_handler_filter_availability::op_from_to1 protected function
availability_calendar_handler_filter_availability::query public function Add this filter to the query. Overrides views_handler_filter::query
availability_calendar_handler_filter_availability::validate_valid_duration protected function
availability_calendar_handler_filter_availability::validate_valid_time_1 protected function
availability_calendar_handler_filter_availability::validate_value public function Validate that the values convert to something usable.
availability_calendar_handler_filter_availability::value_form public function Add validation and date popup(s) to the value form. Overrides views_handler_filter::value_form
availability_calendar_handler_filter_availability::value_form_date_field protected function Returns a date form field definition for the given operand
availability_calendar_handler_filter_availability::value_form_duration_field protected function Returns a duration form field definition for the given operand
availability_calendar_handler_filter_availability::__construct public function
views_handler::$handler_type public property The type of the handler, for example filter/footer/field.
views_handler::$query public property Where the $query object will reside:. 1
views_handler::$real_field public property The actual field in the database table, maybe different on other kind of query plugins/special handlers.
views_handler::$relationship public property The relationship used for this field.
views_handler::$table_alias public property The alias of the table of this handler which is used in the query.
views_handler::$view public property The top object of a view. Overrides views_object::$view
views_handler::access public function Check whether current user has access to this handler. 10
views_handler::broken public function Determine if the handler is considered 'broken'. 6
views_handler::case_transform public function Transform a string by a certain method.
views_handler::ensure_my_table public function Ensure the main table for this handler is in the query. This is used a lot. 8
views_handler::exposed_submit public function Submit the exposed handler form.
views_handler::expose_submit public function Perform any necessary changes to the form exposes prior to storage. There is no need for this function to actually store the data.
views_handler::extra_options public function Provide defaults for the handler.
views_handler::extra_options_form public function Provide a form for setting options. 1
views_handler::extra_options_submit public function Perform any necessary changes to the form values prior to storage. There is no need for this function to actually store the data.
views_handler::extra_options_validate public function Validate the options form.
views_handler::get_field public function Shortcut to get a handler's raw field value.
views_handler::get_join public function Get the join object that should be used for this handler.
views_handler::groupby_form public function Provide a form for aggregation settings. 1
views_handler::groupby_form_submit public function Perform any necessary changes to the form values prior to storage. There is no need for this function to actually store the data. 1
views_handler::has_extra_options public function If a handler has 'extra options' it will get a little settings widget and another form called extra_options. 1
views_handler::is_exposed public function Determine if this item is 'exposed', meaning it provides form elements to let users modify the view.
views_handler::needs_style_plugin public function Determine if the argument needs a style plugin. 1
views_handler::placeholder public function Provides a unique placeholders for handlers.
views_handler::post_execute public function Run after the view is executed, before the result is cached. 1
views_handler::pre_query public function Run before the view is built. 1
views_handler::sanitize_value public function Sanitize the value for output.
views_handler::set_relationship public function Called just prior to query(), this lets a handler set up any relationship it needs.
views_handler::show_expose_form public function Shortcut to display the exposed options form.
views_handler::ui_name public function Return a string representing this handler's name in the UI. 9
views_handler::use_group_by public function Provides the handler some groupby. 2
views_handler::validate public function Validates the handler against the complete View. 1
views_handler_filter::$always_multiple public property Disable the possibility to force a single value. 6
views_handler_filter::$always_required public property Disable the possibility to allow a exposed input to be optional.
views_handler_filter::$group_info public property Contains the information of the selected item in a gruped filter.
views_handler_filter::$no_operator public property Disable the possibility to use operators. 2
views_handler_filter::$operator public property Contains the operator which is used on the query.
views_handler_filter::$value public property Contains the actual value of the field.
views_handler_filter::build_group_form public function Build the form to let users create the group of exposed filters.
views_handler_filter::build_group_options public function Provide default options for exposed filters.
views_handler_filter::build_group_submit public function Save new group items, re-enumerates and remove groups marked to delete.
views_handler_filter::build_group_validate public function Validate the build group options form. 1
views_handler_filter::can_build_group public function Determine if a filter can be converted into a group.
views_handler_filter::can_expose public function Determine if a filter can be exposed. Overrides views_handler::can_expose 5
views_handler_filter::can_group public function Can this filter be used in OR groups? 1
views_handler_filter::convert_exposed_input public function Transform the input from a grouped filter into a standard filter.
views_handler_filter::exposed_form public function Render our chunk of the exposed filter form when selecting. Overrides views_handler::exposed_form
views_handler_filter::exposed_info public function Tell the renderer about our exposed form. Overrides views_handler::exposed_info
views_handler_filter::exposed_translate public function Make some translations to a form item to make it more suitable to exposing.
views_handler_filter::expose_form public function Options form subform for exposed filter options. Overrides views_handler::expose_form 2
views_handler_filter::expose_options public function Provide default options for exposed filters. Overrides views_handler::expose_options 2
views_handler_filter::expose_validate public function Validate the options form. Overrides views_handler::expose_validate
views_handler_filter::group_form public function Build a form with a group of operator | values to apply as a single filter.
views_handler_filter::group_multiple_exposed_input public function Options available for a grouped filter which uses checkboxes.
views_handler_filter::init public function Provide some extra help to get the operator/value easier to use. Overrides views_handler::init 2
views_handler_filter::is_a_group public function Returns TRUE if the exposed filter works like a grouped filter. Overrides views_handler::is_a_group
views_handler_filter::multiple_exposed_input public function Indicate whether users can select multiple group items. Overrides views_handler::multiple_exposed_input
views_handler_filter::operator_form public function Options form subform for setting the operator. 6
views_handler_filter::operator_submit public function Perform any necessary changes to the form values prior to storage.
views_handler_filter::operator_validate public function Validate the operator form.
views_handler_filter::options_form public function Provide the basic form which calls through to subforms. Overrides views_handler::options_form 4
views_handler_filter::options_submit public function Simple submit handler. Overrides views_handler::options_submit
views_handler_filter::options_validate public function Simple validate handler. Overrides views_handler::options_validate 1
views_handler_filter::prepare_filter_select_options public function Sanitizes the HTML select element's options.
views_handler_filter::show_build_group_button public function Shortcut to display the build_group/hide button.
views_handler_filter::show_build_group_form public function Shortcut to display the exposed options form.
views_handler_filter::show_expose_button public function Shortcut to display the expose/hide button. Overrides views_handler::show_expose_button
views_handler_filter::show_operator_form public function Shortcut to display the operator form.
views_handler_filter::show_value_form public function Shortcut to display the value form.
views_handler_filter::store_exposed_input public function Store the exposed input for processing later. Overrides views_handler::store_exposed_input
views_handler_filter::store_group_input public function If set to remember exposed input in the session, store it there.
views_handler_filter::value_submit public function Perform any necessary changes to the form values prior to storage. 1
views_handler_filter::value_validate public function Validate the options form. 3
views_object::$definition public property Handler's definition.
views_object::$options public property Except for displays, options for the object will be held here. 1
views_object::altered_option_definition function Collect this handler's option definition and alter them, ready for use.
views_object::construct public function Views handlers use a special construct function. 4
views_object::destroy public function Destructor. 2
views_object::export_option public function 1
views_object::export_options public function
views_object::export_option_always public function Always exports the option, regardless of the default value.
views_object::options Deprecated public function Set default options on this object. 1
views_object::set_default_options public function Set default options.
views_object::set_definition public function Let the handler know what its full definition is.
views_object::unpack_options public function Unpack options over our existing defaults, drilling down into arrays so that defaults don't get totally blown away.
views_object::unpack_translatable public function Unpack a single option definition.
views_object::unpack_translatables public function Unpacks each handler to store translatable texts.
views_object::_set_option_defaults public function