PHP code example of clear01 / maps

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

    

clear01 / maps example snippets


use Clear01\Maps\Controls\MapControl\Factories\IMapControlFactory;
use Clear01\Maps\Controls\MapControl;
use Nette\Application\UI\Form;

/**
 * @var IMapControlFactory
 * @inject
 */
public $mapControlFactory;

...


protected function createComponentMap(string $name): MapControl
{
    $control = $this->mapControlFactory->create();
    $control->addMarker(new Marker(50.2, 17.1, 'Titletext'));
   
    return $control;
}

...


protected function createComponentForm(string $name): Form
{
	$form = new Form();
	$gpsInput = $form->addGpsPicker('gps', 'Select location');
	$form->addAddressSuggestion('street', 'Address');
	$form->addSubmit('send', 'Submit');
	
	$form->onSuccess[] = function (Form $form, $values) use ($gpsInput) {
		//$gpsInput->getGps() returns GpsCoords or null
		$gpsInput->getGps();
	};
	return $form;
}