You are here

public function ProximityFilter::validateExposed in Geolocation Field 8

Validate the exposed handler form

Overrides HandlerBase::validateExposed

File

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

Class

ProximityFilter
Filter handler for search keywords.

Namespace

Drupal\geolocation\Plugin\views\filter

Code

public function validateExposed(&$form, FormStateInterface $form_state) {
  parent::validateExposed($form, $form_state);
  if ($this->options['proximity_source'] == 'exposed') {
    if ($this->options['expose']['input_by_geocoding_widget'] && !empty($this->options['expose']['geocoder_plugin_settings']['plugin_id'])) {
      $geocoder_configuration = $this->options['expose']['geocoder_plugin_settings']['settings'];

      /** @var \Drupal\geolocation\GeocoderInterface $geocoder_plugin */
      $geocoder_plugin = $this->geolocationCore
        ->getGeocoderManager()
        ->getGeocoder($this->options['expose']['geocoder_plugin_settings']['plugin_id'], $geocoder_configuration);
      if (!empty($geocoder_plugin)) {
        $geocoder_plugin
          ->formvalidateInput($form_state);
      }
    }
  }
}