function values_field_field_settings_form_validate in Values 7
An extra validation form for the field settings form.
Sets the allowed values function to values_field_content_allowed_values if a value set has been specified to be used for allowed values.
1 string reference to 'values_field_field_settings_form_validate'
- values_field_form_alter in modules/
values_field/ values_field.module - Implements hook_form_alter().
File
- modules/
values_field/ values_field.module, line 84 - Use reusable value sets as allowed values for fields.
Code
function values_field_field_settings_form_validate(&$form, &$form_state) {
// Grab the value of the values_field form element
$values_field = $form_state['values']['field']['settings']['values_field'];
if (!empty($values_field)) {
// The "allowed_values_function" setting is built into the list module.
// so all we need to do is supply our own custom function
$form_state['values']['field']['settings']['allowed_values_function'] = 'values_field_content_allowed_values';
}
elseif ($form_state['values']['field']['settings']['allowed_values_function'] == 'values_field_content_allowed_values') {
// If there's no value set chosen, but the allowed values function is still
// set to values_field_content_allowed_values, we need to do a little
// clean up and unset it so it doesn't run needlessly.
$form_state['values']['field']['settings']['allowed_values_function'] = '';
}
}