function location_handler_field_location_distance::query in Location 7.4
Same name and namespace in other branches
- 6.3 handlers/location_handler_field_location_distance.inc \location_handler_field_location_distance::query()
- 7.5 handlers/location_handler_field_location_distance.inc \location_handler_field_location_distance::query()
- 7.3 handlers/location_handler_field_location_distance.inc \location_handler_field_location_distance::query()
Called to add the field to a query.
Overrides views_handler_field::query
File
- handlers/
location_handler_field_location_distance.inc, line 154 - Coordinates field handler.
Class
- location_handler_field_location_distance
- @file Coordinates field handler.
Code
function query() {
$this
->ensure_my_table();
$coordinates = location_views_proximity_get_reference_location($this->view, $this->options);
if (!empty($coordinates)) {
$this->field_alias = $this->query
->add_field(NULL, earth_distance_sql($coordinates['longitude'], $coordinates['latitude'], $this->table_alias), $this->table_alias . '_' . $this->field);
}
else {
$this->field_alias = $this->query
->add_field(NULL, "'Unknown'", $this->table_alias . '_' . $this->field);
}
}