You are here

function clientside_validation_form_after_build_recurse in Clientside Validation 2.0.x

Same name and namespace in other branches
  1. 8.2 clientside_validation.module \clientside_validation_form_after_build_recurse()
  2. 8 clientside_validation.module \clientside_validation_form_after_build_recurse()
  3. 6 clientside_validation_form/clientside_validation_form.module \clientside_validation_form_after_build_recurse()
  4. 7.2 clientside_validation.module \clientside_validation_form_after_build_recurse()
  5. 7 clientside_validation_form/clientside_validation_form.module \clientside_validation_form_after_build_recurse()
  6. 3.0.x clientside_validation.module \clientside_validation_form_after_build_recurse()

Recursive function to add clientside validation to a from.

1 call to clientside_validation_form_after_build_recurse()
clientside_validation_form_after_build in ./clientside_validation.module
Form after build callback.

File

./clientside_validation.module, line 31
Hook implementations for the Clientside Validation module.

Code

function clientside_validation_form_after_build_recurse($form_id, &$form, &$form_state) {
  if ($children = Element::children($form)) {
    foreach ($children as $item) {
      $element =& $form[$item];
      clientside_validation_add_validation($element, $form_state, $form_id);
      if (isset($element['#type']) && $element['#type'] == 'submit' && isset($element['#limit_validation_errors']) && empty($element['#limit_validation_errors']) && $element['#limit_validation_errors'] !== FALSE) {
        $element['#attributes']['class'][] = 'cancel';
      }
      clientside_validation_form_after_build_recurse($form_id, $element, $form_state);
    }
  }
}