You are here

function clientside_validation_should_validate in Clientside Validation 7.2

Same name and namespace in other branches
  1. 8.2 clientside_validation.module \clientside_validation_should_validate()
  2. 8 clientside_validation.module \clientside_validation_should_validate()
  3. 3.0.x clientside_validation.module \clientside_validation_should_validate()
  4. 2.0.x clientside_validation.module \clientside_validation_should_validate()
1 call to clientside_validation_should_validate()
clientside_validation_add_validation in ./clientside_validation.module

File

./clientside_validation.module, line 412
Add client side validation to forms.

Code

function clientside_validation_should_validate($element) {
  $instance_info = array();
  if (isset($element['#instance'])) {
    $instance_info = $element['#instance'];
  }
  elseif (isset($element['#entity_type']) && isset($element['#field_name']) && isset($element['#bundle'])) {
    $instance_info = field_info_instance($element['#entity_type'], $element['#field_name'], $element['#bundle']);
  }
  if (isset($instance_info['exclude_cv']) && $instance_info['exclude_cv'] == '1') {
    return FALSE;
  }
  elseif (isset($element['#exclude_cv']) && $element['#exclude_cv']) {

    //skip validation if defined so by form element
    return FALSE;
  }
  return TRUE;
}