Download the PHP package proximitymad/yii2-mapspicker-widget without Composer
On this page you can find all versions of the php package proximitymad/yii2-mapspicker-widget. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download proximitymad/yii2-mapspicker-widget
More information about proximitymad/yii2-mapspicker-widget
Files in proximitymad/yii2-mapspicker-widget
Package yii2-mapspicker-widget
Short Description A widget for the Yii2 framework to render a Map with Google Maps and allow the user to pick a location on the map and get the coordinates.
License MIT
Informations about the package yii2-mapspicker-widget
yii2-mapspicker-widget
A widget for the Yii2 framework to render a Map with Google Maps and allow the user to pick a location on the map and get the coordinates.
Installation
The preferred way to install this extension is through composer.
Either run
or add
to the require section of your composer.json
file.
Usage
Once the extension is installed, simply use it in your code by :
Required parameters
- apiKey: The google maps api key, you can get it following the instructions here (only required when loadMapApi is set to true).
- search: The search string to start the map with, for example Madrid, Spain. Can be coordinates as well ( 40.4525784,-3.6813066 ).
Optional parameters
- loadMapApi: If set to false, it will not load the Google Maps JS API in case you are already including it default: true.
- mapId: The ID of the map, if it is left empty it will be autogenerated.
- width: The width of the map default: 100.
- height: The height of the map default: 100.
- latFieldClass: The DOM element class which contains the input field for latitude default: field-lat.
- lngFieldClass: The DOM element class which contains the input field for longitude default: field-lng.
- errorClass: The DOM element class which contains the error message in case no results are found default: search-error.
- errorMsg: The error message to display in case no results are found default: No results found.
- searchField:
- inputClass: The input field with the search string default: search-field.
- buttonClass: The button to start the search default: btn-search.
- mapOptions:
- zoom: the zoom to start the map with default: 16.
- streetViewControl: Enables or disables street view control or no default: false
- show: Set to false if you don't want the widget to autoload.
- scriptsPosition: The position where the scripts should load. See yii\web\View constants for positions.
Examples
Example with search
Events
After a search or after picking a place on the map an event is triggered with the search results, the event is mappicker-searchresults. The results contains all the results and the components (country, state, province and locality).