You are here

protected function GeofieldProximityArgument::operator in Geofield 8

1 call to GeofieldProximityArgument::operator()
GeofieldProximityArgument::query in src/Plugin/views/argument/GeofieldProximityArgument.php
Build the query based upon the formula

File

src/Plugin/views/argument/GeofieldProximityArgument.php, line 192

Class

GeofieldProximityArgument
Argument handler for geofield proximity.

Namespace

Drupal\geofield\Plugin\views\argument

Code

protected function operator($options, $distance, $operator) {
  if (!empty($distance) && is_numeric($distance)) {

    /** @var \Drupal\views\Plugin\views\query\Sql $query */
    $query = $this->query;
    $query
      ->addWhereExpression(0, geofield_haversine($options) . ' ' . $operator . ' ' . $distance);
  }
}