You are here

function SearchApiViewsHandlerArgumentLocationRadius::query in Search API Location 7.2

Accepts a decimal $this->argument representing the radius in km.

Overrides SearchApiViewsHandlerArgument::query

File

search_api_location_views/handler_argument_location.inc, line 137
Provides the views argument handler for location fields.

Class

SearchApiViewsHandlerArgumentLocationRadius
Handler class for a Views location argument radius.

Code

function query($group_by = FALSE) {

  // must be single; must be a decimal
  if (is_numeric($this->argument) && $this->argument > 0) {
    $location_options = (array) $this->query
      ->getOption('search_api_location');
    $add_options = array(
      'radius' => $this->argument,
    );
    $this
      ->_add_field_options($location_options, $add_options, $this->real_field);
    $this->query
      ->setOption('search_api_location', $location_options);
  }
}