function ife_form_validator in Inline Form Errors 7.2
Same name and namespace in other branches
- 6.2 ife.module \ife_form_validator()
- 6 ife.module \ife_form_validator()
- 7 ife.module \ife_form_validator()
Custom form validation handler.
1 string reference to 'ife_form_validator'
- ife_form_alter in ./
ife.module - Implements hook_form_alter().
File
- ./
ife.module, line 227 - Drupal hooks.
Code
function ife_form_validator(&$form, &$form_state) {
static $global_error_processed = FALSE;
// Commerce checkout.
if (strpos($form['#form_id'], 'commerce_checkout_form') !== FALSE && isset($form_state['storage']['errors'])) {
foreach ($form_state['storage']['errors'] as $name => $message) {
form_set_error($name, $message);
}
unset($form_state['storage']['messages']);
}
$form_errors = form_get_errors();
if (!empty($form_errors)) {
ife_element_errors_set($form, $form['#ife_display']);
if ($form['#ife_display'] == IFE_MESSAGE_ALTERNATE && !$global_error_processed) {
$message = filter_xss_admin(variable_get('ife_general_message', 'Please correct all highlighted errors and try again.'));
drupal_set_message($message, 'error');
$global_error_processed = TRUE;
}
}
// This function returns TRUE, because is does not really validate anything
// and to support commerce modules this function needs to have a return value.
return TRUE;
}