PHP code example of yunusga / carbon-field-map-yandex

1. Go to this page and download the library: Download yunusga/carbon-field-map-yandex 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/ */

    

yunusga / carbon-field-map-yandex example snippets


Field::make( 'map_yandex', 'crb_map', __( 'Yandex Map' ) )

/**
 * Provide the Yandex Maps API key to Carbon Fields
 * 
 * @param string $key Yandex JS API key.
 */
function crb_get_yandex_maps_api_key( $key ) {
	return 'your key goes here';
}
add_filter( 'carbon_fields_map_yandex_field_api_key', 'crb_get_yandex_maps_api_key' );

Field::make( 'map_yandex', 'crb_company_location', __( 'Location' ) )
	->set_help_text( __( 'drag and drop the pin on the map to select location' ) )

// Get the location data.
$map_yandex = carbon_get_post_meta( $post_id, $field_name );

array(
	'value'   => '11.370946,142.591472',
	'lat'     => 11.370946,
	'lng'     => 142.591472,
	'zoom'    => 4,
	'address' => 'The lowest point of the Mariana Trench',
)