You are here

function fapi_validation_element_info_alter in Form API Validation 8

Same name and namespace in other branches
  1. 8.2 fapi_validation.module \fapi_validation_element_info_alter()
  2. 7.2 fapi_validation.module \fapi_validation_element_info_alter()
  3. 7 fapi_validation.module \fapi_validation_element_info_alter()

Implements hook_element_info_alter().

PURPOSE: Add fapi validation element processing to all form elements.

File

./fapi_validation.module, line 17
Form API validation module

Code

function fapi_validation_element_info_alter(array &$info) {

  // Loop through all form element types and only hit input variants.
  foreach ($info as $type_name => $type_info) {
    if (!empty($type_info['#input'])) {

      // Processes the form element on form creation.
      $info[$type_name]['#process'][] = 'fapi_validation_element_process';
    }
  }
}