You are here

public function OriginFromProximityFilter::validateOptionsForm in Geofield 8

Validates the options form for the geofield proximity plugin.

Parameters

array $form: The form element to build.

\Drupal\Core\Form\FormStateInterface $form_state: The form state.

array $options_parents: The values parents.

Overrides GeofieldProximitySourceBase::validateOptionsForm

File

src/Plugin/GeofieldProximitySource/OriginFromProximityFilter.php, line 125

Class

OriginFromProximityFilter
Defines 'Geofield Custom Origin' plugin.

Namespace

Drupal\geofield\Plugin\GeofieldProximitySource

Code

public function validateOptionsForm(array &$form, FormStateInterface $form_state, array $options_parents) {
  $values = $form_state
    ->getValues();
  if (!isset($values['options']['source_configuration']['source_proximity_filter'])) {
    $form_state
      ->setError($form['source_proximity_filter_warning'], $this
      ->t('This Proximity Field cannot work. Dismiss this and add and setup a Proximity Filter before.'));
  }
}