2017 © Pedro Peláez
 

package yii2-mapinputwidget

Yii2 widget to select location at map and choose map coordinates

image

buihoangvu/yii2-mapinputwidget

Yii2 widget to select location at map and choose map coordinates

  • Wednesday, March 15, 2017
  • by buihoangvu
  • Repository
  • 1 Watchers
  • 0 Stars
  • 8 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % 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();

The Versions

15/03 2017

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