You are here

private static function WebformValidateConstraint::validateElements in Webform Validation 8

Same name and namespace in other branches
  1. 2.0.x src/Validate/WebformValidateConstraint.php \Drupal\webform_validation\Validate\WebformValidateConstraint::validateElements()

Validates element.

Parameters

array $elements: The form elements.

array $form: The form array.

\Drupal\Core\Form\FormStateInterface $formState: The form state.

1 call to WebformValidateConstraint::validateElements()
WebformValidateConstraint::validate in src/Validate/WebformValidateConstraint.php
Validates form.

File

src/Validate/WebformValidateConstraint.php, line 70

Class

WebformValidateConstraint
Form API callback. Validate element value.

Namespace

Drupal\webform_validation\Validate

Code

private static function validateElements(array $elements, array &$form, FormStateInterface $formState) : void {
  foreach ($elements as $keyElement => &$keyValue) {
    if (!WebformElementHelper::isElement($keyValue, $keyElement)) {
      continue;
    }
    if (!empty($keyValue['#equal'])) {
      self::validateFrontEqualComponent($keyValue, $formState, $form);
    }
    if (!empty($keyValue['#compare'])) {
      self::validateFrontCompareComponent($keyValue, $formState, $form);
    }
    if (!empty($keyValue['#some_of_several'])) {
      self::validateFrontSomeSeveralComponent($keyValue, $formState, $form);
    }
    self::validateElements($keyValue, $form, $formState);
  }
}