You are here

public function CommentNotifySettings::validateForm in Comment Notify 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/CommentNotifySettings.php, line 355

Class

CommentNotifySettings
Settings form for the Comment Notify module.

Namespace

Drupal\comment_notify\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  if (!array_filter($form_state
    ->getValue('available_alerts'))) {
    $form_state
      ->setErrorByName('available_alerts', 'You must enable at least one subscription mode.');
  }
}