public function BoundaryFilter::acceptExposedInput in Geolocation Field 8.2
Same name and namespace in other branches
- 8.3 src/Plugin/views/filter/BoundaryFilter.php \Drupal\geolocation\Plugin\views\filter\BoundaryFilter::acceptExposedInput()
- 8 src/Plugin/views/filter/BoundaryFilter.php \Drupal\geolocation\Plugin\views\filter\BoundaryFilter::acceptExposedInput()
Determines if the input from a filter should change the generated query.
Parameters
array $input: The exposed data for this view.
Return value
bool TRUE if the input for this filter should be included in the view query. FALSE otherwise.
Overrides FilterPluginBase::acceptExposedInput
File
- src/
Plugin/ views/ filter/ BoundaryFilter.php, line 243
Class
- BoundaryFilter
- Filter handler for search keywords.
Namespace
Drupal\geolocation\Plugin\views\filterCode
public function acceptExposedInput($input) {
if (!empty($this->value['lat_north_east']) && !empty($this->value['lng_north_east']) && !empty($this->value['lat_south_west']) && !empty($this->value['lng_south_west'])) {
return TRUE;
}
$return_value = parent::acceptExposedInput($input);
if ($this->options['expose']['input_by_geocoding_widget'] && !empty($this->options['expose']['geocoder_plugin_settings']['plugin_id'])) {
$this->value = $input[$this->options['expose']['identifier']];
$geocoder_configuration = $this->options['expose']['geocoder_plugin_settings']['settings'];
/** @var \Drupal\geolocation\GeocoderInterface $geocoder_plugin */
$geocoder_plugin = $this->geocoderManager
->getGeocoder($this->options['expose']['geocoder_plugin_settings']['plugin_id'], $geocoder_configuration);
if (!empty($geocoder_plugin)) {
$location_data = $geocoder_plugin
->geocode($input[$this->options['expose']['identifier']]['geolocation_geocoder_address']);
// Location geocoded server-side. Add to input for later processing.
if (!empty($location_data['boundary'])) {
$this->value = array_replace($input[$this->options['expose']['identifier']], $location_data['boundary']);
}
}
}
if (empty($this->value)) {
$this->value = [];
}
return $return_value;
}