| @@ 21-48 (lines=28) @@ | ||
| 18 | /** |
|
| 19 | * @author GeLo <[email protected]> |
|
| 20 | */ |
|
| 21 | class TypeSubscriber implements EventSubscriberInterface |
|
| 22 | { |
|
| 23 | public function handleMap(StaticMapEvent $event) |
|
| 24 | { |
|
| 25 | $map = $event->getMap(); |
|
| 26 | ||
| 27 | if ($map->hasStaticOption('maptype')) { |
|
| 28 | $type = $map->getStaticOption('maptype'); |
|
| 29 | } elseif ($map->hasMapOption('mapTypeId')) { |
|
| 30 | $type = $map->getMapOption('mapTypeId'); |
|
| 31 | } |
|
| 32 | ||
| 33 | if (isset($type)) { |
|
| 34 | $event->setParameter('maptype', strtolower($type)); |
|
| 35 | } |
|
| 36 | } |
|
| 37 | ||
| 38 | /** |
|
| 39 | * {@inheritdoc} |
|
| 40 | */ |
|
| 41 | public static function getSubscribedEvents() |
|
| 42 | { |
|
| 43 | return [StaticMapEvents::TYPE => 'handleMap']; |
|
| 44 | } |
|
| 45 | } |
|
| 46 | ||
| @@ 21-48 (lines=28) @@ | ||
| 18 | /** |
|
| 19 | * @author GeLo <[email protected]> |
|
| 20 | */ |
|
| 21 | class ZoomSubscriber implements EventSubscriberInterface |
|
| 22 | { |
|
| 23 | public function handleMap(StaticMapEvent $event) |
|
| 24 | { |
|
| 25 | $map = $event->getMap(); |
|
| 26 | ||
| 27 | if ($map->hasMapOption('zoom')) { |
|
| 28 | $zoom = $map->getMapOption('zoom'); |
|
| 29 | } elseif (!$map->isAutoZoom()) { |
|
| 30 | $zoom = 3; |
|
| 31 | } |
|
| 32 | ||
| 33 | if (isset($zoom)) { |
|
| 34 | $event->setParameter('zoom', $zoom); |
|
| 35 | } |
|
| 36 | } |
|
| 37 | ||
| 38 | /** |
|
| 39 | * {@inheritdoc} |
|
| 40 | */ |
|
| 41 | public static function getSubscribedEvents() |
|
| 42 | { |
|
| 43 | return [StaticMapEvents::ZOOM => 'handleMap']; |
|
| 44 | } |
|
| 45 | } |
|
| 46 | ||