You are here

public function TemplateForm::validateForm in Workbench Email 8

Same name and namespace in other branches
  1. 2.x src/Form/TemplateForm.php \Drupal\workbench_email\Form\TemplateForm::validateForm()

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/TemplateForm.php, line 252

Class

TemplateForm
Class TemplateForm.

Namespace

Drupal\workbench_email\Form

Code

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

  /** @var \Drupal\workbench_email\TemplateInterface $workbench_email_template */
  $workbench_email_template = $this->entity;
  $recipient_types = $workbench_email_template
    ->recipientTypes();

  /** @var \Drupal\workbench_email\Plugin\RecipientTypeInterface $plugin */
  foreach ($recipient_types as $plugin_id => $plugin) {
    if ($plugin
      ->hasFormClass('configure')) {
      $subform_state = SubformState::createForSubform($form['recipient_types']['settings'][$plugin_id], $form, $form_state);
      $plugin
        ->validateConfigurationForm($form['recipient_types']['settings'][$plugin_id], $subform_state);
    }
  }
  parent::validateForm($form, $form_state);
}