You are here

public function SearchApiViewsHandlerFieldLocation::query in Search API Location 7.2

Overridden to add the field for the entity ID (if necessary).

Overrides entity_views_handler_field_text::query

File

search_api_location_views/handler_field_location.inc, line 107
Contains SearchApiViewsHandlerFieldLocation.

Class

SearchApiViewsHandlerFieldLocation
Specialized handler for latitude/longitude fields.

Code

public function query() {

  // If the distance has to be displayed add the flag to the spatial settings
  // of this field.
  if (!empty($this->options['show_distance_to_point'])) {
    $spatials = (array) $this->query
      ->getOption('search_api_location', array());
    foreach ($spatials as $i => $spatial) {
      if ($spatial['field'] === $this->real_field) {
        $spatials[$i]['distance'] = TRUE;
      }
    }
    $this->query
      ->setOption('search_api_location', $spatials);
  }
}