You are here

public function NodeTabForm::validateForm in Simplenews 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/NodeTabForm.php, line 221

Class

NodeTabForm
Configure simplenews subscriptions of a user.

Namespace

Drupal\simplenews\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  $values = $form_state
    ->getValues();

  // Validate recipient handler settings.
  if (!empty($form['recipient_handler_settings'])) {
    $handler = $values['recipient_handler'];
    $handler_definitions = $this->recipientHandlerManager
      ->getDefinitions();

    // Get the handler class.
    $handler = $handler_definitions[$handler];
    $class = $handler['class'];
    if (method_exists($class, 'settingsFormValidate')) {
      $class::settingsFormValidate($form['recipient_handler_settings'], $form_state);
    }
  }
  parent::validateForm($form, $form_state);
}