You are here

public function SettingsForm::validateForm in Nagios Monitoring 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 285

Class

SettingsForm
Allows admins to configure the Nagios module.

Namespace

Drupal\nagios\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  $default_ua = $form_state
    ->getValue('nagios_ua') == 'Nagios';
  if ($default_ua && $form_state
    ->getValue('nagios_enable_status_page')) {
    $form_state
      ->setErrorByName('nagios_ua', $this
      ->t('You must change the Unique ID if you make the status page available over HTTP.') . ' ' . $this
      ->t('This step reduces the risk of publicly sharing information that might make hacking your site easier.'));
  }
}