function clientside_validation_add_validation in Clientside Validation 3.0.x
Same name and namespace in other branches
- 8.2 clientside_validation.module \clientside_validation_add_validation()
- 8 clientside_validation.module \clientside_validation_add_validation()
- 7.2 clientside_validation.module \clientside_validation_add_validation()
- 2.0.x clientside_validation.module \clientside_validation_add_validation()
Add clientside validation to a form element.
2 calls to clientside_validation_add_validation()
- clientside_validation_form_after_build in ./
clientside_validation.module - Form after build callback.
- clientside_validation_form_after_build_recurse in ./
clientside_validation.module - Recursive function to add clientside validation to a from.
File
- ./
clientside_validation.module, line 53 - Hook implementations for the Clientside Validation module.
Code
function clientside_validation_add_validation(&$element, FormStateInterface &$form_state, $form_id) {
if (clientside_validation_should_validate($element, $form_state, $form_id)) {
$validators = \Drupal::service('plugin.manager.clientside_validation.validators')
->getValidators($element, $form_state);
foreach ($validators as $validator) {
$validator
->addValidation($element, $form_state);
}
}
}