You are here

private static function WebformValidateConstraint::formElementUnset in Webform Validation 8

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

Removing the values in visited array while going back to previous page.

Parameters

array $elements: The form elements.

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

array $visitedElements: Group of visited elements.

1 call to WebformValidateConstraint::formElementUnset()
WebformValidateConstraint::formSubmitPervious in src/Validate/WebformValidateConstraint.php
Go previous page.

File

src/Validate/WebformValidateConstraint.php, line 453

Class

WebformValidateConstraint
Form API callback. Validate element value.

Namespace

Drupal\webform_validation\Validate

Code

private static function formElementUnset(array &$elements, FormStateInterface $formState, array &$visitedElements) : void {
  foreach ($elements as $key => &$value) {
    if (!WebformElementHelper::isElement($value, $key)) {
      continue;
    }
    if (!empty($value['#access'])) {
      if (($searchKey = array_search($key, $visitedElements)) !== FALSE) {
        array_splice($visitedElements, $searchKey, 1);
      }
    }
    self::formElementUnset($value, $formState, $visitedElements);
  }
}