You are here

function autocomplete_widgets_element_process in Autocomplete Widgets for Text and Number Fields 7

Process an individual textfield autocomplete element.

2 string references to 'autocomplete_widgets_element_process'
autocomplete_widgets_element_info in ./autocomplete_widgets.module
Implementation of hook_element_info().
autocomplete_widgets_field_widget_form in ./autocomplete_widgets.module
Implementation of hook_field_widget_form().

File

./autocomplete_widgets.module, line 60
Provides autocomplete widgets for Text and Number fields.

Code

function autocomplete_widgets_element_process($element, &$form_state, $form) {
  $instance = field_widget_instance($element, $form_state);
  if ($instance['widget']['type'] == 'autocomplete_widgets_allowvals') {
    module_load_include('inc', 'autocomplete_widgets', 'autocomplete_widgets.common');
    $label = drupal_array_get_nested_value($form_state['values'], $element['#parents'], $exists);
    $options = _autocomplete_widgets_get_options($instance, $label, 'equals', NULL, 1);
    if ($options) {
      drupal_array_set_nested_value($form_state['values'], $element['#parents'], key($options));
    }
  }
  return $element;
}