You are here

fapi_validation.module in Form API Validation 8.2

Form API validation module.

File

fapi_validation.module
View source
<?php

/**
 * @file
 * Form API validation module.
 */

/**
 * Implements hook_element_info_alter().
 *
 * PURPOSE: Add fapi validation element processing to all form elements.
 */
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';
    }
  }
}