Как сделать автодополняемое текстовое поле в Drupal 7

Стандартный способ сделать поле формы автодополняемым: http://timonweb.com/posts/how-to-create-an-ajax-autocomplete-textfield-in-drupal-7

function module_name_form() {
  $form = array();
  $form['city'] = array(
    '#title' => t('City'),
    '#type' => 'textfield',
    '#autocomplete_path' => 'example/autocomplete',
  );
  $form['submit'] = array( '#type' => 'submit', '#value' => 'Save', );
  return $form;
}

 

function module_name_menu() {
  $items['example/autocomplete'] = array(
    'page callback' => '_module_name_autocomplete',
    'access arguments' => array('access example autocomplete'),
    'type' => MENU_CALLBACK );
  return $items;
}

 

function _module_name_autocomplete($string) {
  $matches = array();
  $query = db_select('cities', 'c');
  $return = $query ->fields('c', array('city'))
    ->condition('c.city', '%' . db_like($string) . '%', 'LIKE')
    ->range(0, 10)
    ->execute();
  foreach ($return as $row) {
    $matches[$row->city] = check_plain($row->city);
  }
  drupal_json_output($matches);
}