public function GeofieldRectBoundaryFilter::query in Geofield 8
Add this filter to the query.
Due to the nature of fapi, the value and the operator have an unintended level of indirection. You will find them in $this->operator and $this->value respectively.
Overrides FilterPluginBase::query
File
- src/
Plugin/ views/ filter/ GeofieldRectBoundaryFilter.php, line 111
Class
- GeofieldRectBoundaryFilter
- Filter handler for search keywords.
Namespace
Drupal\geofield\Plugin\views\filterCode
public function query() {
if (!$this->query instanceof Sql) {
return;
}
if (empty($this->value)) {
return;
}
// Get the field alias.
$lat_north_east = $this->value['group']['lat_north_east'];
$lng_north_east = $this->value['group']['lng_north_east'];
$lat_south_west = $this->value['group']['lat_south_west'];
$lng_south_west = $this->value['group']['lng_south_west'];
if (!is_numeric($lat_north_east) || !is_numeric($lng_north_east) || !is_numeric($lat_south_west) || !is_numeric($lng_south_west)) {
return;
}
$this->query
->addWhereExpression($this->options['group'], self::getBoundaryQueryFragment($this
->ensureMyTable(), $this->realField, $lat_north_east, $lng_north_east, $lat_south_west, $lng_south_west));
}