2017 © Pedro Peláez
 

package yii2-select-google-map-location

Yii2 widget to select location at map and choose map coordinates

image

kalyabin/yii2-select-google-map-location

Yii2 widget to select location at map and choose map coordinates

  • Tuesday, June 26, 2018
  • by mkalyabin
  • Repository
  • 2 Watchers
  • 16 Stars
  • 2,468 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 12 Forks
  • 3 Open issues
  • 8 Versions
  • 26 % Grown

The README.md

yii2-select-map-location

Yii2 widget to select location at map and choose map coordinates, (*1)

This extension adds functionality to select the location on the Google map. The extension indicates the model and attributes, which stores the address, latitude and longitude., (*2)

When choosing a location map of switches and sets the marker to the selected location. The attributes recorded address and coordinates of the selected location., (*3)

Latest Stable Version Total Downloads Monthly Downloads Latest Unstable Version License, (*4)

Install

Run at your console:, (*5)

php composer.phar require "kalyabin/yii2-select-google-map-location" "*"

Register Google API

First, register your Google API key as described: Google API Documentation, (*6)

After this, enable at Google console:, (*7)

  • Google Map JavaScript API (remember API key)
  • Google Places API Web Service

Usage

Declare model class which will save geographic coordinates:, (*8)

class SearchLocation extends \yii\base\Model
{
    ...
    public $address;
    public $longitude;
    public $latitude;
    ...
}

Render widget:, (*9)

$model = new SearchLocation();
$form = \yii\widgets\ActiveForm::begin();
...
$form->field($model, 'address')->widget(\kalyabin\maplocation\SelectMapLocationWidget::className(), [
    'attributeLatitude' => 'latitude',
    'attributeLongitude' => 'longitude',
    'googleMapApiKey' => '<YOUR_REGISTERED_GOOGLE_MAP_API>',
]);
...
\yii\widgets\ActiveForm::end();

To use movable marker on the map describe draggable option:, (*10)

$model = new SearchLocation();
$form = \yii\widgets\ActiveForm::begin();
...
$form->field($model, 'address')->widget(\kalyabin\maplocation\SelectMapLocationWidget::className(), [
    'attributeLatitude' => 'latitude',
    'attributeLongitude' => 'longitude',
    'googleMapApiKey' => '<YOUR_REGISTERED_GOOGLE_MAP_API>',
    'draggable' => true,
]);
...
\yii\widgets\ActiveForm::end();

To use custom field template use placeholder {map} for ActiveField:, (*11)

$model = new SearchLocation();
$form = \yii\widgets\ActiveForm::begin();
...
$form->field($model, 'address', [
    'template' => '{label}<div class="custom-class"><div class="form-control">{input}</div>{map}</div>{error}',
])->widget(\kalyabin\maplocation\SelectMapLocationWidget::className(), [
    'attributeLatitude' => 'latitude',
    'attributeLongitude' => 'longitude',
    'googleMapApiKey' => '<YOUR_REGISTERED_GOOGLE_MAP_API>',
]);
...
\yii\widgets\ActiveForm::end();

The Versions

26/06 2018

dev-master

9999999-dev

Yii2 widget to select location at map and choose map coordinates

  Sources   Download

BSD-3-Clause

The Requires

 

by Kirill Arutyunov

framework yii2 widgets map location input widget

26/06 2018

1.1.4

1.1.4.0

Yii2 widget to select location at map and choose map coordinates

  Sources   Download

BSD-3-Clause

The Requires

 

by Kirill Arutyunov

framework yii2 widgets map location input widget

19/04 2018

1.1.3

1.1.3.0

Yii2 widget to select location at map and choose map coordinates

  Sources   Download

BSD-3-Clause

The Requires

 

by Kirill Arutyunov

framework yii2 widgets map location input widget

10/04 2018

1.1.2

1.1.2.0

Yii2 widget to select location at map and choose map coordinates

  Sources   Download

BSD-3-Clause

The Requires

 

by Kirill Arutyunov

framework yii2 widgets map location input widget

10/04 2018

1.1.0

1.1.0.0

Yii2 widget to select location at map and choose map coordinates

  Sources   Download

BSD-3-Clause

The Requires

 

by Kirill Arutyunov

framework yii2 widgets map location input widget

10/04 2018

1.1.1

1.1.1.0

Yii2 widget to select location at map and choose map coordinates

  Sources   Download

BSD-3-Clause

The Requires

 

by Kirill Arutyunov

framework yii2 widgets map location input widget

14/10 2016

1.0.x-dev

1.0.9999999.9999999-dev

Yii2 widget to select location at map and choose map coordinates

  Sources   Download

BSD-3-Clause

The Requires

 

by Kirill Arutyunov

framework yii2 widgets map location input widget

14/10 2016

1.0.0

1.0.0.0

Yii2 widget to select location at map and choose map coordinates

  Sources   Download

BSD-3-Clause

The Requires

 

by Kirill Arutyunov

framework yii2 widgets map location input widget