You are here

public function ProximityFilter::acceptExposedInput in Geolocation Field 8.3

Same name and namespace in other branches
  1. 8 src/Plugin/views/filter/ProximityFilter.php \Drupal\geolocation\Plugin\views\filter\ProximityFilter::acceptExposedInput()
  2. 8.2 src/Plugin/views/filter/ProximityFilter.php \Drupal\geolocation\Plugin\views\filter\ProximityFilter::acceptExposedInput()

Do some minor translation of the exposed input

Overrides NumericFilter::acceptExposedInput

File

src/Plugin/views/filter/ProximityFilter.php, line 159

Class

ProximityFilter
Filter handler for search keywords.

Namespace

Drupal\geolocation\Plugin\views\filter

Code

public function acceptExposedInput($input) {
  parent::acceptExposedInput($input);
  if (array_key_exists('lat', $input) && $input['lat'] !== '' && array_key_exists('lng', $input) && $input['lng'] !== '') {
    $this->value['lat'] = (double) $input['lat'];
    $this->value['lng'] = (double) $input['lng'];
  }
  if (!empty($input['center'])) {
    $this->value['center'] = $input['center'];
  }
  else {
    $this->value['center'] = [];
  }
  return TRUE;
}