You are here

public function AppAnalyticsSettingsForm::validateForm in Apigee Edge 8

Form validation handler.

Parameters

array $form: An associative array containing the structure of the form.

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

Overrides FormBase::validateForm

File

src/Form/AppAnalyticsSettingsForm.php, line 119

Class

AppAnalyticsSettingsForm
Provides a form for app analytics related configuration.

Namespace

Drupal\apigee_edge\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  parent::validateForm($form, $form_state);
  if (!in_array($form_state
    ->getValue('environment'), array_values(array_filter($form_state
    ->getValue('available_environments'))))) {
    $form_state
      ->setError($form['label']['environment'], $this
      ->t('The selected default environment is not available on the form.'));
  }
}