PHP code example of pessek / hypemapsopen

1. Go to this page and download the library: Download pessek/hypemapsopen 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/ */

    

pessek / hypemapsopen example snippets


echo elgg_view('page/components/map', [
	'markers' => [
		'Berlin, Germany',
		'London, UK',
		'Paris, France',
	]
]);


$berlin = hypeJunction\MapsOpen\Marker::fromLocation('Berlin, Germany');
$berlin->icon = 'smile-o';
$berlin->color = 'green';
$berlin->tooltip = '<b>Berlin is a happy place</b>';

$paris = hypeJunction\MapsOpen\Marker::fromLocation('Paris, France');
$paris->icon = 'coffee';
$paris->color = 'black';
$paris->tooltip = '<img src="https://s-media-cache-ak0.pinimg.com/736x/ca/ea/57/caea57268e1dee696f3c20a5a0f895f2.jpg" alt="Paris" />';

echo elgg_view('page/components/map', [
	'markers' => [
		$berlin,
		$paris,
	],
		]);


echo elgg_view('page/components/map', [
	'markers' => elgg_get_entities_from_metadata([
		'types' => 'object',
		'subtypes' => 'place',
		'metadata_name_value_pairs' => [
			'venue_type' => 'cafe',
		],
		'limit' => 0,
	]),
	'center' => hypeJunction\MapsOpen\Marker::fromLocation('London, UK');
		]);

echo elgg_view('page/components/map', [
	// Set src to json data source
	// Data set should be an export of Marker instances
	'src' => '/path/to/data/source/json',
	'show_search' => true,
		]);


elgg_register_plugin_hook_handler('marker', 'object', function($hook, $type, $return, $params) {

	$entity = elgg_extract('entity', $params);

	if ($entity instanceof Event) {
		$return->icon = 'calendar';
		$return->color = 'darkpurple'
	}

	return $return;
})