sfGeoNamesPlugin - 1.0.2

Widget using GeoNames API.

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to the Plugins Home

Signin


Forgot your password?
Create an account

Tools

Stats

advanced search
Information Readme Releases Changelog Contribute
Show source

sfGeoNamesPlugin

Widget using GeoNames API - sfGeoNamesPlugin #

Introduction

The aim of sfGeoNamesPlugin is to provide widget using the GeoNames API.

Currently this plugin provides a single widget to an autocomplete city text field based on another field containing the postal code.

Installation

  • Install the plugin
$ symfony plugin:install sfGeoNamesPlugin
  • Publish assets
 $ symfony plugin:publish-assets
  • Clear the cache
 $ symfony cache:clear

Documentation

In your form set desired field to use sfWidgetFormGeoNamesCityAutoComplete. There is a require option : postal_code_field. This option should containt name of the input postal code field.

    class TestForm extends sfForm
    {
      public function configure()
      {
        $this-$gt;setWidget(
          'my_city_field' => new sfWidgetFormGeoNamesCityAutoComplete(
            array(
              'postal_code_field' => 'my_postal_code_field',
            )
          )
        );
      }
    }

This is enough for the widget to work but you can add additionnary option.

Available Options:

  • postal_code_field: Name of the input field used for postal code. (required)
  • suggest_field: ID of the element receiving suggestion. if this option isn't set the plugin will automaticaly create a suggest box under the city input widget. otherwise specified ID will be used for rendering suggestion.
  • country_code: The country code like defined in http://www.geonames.org/countries/. Default value is US.

Contribution & Bugs

If you'd like to contribute or found any bugs, you are welcome to report them.