dev-master
9999999-devYii2 widget to select location at map and choose map coordinates
BSD-3-Clause
The Requires
- php >=5.4.0
- yiisoft/yii2 2.*
by Max Kalyabin
by Kirill Arutyunov
framework yii2 widgets map location input widget
Yii2 widget to select location at map and choose map coordinates
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)
Run at your console:, (*5)
php composer.phar require "kalyabin/yii2-select-google-map-location" "*"
First, register your Google API key as described: Google API Documentation, (*6)
After this, enable at Google console:, (*7)
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();
Yii2 widget to select location at map and choose map coordinates
BSD-3-Clause
framework yii2 widgets map location input widget