public function ProximityArgument::getFormula in Geolocation Field 8.3
Same name and namespace in other branches
- 8 src/Plugin/views/argument/ProximityArgument.php \Drupal\geolocation\Plugin\views\argument\ProximityArgument::getFormula()
- 8.2 src/Plugin/views/argument/ProximityArgument.php \Drupal\geolocation\Plugin\views\argument\ProximityArgument::getFormula()
Get the formula for this argument.
Overrides Formula::getFormula
1 call to ProximityArgument::getFormula()
- ProximityArgument::query in src/
Plugin/ views/ argument/ ProximityArgument.php - Build the query based upon the formula
1 method overrides ProximityArgument::getFormula()
- GeoProximityArgument::getFormula in modules/
geolocation_geometry/ src/ Plugin/ views/ argument/ GeoProximityArgument.php - Get the formula for this argument.
File
- src/
Plugin/ views/ argument/ ProximityArgument.php, line 49
Class
- ProximityArgument
- Argument handler for geolocation proximity.
Namespace
Drupal\geolocation\Plugin\views\argumentCode
public function getFormula() {
// Parse argument for reference location.
$values = $this
->getParsedReferenceLocation();
// Make sure we have enough information to start with.
if (!empty($values) && isset($values['lat']) && isset($values['lng']) && isset($values['distance'])) {
$distance = self::convertDistance((double) $values['distance'], $values['unit']);
// Build a formula for the where clause.
$formula = self::getProximityQueryFragment($this->tableAlias, $this->realField, $values['lat'], $values['lng']);
// Set the operator and value for the query.
$this->operator = $values['operator'];
$this->distance = $distance;
return !empty($formula) ? str_replace('***table***', $this->tableAlias, $formula) : FALSE;
}
else {
return FALSE;
}
}