PHP code example of pavle / yii2-location-picker

1. Go to this page and download the library: Download pavle/yii2-location-picker library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

pavle / yii2-location-picker example snippets


Location: <input type="text" id="us2-address" style="width: 200px"/>
Radius: <input type="text" id="us2-radius"/>
Lat.: <input type="text" id="us2-lat"/>
Long.: <input type="text" id="us2-lon"/>
<?= $form->field($model, 'coordinates')->widget(LocationPicker::className(), [
    'id' => 'input-coordinates',
    'pattern' => '%longitude%,%latitude%',
    'pluginOptions' => [
        'location' => [
            'latitude' => $model->getLatitude(),
            'longitude' => $model->getLongitude(),
        ],
        'inputBinding' => [
            'latitudeInput' => new JsExpression("$('#us2-lat')"),
            'longitudeInput' => new JsExpression("$('#us2-lon')"),
            'radiusInput' => new JsExpression("$('#us2-radius')"),
            'locationNameInput' => new JsExpression("$('#us2-address')"),
        ],
        'enableAutocomplete' => true,
    ],
])