You are here

function fapi_validation_element_info_alter in Form API Validation 8.2

Same name and namespace in other branches
  1. 8 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 13
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 (isset($type_info['#input']) && $type_info['#input']) {

      // Processes the form element on form creation.
      $info[$type_name]['#process'][] = '\\Drupal\\fapi_validation\\FapiValidationService::process';
    }
  }
}