public static function WebformElementHelper::suppressElementValidate in Webform 8.5
Same name and namespace in other branches
- 6.x src/Utility/WebformElementHelper.php \Drupal\webform\Utility\WebformElementHelper::suppressElementValidate()
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::suppressElementValidate()
- WebformSubmissionConditionsValidator::elementValidate in src/
WebformSubmissionConditionsValidator.php - Webform conditional #element_validate callback: Execute #element_validate and suppress errors.
File
- src/
Utility/ WebformElementHelper.php, line 736
Class
- WebformElementHelper
- Helper class webform element methods.
Namespace
Drupal\webform\UtilityCode
public static function suppressElementValidate(array &$element, FormStateInterface $form_state) {
// Create a temp webform state that will capture and suppress all element
// validation errors.
$temp_form_state = clone $form_state;
$temp_form_state
->setLimitValidationErrors([]);
// @see \Drupal\Core\Form\FormValidator::doValidateForm
foreach ($element['#_element_validate'] as $callback) {
$complete_form =& $form_state
->getCompleteForm();
$arguments = [
&$element,
&$temp_form_state,
&$complete_form,
];
call_user_func_array($form_state
->prepareCallback($callback), $arguments);
}
// Get the temp webform state's values.
$form_state
->setValues($temp_form_state
->getValues());
}