@@ -30,11 +30,11 @@ Configuration
3030Configuration is done in your ``config/packages/ux_map.yaml `` file:
3131
3232.. code-block :: yaml
33-
33+
3434 # config/packages/ux_map.yaml
3535 ux_map :
3636 renderer : ' %env(resolve:default::UX_MAP_DSN)%'
37-
37+
3838 # Google Maps specific configuration
3939 google_maps :
4040 # Configure the default Map Id (https://developers.google.com/maps/documentation/get-map-id),
@@ -47,8 +47,8 @@ Map renderers
4747~~~~~~~~~~~~~
4848
4949The Symfony UX Map bundle supports multiple renderers. A map renderer is a
50- service that provides the code and graphic assets required to render and
51- interact with a map in the browser.
50+ service that provides the code and graphic assets required to render and
51+ interact with a map in the browser.
5252
5353Available renderers
5454~~~~~~~~~~~~~~~~~~~
@@ -75,7 +75,7 @@ Create a map
7575
7676A map is created by calling ``new Map() ``. You can configure the center, zoom, and add markers.
7777Start by creating a new map instance::
78-
78+
7979 use Symfony\UX\Map\Map;
8080
8181 // Create a new map instance
@@ -88,12 +88,12 @@ You can set the center and zoom of the map using the ``center()`` and ``zoom()``
8888
8989 use Symfony\UX\Map\Map;
9090 use Symfony\UX\Map\Point;
91-
91+
9292 $myMap
9393 // Explicitly set the center and zoom
9494 ->center(new Point(46.903354, 1.888334))
9595 ->zoom(6)
96-
96+
9797 // Or automatically fit the bounds to the markers
9898 ->fitBoundsToMarkers()
9999 ;
@@ -105,13 +105,13 @@ You can add markers to a map using the ``addMarker()`` method::
105105
106106 $myMap
107107 ->addMarker(new Marker(
108- position: new Point(48.8566, 2.3522),
108+ position: new Point(48.8566, 2.3522),
109109 title: 'Paris'
110110 ))
111111
112112 // With an info window associated to the marker:
113113 ->addMarker(new Marker(
114- position: new Point(45.7640, 4.8357),
114+ position: new Point(45.7640, 4.8357),
115115 title: 'Lyon',
116116 infoWindow: new InfoWindow(
117117 headerContent: '<b>Lyon</b>',
@@ -174,7 +174,7 @@ You can add custom HTML attributes too:
174174 Twig Function ``ux_map() ``
175175~~~~~~~~~~~~~~~~~~~~~~~~~~
176176
177- The ``ux_map() `` Twig function allows you to create and render a map in your Twig
177+ The ``ux_map() `` Twig function allows you to create and render a map in your Twig
178178templates. The function accepts the same arguments as the ``Map `` class:
179179
180180.. code-block :: html+twig
@@ -216,10 +216,8 @@ Alternatively, you can use the ``<twig:ux:map />`` component.
216216 "infoWindow": {"content": "Welcome to <b>New York</b>"}
217217 }
218218 ]'
219- attributes='{
220- "class": "foo",
221- "style": "height: 800px; width: 100%; border: 4px solid red; margin-block: 10vh;"
222- }'
219+ class="foo"
220+ style="height: 800px; width: 100%; border: 4px solid red; margin-block: 10vh;"
223221 />
224222
225223The ``<twig:ux:map /> `` component requires the `Twig Component `_ package.
@@ -236,9 +234,9 @@ Symfony UX Map allows you to extend its default behavior using a custom Stimulus
236234.. code-block :: javascript
237235
238236 // assets/controllers/mymap_controller.js
239-
237+
240238 import { Controller } from ' @hotwired/stimulus' ;
241-
239+
242240 export default class extends Controller {
243241 connect () {
244242 this .element .addEventListener (' ux:map:pre-connect' , this ._onPreConnect );
@@ -248,7 +246,7 @@ Symfony UX Map allows you to extend its default behavior using a custom Stimulus
248246 this .element .addEventListener (' ux:map:info-window:before-create' , this ._onInfoWindowBeforeCreate );
249247 this .element .addEventListener (' ux:map:info-window:after-create' , this ._onInfoWindowAfterCreate );
250248 }
251-
249+
252250 disconnect () {
253251 // You should always remove listeners when the controller is disconnected to avoid side effects
254252 this .element .removeEventListener (' ux:map:pre-connect' , this ._onPreConnect );
@@ -258,41 +256,41 @@ Symfony UX Map allows you to extend its default behavior using a custom Stimulus
258256 this .element .removeEventListener (' ux:map:info-window:before-create' , this ._onInfoWindowBeforeCreate );
259257 this .element .removeEventListener (' ux:map:info-window:after-create' , this ._onInfoWindowAfterCreate );
260258 }
261-
259+
262260 _onPreConnect (event ) {
263261 // The map is not created yet
264262 // You can use this event to configure the map before it is created
265263 console .log (event .detail .options );
266264 }
267-
265+
268266 _onConnect (event ) {
269267 // The map, markers and infoWindows are created
270268 // The instances depend on the renderer you are using
271269 console .log (event .detail .map );
272270 console .log (event .detail .markers );
273271 console .log (event .detail .infoWindows );
274272 }
275-
273+
276274 _onMarkerBeforeCreate (event ) {
277275 // The marker is not created yet
278276 // You can use this event to configure the marker before it is created
279277 console .log (event .detail .definition );
280278 }
281-
279+
282280 _onMarkerAfterCreate (event ) {
283281 // The marker is created
284282 // The instance depends on the renderer you are using
285283 console .log (event .detail .marker );
286284 }
287-
285+
288286 _onInfoWindowBeforeCreate (event ) {
289287 // The infoWindow is not created yet
290288 // You can use this event to configure the infoWindow before it is created
291289 console .log (event .detail .definition );
292290 // The associated marker instance is also available
293291 console .log (event .detail .marker );
294292 }
295-
293+
296294 _onInfoWindowAfterCreate (event ) {
297295 // The infoWindow is created
298296 // The instance depends on the renderer you are using
@@ -306,7 +304,7 @@ Symfony UX Map allows you to extend its default behavior using a custom Stimulus
306304 Then, you can use this controller in your template:
307305
308306.. code-block :: twig
309-
307+
310308 {{ ux_map(my_map, { 'data-controller': 'mymap', style: 'height: 300px' }) }}
311309
312310 .. tip ::
0 commit comments