Coordinates picker widget for Yii2.

Installs: 15

Dependents: 0

Suggesters: 0

Stars: 0

Watchers: 1

Forks: 0


dev-master 2019-05-07 11:16 UTC


A map picker for latitude, longtitude and zoom attributes of the model. This widget uses (Yandex.Maps)[] API. Fill three important location attributes with one click! Requires jQuery.


The preferred way to install this extension is through composer. Either run composer require nkizza/yii2-map-pick:~1.0 or add nkizza/yii2-map_pick:~1.0 to the require section of your application's composer.json file.


The widget provides three available values: latitude, longtitude and zoom. The complete definition of the field is:

<?= MapPick::widget([
	'attributes' => [ 		//key - must be a "zoom", "lat" or "lon"
		'zoom' => [
			'name'=>'MapsCoords[zoom]', //input name (may be custom)
			'value'=>7, 				//initial value for input 

You may define only needed attributes. Please refer to the following code to see the examples:

<?= MapPick::widget([
	//html options for the container tag
	//model attributes 
	'attributes' => [
		'lat', 					//latitude (your model must have the 'lat' field)
		'lon'=>'longtitude', 	// your model has the 'longtitude' field, place it under the key 'lon')
		'zoom' => [
			'name'=>'MapsCoords[customzoom]', 	//custom input name for attribute (if needed)
			'value'=>7, 						//initial value for input 
	//custom js callback, is optional
	'callback' => 'function(lat, lon, zoom) {alert('Hello!');}',
	//language identifier 
	'language' => 'en_US',