GeoProximityArgument.php in Geolocation Field 8.3
File
modules/geolocation_geometry/src/Plugin/views/argument/GeoProximityArgument.php
View source
<?php
namespace Drupal\geolocation_geometry\Plugin\views\argument;
use Drupal\geolocation\Plugin\views\argument\ProximityArgument;
use Drupal\geolocation_geometry\GeometryProximityTrait;
class GeoProximityArgument extends ProximityArgument {
use GeometryProximityTrait;
public function getFormula() {
$values = $this
->getParsedReferenceLocation();
if (!empty($values) && isset($values['lat']) && isset($values['lng']) && isset($values['distance'])) {
$distance = self::convertDistance((double) $values['distance'], $values['unit']);
$formula = self::getGeometryProximityQueryFragment($this->tableAlias, $this->realField, $values['lat'], $values['lng']);
$this->operator = $values['operator'];
$this->distance = $distance;
return !empty($formula) ? str_replace('***table***', $this->tableAlias, $formula) : FALSE;
}
else {
return FALSE;
}
}
}