function _regex_field_validation_get_instance_defaults in RegEx Field Validation 7
Returns default values for the configuration form.
1 call to _regex_field_validation_get_instance_defaults()
- regex_field_validation_form_field_ui_field_edit_form_alter in ./
regex_field_validation.module - Implements hook_form_field_ui_field_edit_form_alter().
File
- ./
regex_field_validation.module, line 58 - RegEx Field Validation module file.
Code
function _regex_field_validation_get_instance_defaults($field_instance) {
$settings = array(
'enable' => FALSE,
'regex' => NULL,
'error_message' => NULL,
);
if ($field_instance != NULL) {
if (isset($field_instance['regex_field_validation_widget'])) {
if (isset($field_instance['regex_field_validation_widget']['enable'])) {
if ($field_instance['regex_field_validation_widget']['enable'] == 1) {
$settings['enable'] = TRUE;
}
else {
$settings['enable'] = FALSE;
}
}
if (isset($field_instance['regex_field_validation_widget']['regex'])) {
$settings['regex'] = $field_instance['regex_field_validation_widget']['regex'];
}
if (isset($field_instance['regex_field_validation_widget']['error_message'])) {
$settings['error_message'] = $field_instance['regex_field_validation_widget']['error_message'];
}
}
else {
return $settings;
}
return $settings;
}
else {
return $settings;
}
}