You are here

public static function WebformElementHelper::triggerElementValidate in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/Utility/WebformElementHelper.php \Drupal\webform\Utility\WebformElementHelper::triggerElementValidate()

Webform element #element_validate callback: Execute #element_validate and suppress errors.

Parameters

array $element: An element.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

1 call to WebformElementHelper::triggerElementValidate()
WebformSubmissionConditionsValidator::elementValidate in src/WebformSubmissionConditionsValidator.php
Webform conditional #element_validate callback: Execute #element_validate and suppress errors.

File

src/Utility/WebformElementHelper.php, line 719

Class

WebformElementHelper
Helper class webform element methods.

Namespace

Drupal\webform\Utility

Code

public static function triggerElementValidate(array &$element, FormStateInterface $form_state) {

  // @see \Drupal\Core\Form\FormValidator::doValidateForm
  foreach ($element['#_element_validate'] as $callback) {
    $complete_form =& $form_state
      ->getCompleteForm();
    $arguments = [
      &$element,
      &$form_state,
      &$complete_form,
    ];
    call_user_func_array($form_state
      ->prepareCallback($callback), $arguments);
  }
}