You are here

public function ConfigForm::validateForm in Akamai 8.3

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/ConfigForm.php, line 350

Class

ConfigForm
A configuration form to interact with Akamai API settings.

Namespace

Drupal\akamai\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  parent::validateForm($form, $form_state);
  $int_fields = [
    'timeout',
  ];
  foreach ($int_fields as $field) {
    if (!ctype_digit($form_state
      ->getValue($field))) {
      $form_state
        ->setErrorByName($field, $this
        ->t('Please enter only integer values in this field.'));
    }
  }

  // Call the form validation handler for each of the versions.
  foreach ($this->availableVersions as $version) {
    $version
      ->validateConfigurationForm($form, $form_state);
  }
}