function regex_field_validation_form_alter in RegEx Field Validation 7
Implements hook_form_alter().
File
- ./
regex_field_validation.module, line 94 - RegEx Field Validation module file.
Code
function regex_field_validation_form_alter(&$form, &$form_state, $form_id) {
if (isset($form['#node_edit_form'])) {
if ($form['#node_edit_form'] == TRUE) {
foreach ($form_state['field'] as $field) {
if (isset($field['und']['instance']['settings']['regex_field_validation_widget']['enable'])) {
if ($field['und']['instance']['settings']['regex_field_validation_widget']['enable'] == 1) {
$form[$field['und']['field']['field_name']]['#element_validate'] = array(
'_regex_field_validation_regex_validate',
);
}
}
}
}
}
}