You are here

public function SearchApiLocationPoint::query in Search API Location 8

Set up the query for this argument.

The argument sent may be found at $this->argument.

Overrides ArgumentPluginBase::query

File

modules/search_api_location_views/src/Plugin/views/argument/SearchApiLocationPoint.php, line 70

Class

SearchApiLocationPoint
Provides a contextual filter for defining a location filter point.

Namespace

Drupal\search_api_location_views\Plugin\views\argument

Code

public function query($group_by = FALSE) {
  if ($geofilt = $this
    ->parsePoint($this->argument)) {

    // Add radius from options, if appropriate.
    if ($this->options['default_radius']) {
      $geofilt['radius'] = $this->options['radius'];
    }
    $query = $this
      ->getQuery();
    $location_options = (array) $query
      ->getOption('search_api_location');
    $this
      ->addFieldOptions($location_options, $geofilt, $this->realField);
    $query
      ->setOption('search_api_location', $location_options);
  }
}