You are here

public function SettingsForm::validateForm in Security Review 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/SettingsForm.php, line 209

Class

SettingsForm
Settings page for Security Review.

Namespace

Drupal\security_review\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {

  // Run validation for check-specific settings.
  if (isset($form['advanced']['check_specific'])) {
    $check_specific_values = $form_state
      ->getValue('check_specific');
    foreach ($this->checklist
      ->getChecks() as $check) {
      $check_form =& $form['advanced']['check_specific'][$check
        ->id()];
      if (isset($check_form)) {
        $check
          ->settings()
          ->validateForm($check_form, $check_specific_values[$check
          ->id()]);
      }
    }
  }
}