You are here

function geocoder_autocomplete_field_widget_form in Geocoder autocomplete 7

Implements hook_field_widget_form().

File

./geocoder_autocomplete.module, line 76
@author Stefan Auditor <stefan.auditor@erdfisch.de>

Code

function geocoder_autocomplete_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
  $element += array(
    '#type' => 'textfield',
    '#default_value' => isset($items[$delta]['value']) ? $items[$delta]['value'] : NULL,
    '#size' => 80,
    '#maxlength' => $field['settings']['max_length'],
    '#attributes' => array(
      'class' => array(
        'text-geocoder',
      ),
    ),
  );
  if (user_access('access geocoder autocomplete')) {
    $element['#autocomplete_path'] = 'geocoder/autocomplete';
  }
  return array(
    'value' => $element,
  );
}