Experimental project

This is a sandbox project, which contains experimental code for developer use only.

Description:

City Autocomplete is a Form API simple autocomplete textfield with Google Places API integration.
You will need a Google Maps API key.

Usage:

    $form['city'] = array(
      '#type' => 'city_autocomplete',
      '#title' => t('City'),
    );

Submitted values:

array(
  'city' => 'Prague',
  'country' => 'Czech Republic',
  'country_code' => 'CZ',
  'lat' => 50.0755381,
  'lon' => 14.4378005,
  'value' => 'Prague, Czech Republic',
  'formatted' => 'Prague, Czech Republic',
);

The City Autocomplete DOES respect user's language settings.
Other values can be added from the Places API upon request.


How to download:

At the moment it's just a sandbox module, so it have to be downloaded using Git.
git clone --branch 7.x-1.x git.drupal.org:sandbox/wzoom/2109111.git city_autocomplete

Project information

  • Created by wzoom on , updated