fyii/geocomplete

This package is abandoned and no longer maintained. No replacement package was suggested.

jQuery Geocomplete widget for Yii2

1.1.0 2018-06-24 07:11 UTC

This package is not auto-updated.

Last update: 2018-11-14 02:56:07 UTC


README

A geocomplete widget for Yii2 using the Geocomplete jQuery plugin.

Usage

Adding an geocomplete field based on an model attribute:

<?= $form->field($model, 'address')
         ->widget(\fyii\geocomplete\Widget::class) ?>

FYii-Geocomplete configure the jQuery plugin to look for the data-geocomplete attribute when address lookup is complete. This makes easy to get other values from the address. For example, to get the country code and postal code in separate fields, use the following code:

<?= $form->field($model, 'address')
     ->widget(\fyii\geocomplete\Widget::class) ?>

<?= $form->field($model,
                 'postal_code', [
                     'inputOptions' => [
                         'data-geocomplete' => 'postal_code',
                     ],
                 ]) ?>

<?= $form->field($model,
                 'country_code', [
    	             'inputOptions' => [
                         'data-geocomplete' => 'country_short',
                     ],
                 ]) ?>

Widget Options

FYii-geocomplete widgets accept the following options:

Issues

Visit: https://github.com/flaviovs/fyii-geocomplete