1. Go to this page and download the library: Download tmcycyit/map-bundle 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/ */
tmcycyit / map-bundle example snippets
// namespace Bus\MainBundle\Admin;
// Fields to be shown on create/edit forms
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->add('name')
->add('position', 'mapmarker', array('attr' =>
array('draggable' => true,
'limit' => 1,
'center-lat' => 40.177037117759895,
'center-lng' => 44.51488494873047,
'zoom' => 12) ))
->add('position', 'mapmarker')
->add('creationDate')
;
}
// namespace Bus\MainBundle\Admin;
// Fields to be shown on create/edit forms
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->add('name')
->add('position', 'mapmarker', array('attr' =>
array('draggable' => true,
'limit' => 1,
'center-lat' => 40.177037117759895,
'center-lng' => 44.51488494873047,
'zoom' => 12) ))
->add('position', 'mapmarker')
->add('creationDate')
;
}
public function getFormTheme() {
return array('BusMapBundle:Admin:mapmarker_edit.html.twig');
}
/**
* Get getPosition
* @return array
*
*/
public function getPosition()
{
return array('position' => array('lat' => $this->latitude,'lng' => $this->longitude));
}
/**
* Set setPosition
* @param array $latlng
* @return Stop
*
*/
public function setPosition($latlng)
{
$this
->setLatitude($latlng['lat'])
->setLongitude($latlng['lng']);
return $this;
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.