You are here

function fapi_validation_element_process in Form API Validation 7

Same name and namespace in other branches
  1. 8 fapi_validation.module \fapi_validation_element_process()
  2. 7.2 fapi_validation.module \fapi_validation_element_process()

Process element rules and filters.

1 string reference to 'fapi_validation_element_process'
fapi_validation_element_info_alter in ./fapi_validation.module
Implements hook_element_info_alter().

File

./fapi_validation.module, line 17

Code

function fapi_validation_element_process($element, &$form_state) {
  if (!empty($element['#filters'])) {
    $element_validate = empty($element['#element_validate']) ? array() : $element['#element_validate'];
    $element['#element_validate'] = array_merge(array(
      'fapi_validate_element_filter',
    ), $element_validate);
  }
  if (!empty($element['#rules'])) {
    $element['#element_validate'][] = 'fapi_validate_element_validate';
  }
  return $element;
}