public function ProximityArgument::query in Geolocation Field 8.2
Same name and namespace in other branches
- 8.3 src/Plugin/views/argument/ProximityArgument.php \Drupal\geolocation\Plugin\views\argument\ProximityArgument::query()
- 8 src/Plugin/views/argument/ProximityArgument.php \Drupal\geolocation\Plugin\views\argument\ProximityArgument::query()
Build the query based upon the formula
Overrides Formula::query
File
- src/
Plugin/ views/ argument/ ProximityArgument.php, line 66
Class
- ProximityArgument
- Argument handler for geolocation proximity.
Namespace
Drupal\geolocation\Plugin\views\argumentCode
public function query($group_by = FALSE) {
$this
->ensureMyTable();
// Now that our table is secure, get our formula.
$placeholder = $this
->placeholder();
$formula = $this
->getFormula();
if (!$formula) {
return;
}
$formula .= ' ' . $this->operator . ' ' . $placeholder;
$placeholders = [
$placeholder => $this->distance,
];
// The addWhere function is only available for SQL queries.
if ($this->query instanceof Sql) {
$this->query
->addWhere(0, $formula, $placeholders, 'formula');
}
}