You are here

protected function GeofieldProximityFilter::opSimple in Geofield 8

Overrides NumericFilter::opSimple

File

src/Plugin/views/filter/GeofieldProximityFilter.php, line 242

Class

GeofieldProximityFilter
Field handler to filter Geofields by proximity.

Namespace

Drupal\geofield\Plugin\views\filter

Code

protected function opSimple($options) {
  if (!empty($this->value['value']) && is_numeric($this->value['value'])) {

    // Be sure to convert $options into array,
    // as this method PhpDoc might expects $options to be an object.
    $options = (array) $options;
    $this->query
      ->addWhereExpression($this->options['group'], geofield_haversine($options) . ' ' . $this->operator . ' ' . $this->value['value']);
  }
}