You are here

protected function ProximityFilter::opBetween in Geolocation Field 8

Same name and namespace in other branches
  1. 8.3 src/Plugin/views/filter/ProximityFilter.php \Drupal\geolocation\Plugin\views\filter\ProximityFilter::opBetween()
  2. 8.2 src/Plugin/views/filter/ProximityFilter.php \Drupal\geolocation\Plugin\views\filter\ProximityFilter::opBetween()

Filters by operator between.

Parameters

object $field: The views field.

Overrides NumericFilter::opBetween

File

src/Plugin/views/filter/ProximityFilter.php, line 593

Class

ProximityFilter
Filter handler for search keywords.

Namespace

Drupal\geolocation\Plugin\views\filter

Code

protected function opBetween($expression) {

  /** @var \Drupal\views\Plugin\views\query\Sql $query */
  $query = $this->query;
  if ($this->operator == 'between') {
    $query
      ->addWhereExpression($this->options['group'], $expression . ' BETWEEN ' . $this->value['min'] . ' AND ' . $this->value['max']);
  }
  else {
    $query
      ->addWhereExpression($this->options['group'], $expression . ' NOT BETWEEN ' . $this->value['min'] . ' AND ' . $this->value['max']);
  }
}