You are here

protected function range_search_api_handler_argument_numeric_range::op_within_query in Range 7

Operation query.

Overrides range_handler_argument_numeric_range::op_within_query

File

views/range_handler_argument_numeric_range.inc, line 111
Contains argument handler for numeric range arguments with views.

Class

range_search_api_handler_argument_numeric_range
Argument handler for limiting a view to indexed content which lies within a range.

Code

protected function op_within_query($operator, $field_from, $field_to, $op_left, $op_right) {
  if ($operator === 'within') {
    $filter = $this->query
      ->createFilter('AND');
    $filter
      ->condition($field_from, $this->argument, $op_left);
    $filter
      ->condition($field_to, $this->argument, $op_right);
  }
  else {
    $filter = $this->query
      ->createFilter('OR');
    $filter
      ->condition($field_from, $this->argument, $op_right);
    $filter
      ->condition($field_to, $this->argument, $op_left);
  }
  $this->query
    ->filter($filter);
}