PHP code example of villeristi / cmb2-field-leaflet-geocoder

1. Go to this page and download the library: Download villeristi/cmb2-field-leaflet-geocoder 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/ */

    

villeristi / cmb2-field-leaflet-geocoder example snippets


array(
  'id' => $prefix . 'location',
  'name' => __('Coordinates'),
  'desc' => __('Drag the marker after finding the right spot to set the exact coordinates'),
  'type' => 'leaflet_map',
  /*
  For these extra attributes, please consult Leaflet [documentation](http://leafletjs.com/reference-1.0.0.html)
  'attributes' = array(
    'tilelayer'           => 'http://{s}.tile.osm.org/{z}/{x}/{y}.png',
    'searchbox_position'  => 'topright'; // topright, bottomright, topleft, bottomleft,
    'search'              => __( 'Search...' ),
    'not_found'           => __( 'Not found' ),
    'initial_coordinates' => [
        'lat' => 61.9241, // Go Finland!
        'lng' => 25.7482  // Go Finland!
    ],
    'initial_zoom'        => 4 // Zoomlevel when there's no coordinates set,
    'default_zoom'        => 8 // Zoomlevel after the coordinates have been set & page saved
  )
  */
),