You are here

public function ConditionFormBase::validateForm in Block Visibility Groups 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/ConditionFormBase.php, line 120

Class

ConditionFormBase
Provides a base form for editing and adding a condition.

Namespace

Drupal\block_visibility_groups\Form

Code

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

  // Allow the condition to validate the form.
  $condition_values = (new FormState())
    ->setValues($form_state
    ->getValue('condition'));
  $this->condition
    ->validateConfigurationForm($form, $condition_values);

  // Update the original form values.
  $form_state
    ->setValue('condition', $condition_values
    ->getValues());
}