You are here

public function SearchApiLocationPoint::validateOptionsForm in Search API Location 8

Validate the options form.

Overrides ArgumentPluginBase::validateOptionsForm

File

modules/search_api_location_views/src/Plugin/views/argument/SearchApiLocationPoint.php, line 59

Class

SearchApiLocationPoint
Provides a contextual filter for defining a location filter point.

Namespace

Drupal\search_api_location_views\Plugin\views\argument

Code

public function validateOptionsForm(&$form, FormStateInterface $form_state) {
  $radius = $form_state
    ->getValue('options')['radius'];
  if (!is_numeric($radius) || $radius <= 0) {
    $form_state
      ->setError($form['radius'], $this
      ->t('You have to enter a numeric radius greater than 0.'));
  }
  parent::validateOptionsForm($form, $form_state);
}