You are here

public function WebformVariantFormBase::validateForm in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Form/WebformVariantFormBase.php \Drupal\webform\Form\WebformVariantFormBase::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/WebformVariantFormBase.php, line 261

Class

WebformVariantFormBase
Provides a base webform for webform variants.

Namespace

Drupal\webform\Form

Code

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

  // The webform variant configuration is stored in the 'settings' key in
  // the webform, pass that through for validation.
  $subform_state = SubformState::createForSubform($form['settings'], $form, $form_state);
  $this->webformVariant
    ->validateConfigurationForm($form, $subform_state);

  // Process variant state webform errors.
  $this
    ->processVariantFormErrors($subform_state, $form_state);

  // Update the original webform values.
  $form_state
    ->setValue('settings', $subform_state
    ->getValues());
}