diff --git a/src/Map/CHANGELOG.md b/src/Map/CHANGELOG.md index fdfca7ea6df..e14236e3d58 100644 --- a/src/Map/CHANGELOG.md +++ b/src/Map/CHANGELOG.md @@ -4,13 +4,13 @@ - Minimum required Symfony version is now 6.4 - Minimum required PHP version is now 8.2 +- Remove `render_map()` Twig function, use `ux_map()` instead +- Remove option `title` from `Polygon`, `Polyline`, `Rectangle` and `Circle`, use `infoWindow` instead +- Remove property `rawOptions` from `ux:map:*:before-create` events, use `bridgeOptions` instead. ## 2.30 - Ensure compatibility with PHP 8.5 - -## 2.30 - - Deprecate option `title` from `Polygon`, `Polyline`, `Rectangle` and `Circle` in favor of `infoWindow` ## 2.29.0 diff --git a/src/Map/assets/dist/abstract_map_controller.d.ts b/src/Map/assets/dist/abstract_map_controller.d.ts index 42e76498f65..cefe307c221 100644 --- a/src/Map/assets/dist/abstract_map_controller.d.ts +++ b/src/Map/assets/dist/abstract_map_controller.d.ts @@ -42,23 +42,18 @@ type MarkerDefinition = WithIdenti title: string | null; infoWindow?: Omit, 'position'>; icon?: Icon; - rawOptions?: BridgeMarkerOptions; bridgeOptions?: BridgeMarkerOptions; extra: ExtraData; }>; type PolygonDefinition = WithIdentifier<{ infoWindow?: Omit, 'position'>; points: Array | Array>; - title: string | null; - rawOptions?: BridgePolygonOptions; bridgeOptions?: BridgePolygonOptions; extra: ExtraData; }>; type PolylineDefinition = WithIdentifier<{ infoWindow?: Omit, 'position'>; points: Array; - title: string | null; - rawOptions?: BridgePolylineOptions; bridgeOptions?: BridgePolylineOptions; extra: ExtraData; }>; @@ -66,8 +61,6 @@ type CircleDefinition = WithIdenti infoWindow?: Omit, 'position'>; center: Point; radius: number; - title: string | null; - rawOptions?: BridgeCircleOptions; bridgeOptions?: BridgeCircleOptions; extra: ExtraData; }>; @@ -75,8 +68,6 @@ type RectangleDefinition = With infoWindow?: Omit, 'position'>; southWest: Point; northEast: Point; - title: string | null; - rawOptions?: BridgeRectangleOptions; bridgeOptions?: BridgeRectangleOptions; extra: ExtraData; }>; @@ -86,7 +77,6 @@ type InfoWindowDefinition = { position: Point; opened: boolean; autoClose: boolean; - rawOptions?: BridgeInfoWindowOptions; bridgeOptions?: BridgeInfoWindowOptions; extra: ExtraData; }; diff --git a/src/Map/assets/dist/abstract_map_controller.js b/src/Map/assets/dist/abstract_map_controller.js index 13a055dd7e0..cf24b733af7 100644 --- a/src/Map/assets/dist/abstract_map_controller.js +++ b/src/Map/assets/dist/abstract_map_controller.js @@ -102,12 +102,6 @@ var abstract_map_controller_default = class extends Controller { const eventAfter = `${type}:after-create`; return ({ definition }) => { this.dispatchEvent(eventBefore, { definition }); - if (typeof definition.rawOptions !== "undefined") { - console.warn( - `[Symfony UX Map] The event "${eventBefore}" added a deprecated "rawOptions" property to the definition, it will be removed in a next major version, replace it with "bridgeOptions" instead.`, - definition - ); - } const drawing = factory({ definition }); this.dispatchEvent(eventAfter, { [type]: drawing, definition }); draws.set(definition["@id"], drawing); diff --git a/src/Map/assets/src/abstract_map_controller.ts b/src/Map/assets/src/abstract_map_controller.ts index 46932827344..16983a35550 100644 --- a/src/Map/assets/src/abstract_map_controller.ts +++ b/src/Map/assets/src/abstract_map_controller.ts @@ -64,11 +64,6 @@ export type MarkerDefinition = Wit title: string | null; infoWindow?: Omit, 'position'>; icon?: Icon; - /** - * @deprecated since Symfony UX Map 2.27, use "bridgeOptions" instead. - * Raw options passed to the marker constructor, specific to the map provider (e.g.: `L.marker()` for Leaflet). - */ - rawOptions?: BridgeMarkerOptions; /** * Additional options passed to the Marker constructor. * These options are specific to the Map Bridge, and can be defined through `ux:map:marker:before-create` event. @@ -86,15 +81,6 @@ export type MarkerDefinition = Wit export type PolygonDefinition = WithIdentifier<{ infoWindow?: Omit, 'position'>; points: Array | Array>; - /** - * @deprecated since Symfony UX Map 2.29, use "infoWindow" instead - */ - title: string | null; - /** - * @deprecated since Symfony UX Map 2.27, use "bridgeOptions" instead. - * Raw options passed to the polygon constructor, specific to the map provider (e.g.: `L.polygon()` for Leaflet). - */ - rawOptions?: BridgePolygonOptions; /** * Additional options passed to the Polygon constructor. * These options are specific to the Map Bridge, and can be defined through `ux:map:polygon:before-create` event. @@ -112,15 +98,6 @@ export type PolygonDefinition = W export type PolylineDefinition = WithIdentifier<{ infoWindow?: Omit, 'position'>; points: Array; - /** - * @deprecated since Symfony UX Map 2.29, use "infoWindow" instead - */ - title: string | null; - /** - * @deprecated since Symfony UX Map 2.27, use "bridgeOptions" instead. - * Raw options passed to the polyline constructor, specific to the map provider (e.g.: `L.polyline()` for Leaflet). - */ - rawOptions?: BridgePolylineOptions; /** * Additional options passed to the Polyline constructor. * These options are specific to the Map Bridge, and can be defined through `ux:map:polyline:before-create` event. @@ -139,15 +116,6 @@ export type CircleDefinition = Wit infoWindow?: Omit, 'position'>; center: Point; radius: number; - /** - * @deprecated since Symfony UX Map 2.29, use "infoWindow" instead - */ - title: string | null; - /** - * @deprecated since Symfony UX Map 2.27, use "bridgeOptions" instead. - * Raw options passed to the circle constructor, specific to the map provider (e.g.: `L.circle()` for Leaflet). - */ - rawOptions?: BridgeCircleOptions; /** * Additional options passed to the Circle constructor. * These options are specific to the Map Bridge, and can be defined through `ux:map:circle:before-create` event. @@ -166,15 +134,6 @@ export type RectangleDefinition infoWindow?: Omit, 'position'>; southWest: Point; northEast: Point; - /** - * @deprecated since Symfony UX Map 2.29, use "infoWindow" instead - */ - title: string | null; - /** - * @deprecated since Symfony UX Map 2.27, use "bridgeOptions" instead. - * Raw options passed to the rectangle constructor, specific to the map provider (e.g.: `L.rectangle()` for Leaflet). - */ - rawOptions?: BridgeRectangleOptions; /** * Additional options passed to the Rectangle constructor. * These options are specific to the Map Bridge, and can be defined through `ux:map:rectangle:before-create` event. @@ -195,11 +154,6 @@ export type InfoWindowDefinition = { position: Point; opened: boolean; autoClose: boolean; - /** - * @deprecated since Symfony UX Map 2.27, use "bridgeOptions" instead. - * Raw options passed to the info window constructor, specific to the map provider (e.g.: `google.maps.InfoWindow()` for Google Maps). - */ - rawOptions?: BridgeInfoWindowOptions; /** * Additional options passed to the InfoWindow constructor. * These options are specific to the Map Bridge, and can be defined through `ux:map:info-window:before-create` event. @@ -466,13 +420,6 @@ export default abstract class< return ({ definition }: { definition: WithIdentifier }) => { this.dispatchEvent(eventBefore, { definition }); - if (typeof definition.rawOptions !== 'undefined') { - console.warn( - `[Symfony UX Map] The event "${eventBefore}" added a deprecated "rawOptions" property to the definition, it will be removed in a next major version, replace it with "bridgeOptions" instead.`, - definition - ); - } - const drawing = factory({ definition }) as Draw; this.dispatchEvent(eventAfter, { [type]: drawing, definition }); diff --git a/src/Map/src/Bridge/Google/assets/dist/map_controller.js b/src/Map/src/Bridge/Google/assets/dist/map_controller.js index 9efc9a6b78b..bdf4c43cc5f 100644 --- a/src/Map/src/Bridge/Google/assets/dist/map_controller.js +++ b/src/Map/src/Bridge/Google/assets/dist/map_controller.js @@ -105,12 +105,6 @@ var abstract_map_controller_default = class extends Controller { const eventAfter = `${type}:after-create`; return ({ definition }) => { this.dispatchEvent(eventBefore, { definition }); - if (typeof definition.rawOptions !== "undefined") { - console.warn( - `[Symfony UX Map] The event "${eventBefore}" added a deprecated "rawOptions" property to the definition, it will be removed in a next major version, replace it with "bridgeOptions" instead.`, - definition - ); - } const drawing = factory({ definition }); this.dispatchEvent(eventAfter, { [type]: drawing, definition }); draws.set(definition["@id"], drawing); @@ -236,12 +230,11 @@ var map_controller_default = class extends abstract_map_controller_default { doCreateMarker({ definition }) { - const { "@id": _id, position, title, infoWindow, icon, rawOptions = {}, bridgeOptions = {} } = definition; + const { "@id": _id, position, title, infoWindow, icon, bridgeOptions = {} } = definition; const marker = new _google.maps.marker.AdvancedMarkerElement({ position, title, map: this.map, - ...rawOptions, ...bridgeOptions }); if (infoWindow) { @@ -258,16 +251,12 @@ var map_controller_default = class extends abstract_map_controller_default { doCreatePolygon({ definition }) { - const { "@id": _id, points, title, infoWindow, rawOptions = {}, bridgeOptions = {} } = definition; + const { "@id": _id, points, infoWindow, bridgeOptions = {} } = definition; const polygon = new _google.maps.Polygon({ paths: points, map: this.map, - ...rawOptions, ...bridgeOptions }); - if (title) { - polygon.set("title", title); - } if (infoWindow) { this.createInfoWindow({ definition: infoWindow, element: polygon }); } @@ -279,16 +268,12 @@ var map_controller_default = class extends abstract_map_controller_default { doCreatePolyline({ definition }) { - const { "@id": _id, points, title, infoWindow, rawOptions = {}, bridgeOptions = {} } = definition; + const { "@id": _id, points, infoWindow, bridgeOptions = {} } = definition; const polyline = new _google.maps.Polyline({ path: points, map: this.map, - ...rawOptions, ...bridgeOptions }); - if (title) { - polyline.set("title", title); - } if (infoWindow) { this.createInfoWindow({ definition: infoWindow, element: polyline }); } @@ -298,17 +283,13 @@ var map_controller_default = class extends abstract_map_controller_default { polyline.setMap(null); } doCreateCircle({ definition }) { - const { "@id": _id, center, radius, title, infoWindow, rawOptions = {}, bridgeOptions = {} } = definition; + const { "@id": _id, center, radius, infoWindow, bridgeOptions = {} } = definition; const circle = new _google.maps.Circle({ center, radius, map: this.map, - ...rawOptions, ...bridgeOptions }); - if (title) { - circle.set("title", title); - } if (infoWindow) { this.createInfoWindow({ definition: infoWindow, element: circle }); } @@ -320,16 +301,12 @@ var map_controller_default = class extends abstract_map_controller_default { doCreateRectangle({ definition }) { - const { northEast, southWest, title, infoWindow, rawOptions = {}, bridgeOptions = {} } = definition; + const { northEast, southWest, infoWindow, bridgeOptions = {} } = definition; const rectangle = new _google.maps.Rectangle({ bounds: new _google.maps.LatLngBounds(southWest, northEast), map: this.map, - ...rawOptions, ...bridgeOptions }); - if (title) { - rectangle.set("title", title); - } if (infoWindow) { this.createInfoWindow({ definition: infoWindow, element: rectangle }); } @@ -342,7 +319,7 @@ var map_controller_default = class extends abstract_map_controller_default { definition, element }) { - const { headerContent, content, opened, autoClose, rawOptions = {}, bridgeOptions = {} } = definition; + const { headerContent, content, opened, autoClose, bridgeOptions = {} } = definition; let position = null; if (element instanceof google.maps.Circle) { position = element.getCenter(); @@ -354,7 +331,6 @@ var map_controller_default = class extends abstract_map_controller_default { headerContent: this.createTextOrElement(headerContent), content: this.createTextOrElement(content), position, - ...rawOptions, ...bridgeOptions }; const infoWindow = new _google.maps.InfoWindow(infoWindowOptions); diff --git a/src/Map/src/Bridge/Google/assets/src/map_controller.ts b/src/Map/src/Bridge/Google/assets/src/map_controller.ts index b03a35fc553..ae8adfcacc4 100644 --- a/src/Map/src/Bridge/Google/assets/src/map_controller.ts +++ b/src/Map/src/Bridge/Google/assets/src/map_controller.ts @@ -173,13 +173,12 @@ export default class extends AbstractMapController< }: { definition: MarkerDefinition; }): google.maps.marker.AdvancedMarkerElement { - const { '@id': _id, position, title, infoWindow, icon, rawOptions = {}, bridgeOptions = {} } = definition; + const { '@id': _id, position, title, infoWindow, icon, bridgeOptions = {} } = definition; const marker = new _google.maps.marker.AdvancedMarkerElement({ position, title, map: this.map, - ...rawOptions, ...bridgeOptions, }); @@ -203,22 +202,14 @@ export default class extends AbstractMapController< }: { definition: PolygonDefinition; }): google.maps.Polygon { - const { '@id': _id, points, title, infoWindow, rawOptions = {}, bridgeOptions = {} } = definition; + const { '@id': _id, points, infoWindow, bridgeOptions = {} } = definition; const polygon = new _google.maps.Polygon({ paths: points, map: this.map, - ...rawOptions, ...bridgeOptions, }); - /** - * @deprecated since Symfony UX Map 2.29, will be removed in 3.0 - */ - if (title) { - polygon.set('title', title); - } - if (infoWindow) { this.createInfoWindow({ definition: infoWindow, element: polygon }); } @@ -235,22 +226,14 @@ export default class extends AbstractMapController< }: { definition: PolylineDefinition; }): google.maps.Polyline { - const { '@id': _id, points, title, infoWindow, rawOptions = {}, bridgeOptions = {} } = definition; + const { '@id': _id, points, infoWindow, bridgeOptions = {} } = definition; const polyline = new _google.maps.Polyline({ path: points, map: this.map, - ...rawOptions, ...bridgeOptions, }); - /** - * @deprecated since Symfony UX Map 2.29, will be removed in 3.0 - */ - if (title) { - polyline.set('title', title); - } - if (infoWindow) { this.createInfoWindow({ definition: infoWindow, element: polyline }); } @@ -263,23 +246,15 @@ export default class extends AbstractMapController< } protected doCreateCircle({ definition }: { definition: CircleDefinition }): google.maps.Circle { - const { '@id': _id, center, radius, title, infoWindow, rawOptions = {}, bridgeOptions = {} } = definition; + const { '@id': _id, center, radius, infoWindow, bridgeOptions = {} } = definition; const circle = new _google.maps.Circle({ center, radius, map: this.map, - ...rawOptions, ...bridgeOptions, }); - /** - * @deprecated since Symfony UX Map 2.29, will be removed in 3.0 - */ - if (title) { - circle.set('title', title); - } - if (infoWindow) { this.createInfoWindow({ definition: infoWindow, element: circle }); } @@ -296,22 +271,14 @@ export default class extends AbstractMapController< }: { definition: RectangleDefinition; }): google.maps.Rectangle { - const { northEast, southWest, title, infoWindow, rawOptions = {}, bridgeOptions = {} } = definition; + const { northEast, southWest, infoWindow, bridgeOptions = {} } = definition; const rectangle = new _google.maps.Rectangle({ bounds: new _google.maps.LatLngBounds(southWest, northEast), map: this.map, - ...rawOptions, ...bridgeOptions, }); - /** - * @deprecated since Symfony UX Map 2.29, will be removed in 3.0 - */ - if (title) { - rectangle.set('title', title); - } - if (infoWindow) { this.createInfoWindow({ definition: infoWindow, element: rectangle }); } @@ -330,7 +297,7 @@ export default class extends AbstractMapController< definition: Omit, 'position'>; element: google.maps.marker.AdvancedMarkerElement | google.maps.Polygon | google.maps.Polyline | google.maps.Circle | google.maps.Rectangle; }): google.maps.InfoWindow { - const { headerContent, content, opened, autoClose, rawOptions = {}, bridgeOptions = {} } = definition; + const { headerContent, content, opened, autoClose, bridgeOptions = {} } = definition; let position: google.maps.LatLng | null = null; if (element instanceof google.maps.Circle) { @@ -351,7 +318,6 @@ export default class extends AbstractMapController< headerContent: this.createTextOrElement(headerContent), content: this.createTextOrElement(content), position, - ...rawOptions, ...bridgeOptions, }; @@ -362,7 +328,7 @@ export default class extends AbstractMapController< this.closeInfoWindowsExcept(infoWindow); } - // Don't override the position if it was already set (e.g. through "rawOptions") + // Don't override the position if it was already set (e.g. through "bridgeOptions") if (infoWindowOptions.position === null) { infoWindow.setPosition(event.latLng); } diff --git a/src/Map/src/Bridge/Google/tests/__snapshots__/GoogleRendererTest__testRenderMap with data set with circles and infoWindows__1.txt b/src/Map/src/Bridge/Google/tests/__snapshots__/GoogleRendererTest__testRenderMap with data set with circles and infoWindows__1.txt index c7a07df8f64..d5a01116144 100644 --- a/src/Map/src/Bridge/Google/tests/__snapshots__/GoogleRendererTest__testRenderMap with data set with circles and infoWindows__1.txt +++ b/src/Map/src/Bridge/Google/tests/__snapshots__/GoogleRendererTest__testRenderMap with data set with circles and infoWindows__1.txt @@ -10,6 +10,6 @@ data-symfony--ux-google-map--map-markers-value="[]" data-symfony--ux-google-map--map-polygons-value="[]" data-symfony--ux-google-map--map-polylines-value="[]" - data-symfony--ux-google-map--map-circles-value="[{"center":{"lat":48.8566,"lng":2.3522},"radius":500,"title":null,"infoWindow":{"headerContent":null,"content":"Circle","position":null,"opened":false,"autoClose":true,"extra":[]},"extra":[],"id":null,"@id":"3115517621c88996"},{"center":{"lat":1.1,"lng":2.2},"radius":1000,"title":null,"infoWindow":{"headerContent":null,"content":"Circle","position":null,"opened":false,"autoClose":true,"extra":[]},"extra":[],"id":null,"@id":"71febe272ee9a265"}]" + data-symfony--ux-google-map--map-circles-value="[{"center":{"lat":48.8566,"lng":2.3522},"radius":500,"infoWindow":{"headerContent":null,"content":"Circle","position":null,"opened":false,"autoClose":true,"extra":[]},"extra":[],"id":null,"@id":"37be1fabfcfab07e"},{"center":{"lat":1.1,"lng":2.2},"radius":1000,"infoWindow":{"headerContent":null,"content":"Circle","position":null,"opened":false,"autoClose":true,"extra":[]},"extra":[],"id":null,"@id":"a06780e6bd4f8130"}]" data-symfony--ux-google-map--map-rectangles-value="[]" > \ No newline at end of file diff --git a/src/Map/src/Bridge/Google/tests/__snapshots__/GoogleRendererTest__testRenderMap with data set with polygons and infoWindows__1.txt b/src/Map/src/Bridge/Google/tests/__snapshots__/GoogleRendererTest__testRenderMap with data set with polygons and infoWindows__1.txt index 1d2aaf668ca..dde65067112 100644 --- a/src/Map/src/Bridge/Google/tests/__snapshots__/GoogleRendererTest__testRenderMap with data set with polygons and infoWindows__1.txt +++ b/src/Map/src/Bridge/Google/tests/__snapshots__/GoogleRendererTest__testRenderMap with data set with polygons and infoWindows__1.txt @@ -8,7 +8,7 @@ data-symfony--ux-google-map--map-fit-bounds-to-markers-value="false" data-symfony--ux-google-map--map-options-value="{"mapId":null,"gestureHandling":"auto","backgroundColor":null,"disableDoubleClickZoom":false,"zoomControlOptions":{"position":22},"mapTypeControlOptions":{"mapTypeIds":[],"position":14,"style":0},"streetViewControlOptions":{"position":22},"fullscreenControlOptions":{"position":20},"@provider":"google"}" data-symfony--ux-google-map--map-markers-value="[]" - data-symfony--ux-google-map--map-polygons-value="[{"points":[{"lat":48.8566,"lng":2.3522},{"lat":48.8566,"lng":2.3522},{"lat":48.8566,"lng":2.3522}],"title":null,"infoWindow":null,"extra":[],"id":null,"@id":"7cdd432ea54d0ce9"},{"points":[{"lat":1.1,"lng":2.2},{"lat":3.3,"lng":4.4},{"lat":5.5,"lng":6.6}],"title":null,"infoWindow":{"headerContent":null,"content":"Polygon","position":null,"opened":false,"autoClose":true,"extra":[]},"extra":[],"id":null,"@id":"9074e0a9ead08c1e"}]" + data-symfony--ux-google-map--map-polygons-value="[{"points":[{"lat":48.8566,"lng":2.3522},{"lat":48.8566,"lng":2.3522},{"lat":48.8566,"lng":2.3522}],"infoWindow":null,"extra":[],"id":null,"@id":"08ef86cb6c208811"},{"points":[{"lat":1.1,"lng":2.2},{"lat":3.3,"lng":4.4},{"lat":5.5,"lng":6.6}],"infoWindow":{"headerContent":null,"content":"Polygon","position":null,"opened":false,"autoClose":true,"extra":[]},"extra":[],"id":null,"@id":"a99b3200efed3a10"}]" data-symfony--ux-google-map--map-polylines-value="[]" data-symfony--ux-google-map--map-circles-value="[]" data-symfony--ux-google-map--map-rectangles-value="[]" diff --git a/src/Map/src/Bridge/Google/tests/__snapshots__/GoogleRendererTest__testRenderMap with data set with polylines and infoWindows__1.txt b/src/Map/src/Bridge/Google/tests/__snapshots__/GoogleRendererTest__testRenderMap with data set with polylines and infoWindows__1.txt index 2ed6b41da30..c112d2000d4 100644 --- a/src/Map/src/Bridge/Google/tests/__snapshots__/GoogleRendererTest__testRenderMap with data set with polylines and infoWindows__1.txt +++ b/src/Map/src/Bridge/Google/tests/__snapshots__/GoogleRendererTest__testRenderMap with data set with polylines and infoWindows__1.txt @@ -9,7 +9,7 @@ data-symfony--ux-google-map--map-options-value="{"mapId":null,"gestureHandling":"auto","backgroundColor":null,"disableDoubleClickZoom":false,"zoomControlOptions":{"position":22},"mapTypeControlOptions":{"mapTypeIds":[],"position":14,"style":0},"streetViewControlOptions":{"position":22},"fullscreenControlOptions":{"position":20},"@provider":"google"}" data-symfony--ux-google-map--map-markers-value="[]" data-symfony--ux-google-map--map-polygons-value="[]" - data-symfony--ux-google-map--map-polylines-value="[{"points":[{"lat":48.8566,"lng":2.3522},{"lat":48.8566,"lng":2.3522},{"lat":48.8566,"lng":2.3522}],"title":null,"infoWindow":null,"extra":[],"id":null,"@id":"7cdd432ea54d0ce9"},{"points":[{"lat":1.1,"lng":2.2},{"lat":3.3,"lng":4.4},{"lat":5.5,"lng":6.6}],"title":null,"infoWindow":{"headerContent":null,"content":"Polygon","position":null,"opened":false,"autoClose":true,"extra":[]},"extra":[],"id":null,"@id":"9074e0a9ead08c1e"}]" + data-symfony--ux-google-map--map-polylines-value="[{"points":[{"lat":48.8566,"lng":2.3522},{"lat":48.8566,"lng":2.3522},{"lat":48.8566,"lng":2.3522}],"infoWindow":null,"extra":[],"id":null,"@id":"08ef86cb6c208811"},{"points":[{"lat":1.1,"lng":2.2},{"lat":3.3,"lng":4.4},{"lat":5.5,"lng":6.6}],"infoWindow":{"headerContent":null,"content":"Polygon","position":null,"opened":false,"autoClose":true,"extra":[]},"extra":[],"id":null,"@id":"a99b3200efed3a10"}]" data-symfony--ux-google-map--map-circles-value="[]" data-symfony--ux-google-map--map-rectangles-value="[]" > \ No newline at end of file diff --git a/src/Map/src/Bridge/Google/tests/__snapshots__/GoogleRendererTest__testRenderMap with data set with rectangles and infoWindows__1.txt b/src/Map/src/Bridge/Google/tests/__snapshots__/GoogleRendererTest__testRenderMap with data set with rectangles and infoWindows__1.txt index f29709a8f4a..b364d5aa847 100644 --- a/src/Map/src/Bridge/Google/tests/__snapshots__/GoogleRendererTest__testRenderMap with data set with rectangles and infoWindows__1.txt +++ b/src/Map/src/Bridge/Google/tests/__snapshots__/GoogleRendererTest__testRenderMap with data set with rectangles and infoWindows__1.txt @@ -11,5 +11,5 @@ data-symfony--ux-google-map--map-polygons-value="[]" data-symfony--ux-google-map--map-polylines-value="[]" data-symfony--ux-google-map--map-circles-value="[]" - data-symfony--ux-google-map--map-rectangles-value="[{"southWest":{"lat":48.8566,"lng":2.3522},"northEast":{"lat":48.8566,"lng":2.3522},"title":null,"infoWindow":{"headerContent":null,"content":"Rectangle","position":null,"opened":false,"autoClose":true,"extra":[]},"extra":[],"id":null,"@id":"1b754ce32860016a"},{"southWest":{"lat":1.1,"lng":2.2},"northEast":{"lat":3.3,"lng":4.4},"title":null,"infoWindow":{"headerContent":null,"content":"Rectangle","position":null,"opened":false,"autoClose":true,"extra":[]},"extra":[],"id":null,"@id":"d98c12855ec90699"}]" + data-symfony--ux-google-map--map-rectangles-value="[{"southWest":{"lat":48.8566,"lng":2.3522},"northEast":{"lat":48.8566,"lng":2.3522},"infoWindow":{"headerContent":null,"content":"Rectangle","position":null,"opened":false,"autoClose":true,"extra":[]},"extra":[],"id":null,"@id":"63ff4faf57659976"},{"southWest":{"lat":1.1,"lng":2.2},"northEast":{"lat":3.3,"lng":4.4},"infoWindow":{"headerContent":null,"content":"Rectangle","position":null,"opened":false,"autoClose":true,"extra":[]},"extra":[],"id":null,"@id":"f1a6986557f75884"}]" > \ No newline at end of file diff --git a/src/Map/src/Bridge/Leaflet/assets/dist/map_controller.js b/src/Map/src/Bridge/Leaflet/assets/dist/map_controller.js index df3c4c1c9d7..326162728fb 100644 --- a/src/Map/src/Bridge/Leaflet/assets/dist/map_controller.js +++ b/src/Map/src/Bridge/Leaflet/assets/dist/map_controller.js @@ -102,12 +102,6 @@ var abstract_map_controller_default = class extends Controller { const eventAfter = `${type}:after-create`; return ({ definition }) => { this.dispatchEvent(eventBefore, { definition }); - if (typeof definition.rawOptions !== "undefined") { - console.warn( - `[Symfony UX Map] The event "${eventBefore}" added a deprecated "rawOptions" property to the definition, it will be removed in a next major version, replace it with "bridgeOptions" instead.`, - definition - ); - } const drawing = factory({ definition }); this.dispatchEvent(eventAfter, { [type]: drawing, definition }); draws.set(definition["@id"], drawing); @@ -217,12 +211,11 @@ var map_controller_default = class extends abstract_map_controller_default { return map2; } doCreateMarker({ definition }) { - const { "@id": _id, position, title, infoWindow, icon: icon2, rawOptions = {}, bridgeOptions = {} } = definition; + const { "@id": _id, position, title, infoWindow, icon: icon2, bridgeOptions = {} } = definition; const marker2 = L.marker(position, { title: title || void 0, - ...rawOptions, - ...bridgeOptions, - riseOnHover: true + riseOnHover: true, + ...bridgeOptions }).addTo(this.map); if (infoWindow) { this.createInfoWindow({ definition: infoWindow, element: marker2 }); @@ -236,11 +229,8 @@ var map_controller_default = class extends abstract_map_controller_default { marker2.remove(); } doCreatePolygon({ definition }) { - const { "@id": _id, points, title, infoWindow, rawOptions = {}, bridgeOptions = {} } = definition; - const polygon2 = L.polygon(points, { ...rawOptions, ...bridgeOptions }).addTo(this.map); - if (title) { - polygon2.bindPopup(title); - } + const { "@id": _id, points, infoWindow, bridgeOptions = {} } = definition; + const polygon2 = L.polygon(points, { ...bridgeOptions }).addTo(this.map); if (infoWindow) { this.createInfoWindow({ definition: infoWindow, element: polygon2 }); } @@ -250,11 +240,8 @@ var map_controller_default = class extends abstract_map_controller_default { polygon2.remove(); } doCreatePolyline({ definition }) { - const { "@id": _id, points, title, infoWindow, rawOptions = {}, bridgeOptions = {} } = definition; - const polyline2 = L.polyline(points, { ...rawOptions, ...bridgeOptions }).addTo(this.map); - if (title) { - polyline2.bindPopup(title); - } + const { "@id": _id, points, infoWindow, bridgeOptions = {} } = definition; + const polyline2 = L.polyline(points, { ...bridgeOptions }).addTo(this.map); if (infoWindow) { this.createInfoWindow({ definition: infoWindow, element: polyline2 }); } @@ -264,11 +251,8 @@ var map_controller_default = class extends abstract_map_controller_default { polyline2.remove(); } doCreateCircle({ definition }) { - const { "@id": _id, center, radius, title, infoWindow, rawOptions = {}, bridgeOptions = {} } = definition; - const circle2 = L.circle(center, { radius, ...rawOptions, ...bridgeOptions }).addTo(this.map); - if (title) { - circle2.bindPopup(title); - } + const { "@id": _id, center, radius, infoWindow, bridgeOptions = {} } = definition; + const circle2 = L.circle(center, { radius, ...bridgeOptions }).addTo(this.map); if (infoWindow) { this.createInfoWindow({ definition: infoWindow, element: circle2 }); } @@ -278,17 +262,14 @@ var map_controller_default = class extends abstract_map_controller_default { circle2.remove(); } doCreateRectangle({ definition }) { - const { "@id": _id, southWest, northEast, title, infoWindow, rawOptions = {}, bridgeOptions = {} } = definition; + const { "@id": _id, southWest, northEast, infoWindow, bridgeOptions = {} } = definition; const rectangle2 = L.rectangle( [ [southWest.lat, southWest.lng], [northEast.lat, northEast.lng] ], - { ...rawOptions, ...bridgeOptions } + { ...bridgeOptions } ).addTo(this.map); - if (title) { - rectangle2.bindPopup(title); - } if (infoWindow) { this.createInfoWindow({ definition: infoWindow, element: rectangle2 }); } @@ -301,8 +282,8 @@ var map_controller_default = class extends abstract_map_controller_default { definition, element }) { - const { headerContent, content, opened, autoClose, rawOptions = {}, bridgeOptions = {} } = definition; - element.bindPopup([headerContent, content].filter((x) => x).join("
"), { ...rawOptions, ...bridgeOptions }); + const { headerContent, content, opened, autoClose, bridgeOptions = {} } = definition; + element.bindPopup([headerContent, content].filter((x) => x).join("
"), { ...bridgeOptions }); if (opened) { if (autoClose) { this.closePopups(); diff --git a/src/Map/src/Bridge/Leaflet/assets/src/map_controller.ts b/src/Map/src/Bridge/Leaflet/assets/src/map_controller.ts index 52efd4405b3..4bbc464bebb 100644 --- a/src/Map/src/Bridge/Leaflet/assets/src/map_controller.ts +++ b/src/Map/src/Bridge/Leaflet/assets/src/map_controller.ts @@ -140,13 +140,12 @@ export default class extends AbstractMapController< } protected doCreateMarker({ definition }: { definition: MarkerDefinition }): L.Marker { - const { '@id': _id, position, title, infoWindow, icon, rawOptions = {}, bridgeOptions = {} } = definition; + const { '@id': _id, position, title, infoWindow, icon, bridgeOptions = {} } = definition; const marker = L.marker(position, { title: title || undefined, - ...rawOptions, - ...bridgeOptions, riseOnHover: true, + ...bridgeOptions, }).addTo(this.map); if (infoWindow) { @@ -165,16 +164,9 @@ export default class extends AbstractMapController< } protected doCreatePolygon({ definition }: { definition: PolygonDefinition }): L.Polygon { - const { '@id': _id, points, title, infoWindow, rawOptions = {}, bridgeOptions = {} } = definition; + const { '@id': _id, points, infoWindow, bridgeOptions = {} } = definition; - const polygon = L.polygon(points, { ...rawOptions, ...bridgeOptions }).addTo(this.map); - - /** - * @deprecated since Symfony UX Map 2.29 - */ - if (title) { - polygon.bindPopup(title); - } + const polygon = L.polygon(points, { ...bridgeOptions }).addTo(this.map); if (infoWindow) { this.createInfoWindow({ definition: infoWindow, element: polygon }); @@ -188,16 +180,9 @@ export default class extends AbstractMapController< } protected doCreatePolyline({ definition }: { definition: PolylineDefinition }): L.Polyline { - const { '@id': _id, points, title, infoWindow, rawOptions = {}, bridgeOptions = {} } = definition; - - const polyline = L.polyline(points, { ...rawOptions, ...bridgeOptions }).addTo(this.map); + const { '@id': _id, points, infoWindow, bridgeOptions = {} } = definition; - /** - * @deprecated since Symfony UX Map 2.29 - */ - if (title) { - polyline.bindPopup(title); - } + const polyline = L.polyline(points, { ...bridgeOptions }).addTo(this.map); if (infoWindow) { this.createInfoWindow({ definition: infoWindow, element: polyline }); @@ -211,16 +196,9 @@ export default class extends AbstractMapController< } protected doCreateCircle({ definition }: { definition: CircleDefinition }): L.Circle { - const { '@id': _id, center, radius, title, infoWindow, rawOptions = {}, bridgeOptions = {} } = definition; - - const circle = L.circle(center, { radius, ...rawOptions, ...bridgeOptions }).addTo(this.map); + const { '@id': _id, center, radius, infoWindow, bridgeOptions = {} } = definition; - /** - * @deprecated since Symfony UX Map 2.29 - */ - if (title) { - circle.bindPopup(title); - } + const circle = L.circle(center, { radius, ...bridgeOptions }).addTo(this.map); if (infoWindow) { this.createInfoWindow({ definition: infoWindow, element: circle }); @@ -234,23 +212,16 @@ export default class extends AbstractMapController< } protected doCreateRectangle({ definition }: { definition: RectangleDefinition }): L.Rectangle { - const { '@id': _id, southWest, northEast, title, infoWindow, rawOptions = {}, bridgeOptions = {} } = definition; + const { '@id': _id, southWest, northEast, infoWindow, bridgeOptions = {} } = definition; const rectangle = L.rectangle( [ [southWest.lat, southWest.lng], [northEast.lat, northEast.lng], ], - { ...rawOptions, ...bridgeOptions } + { ...bridgeOptions } ).addTo(this.map); - /** - * @deprecated since Symfony UX Map 2.29 - */ - if (title) { - rectangle.bindPopup(title); - } - if (infoWindow) { this.createInfoWindow({ definition: infoWindow, element: rectangle }); } @@ -269,9 +240,9 @@ export default class extends AbstractMapController< definition: Omit, 'position'>; element: L.Marker | L.Polygon | L.Polyline | L.Circle | L.Rectangle; }): L.Popup { - const { headerContent, content, opened, autoClose, rawOptions = {}, bridgeOptions = {} } = definition; + const { headerContent, content, opened, autoClose, bridgeOptions = {} } = definition; - element.bindPopup([headerContent, content].filter((x) => x).join('
'), { ...rawOptions, ...bridgeOptions }); + element.bindPopup([headerContent, content].filter((x) => x).join('
'), { ...bridgeOptions }); if (opened) { if (autoClose) { diff --git a/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set with circles and infoWindows__1.txt b/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set with circles and infoWindows__1.txt index e473b116a21..5d6780a8ee4 100644 --- a/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set with circles and infoWindows__1.txt +++ b/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set with circles and infoWindows__1.txt @@ -10,6 +10,6 @@ data-symfony--ux-leaflet-map--map-markers-value="[]" data-symfony--ux-leaflet-map--map-polygons-value="[]" data-symfony--ux-leaflet-map--map-polylines-value="[]" - data-symfony--ux-leaflet-map--map-circles-value="[{"center":{"lat":48.8566,"lng":2.3522},"radius":1000000,"title":null,"infoWindow":null,"extra":[],"id":"circle1","@id":"ead7389af3a04828"},{"center":{"lat":1.1,"lng":2.2},"radius":500,"title":null,"infoWindow":{"headerContent":null,"content":"Circle","position":null,"opened":false,"autoClose":true,"extra":[]},"extra":[],"id":"circle2","@id":"4953b5cc1d5759f4"}]" + data-symfony--ux-leaflet-map--map-circles-value="[{"center":{"lat":48.8566,"lng":2.3522},"radius":1000000,"infoWindow":null,"extra":[],"id":"circle1","@id":"f00392924107cd68"},{"center":{"lat":1.1,"lng":2.2},"radius":500,"infoWindow":{"headerContent":null,"content":"Circle","position":null,"opened":false,"autoClose":true,"extra":[]},"extra":[],"id":"circle2","@id":"83d44e42d997865b"}]" data-symfony--ux-leaflet-map--map-rectangles-value="[]" > \ No newline at end of file diff --git a/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set with polygons and infoWindows__1.txt b/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set with polygons and infoWindows__1.txt index 6499703a408..709f8758fef 100644 --- a/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set with polygons and infoWindows__1.txt +++ b/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set with polygons and infoWindows__1.txt @@ -8,7 +8,7 @@ data-symfony--ux-leaflet-map--map-fit-bounds-to-markers-value="false" data-symfony--ux-leaflet-map--map-options-value="{"tileLayer":{"url":"https:\/\/tile.openstreetmap.org\/{z}\/{x}\/{y}.png","attribution":"\u00a9 <a href=\"https:\/\/www.openstreetmap.org\/copyright\">OpenStreetMap<\/a>","options":[]},"attributionControlOptions":{"position":"bottomright","prefix":"Leaflet"},"zoomControlOptions":{"position":"topleft","zoomInText":"<span aria-hidden=\"true\">+<\/span>","zoomInTitle":"Zoom in","zoomOutText":"<span aria-hidden=\"true\">&#x2212;<\/span>","zoomOutTitle":"Zoom out"},"@provider":"leaflet"}" data-symfony--ux-leaflet-map--map-markers-value="[]" - data-symfony--ux-leaflet-map--map-polygons-value="[{"points":[{"lat":48.8566,"lng":2.3522},{"lat":48.8566,"lng":2.3522},{"lat":48.8566,"lng":2.3522}],"title":null,"infoWindow":null,"extra":[],"id":"polygon1","@id":"35bfa920335b849d"},{"points":[{"lat":1.1,"lng":2.2},{"lat":3.3,"lng":4.4},{"lat":5.5,"lng":6.6}],"title":null,"infoWindow":{"headerContent":null,"content":"Polygon","position":null,"opened":false,"autoClose":true,"extra":[]},"extra":[],"id":"polygon2","@id":"7be1fe9f10489d73"}]" + data-symfony--ux-leaflet-map--map-polygons-value="[{"points":[{"lat":48.8566,"lng":2.3522},{"lat":48.8566,"lng":2.3522},{"lat":48.8566,"lng":2.3522}],"infoWindow":null,"extra":[],"id":"polygon1","@id":"721e947a2b4d653d"},{"points":[{"lat":1.1,"lng":2.2},{"lat":3.3,"lng":4.4},{"lat":5.5,"lng":6.6}],"infoWindow":{"headerContent":null,"content":"Polygon","position":null,"opened":false,"autoClose":true,"extra":[]},"extra":[],"id":"polygon2","@id":"8950ef514315374c"}]" data-symfony--ux-leaflet-map--map-polylines-value="[]" data-symfony--ux-leaflet-map--map-circles-value="[]" data-symfony--ux-leaflet-map--map-rectangles-value="[]" diff --git a/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set with polylines and infoWindows__1.txt b/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set with polylines and infoWindows__1.txt index 176a7c6924f..0fd2381cd90 100644 --- a/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set with polylines and infoWindows__1.txt +++ b/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set with polylines and infoWindows__1.txt @@ -9,7 +9,7 @@ data-symfony--ux-leaflet-map--map-options-value="{"tileLayer":{"url":"https:\/\/tile.openstreetmap.org\/{z}\/{x}\/{y}.png","attribution":"\u00a9 <a href=\"https:\/\/www.openstreetmap.org\/copyright\">OpenStreetMap<\/a>","options":[]},"attributionControlOptions":{"position":"bottomright","prefix":"Leaflet"},"zoomControlOptions":{"position":"topleft","zoomInText":"<span aria-hidden=\"true\">+<\/span>","zoomInTitle":"Zoom in","zoomOutText":"<span aria-hidden=\"true\">&#x2212;<\/span>","zoomOutTitle":"Zoom out"},"@provider":"leaflet"}" data-symfony--ux-leaflet-map--map-markers-value="[]" data-symfony--ux-leaflet-map--map-polygons-value="[]" - data-symfony--ux-leaflet-map--map-polylines-value="[{"points":[{"lat":48.8566,"lng":2.3522},{"lat":48.8566,"lng":2.3522},{"lat":48.8566,"lng":2.3522}],"title":null,"infoWindow":null,"extra":[],"id":"polyline1","@id":"823f6ee5acdb5db3"},{"points":[{"lat":1.1,"lng":2.2},{"lat":3.3,"lng":4.4},{"lat":5.5,"lng":6.6}],"title":null,"infoWindow":{"headerContent":null,"content":"Polyline","position":null,"opened":false,"autoClose":true,"extra":[]},"extra":[],"id":"polyline2","@id":"77fb0e390b5e91f1"}]" + data-symfony--ux-leaflet-map--map-polylines-value="[{"points":[{"lat":48.8566,"lng":2.3522},{"lat":48.8566,"lng":2.3522},{"lat":48.8566,"lng":2.3522}],"infoWindow":null,"extra":[],"id":"polyline1","@id":"dbdc5cfcc64477c9"},{"points":[{"lat":1.1,"lng":2.2},{"lat":3.3,"lng":4.4},{"lat":5.5,"lng":6.6}],"infoWindow":{"headerContent":null,"content":"Polyline","position":null,"opened":false,"autoClose":true,"extra":[]},"extra":[],"id":"polyline2","@id":"785321e0c8d31eec"}]" data-symfony--ux-leaflet-map--map-circles-value="[]" data-symfony--ux-leaflet-map--map-rectangles-value="[]" > \ No newline at end of file diff --git a/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set with rectangles and infoWindows__1.txt b/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set with rectangles and infoWindows__1.txt index 7375a4397fd..97583a7e14d 100644 --- a/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set with rectangles and infoWindows__1.txt +++ b/src/Map/src/Bridge/Leaflet/tests/__snapshots__/LeafletRendererTest__testRenderMap with data set with rectangles and infoWindows__1.txt @@ -11,5 +11,5 @@ data-symfony--ux-leaflet-map--map-polygons-value="[]" data-symfony--ux-leaflet-map--map-polylines-value="[]" data-symfony--ux-leaflet-map--map-circles-value="[]" - data-symfony--ux-leaflet-map--map-rectangles-value="[{"southWest":{"lat":48.8566,"lng":2.3522},"northEast":{"lat":48.8566,"lng":2.3522},"title":null,"infoWindow":null,"extra":[],"id":"rectangle1","@id":"2ee3f2ebdef84b13"},{"southWest":{"lat":1.1,"lng":2.2},"northEast":{"lat":3.3,"lng":4.4},"title":null,"infoWindow":{"headerContent":null,"content":"Rectangle","position":null,"opened":false,"autoClose":true,"extra":[]},"extra":[],"id":"rectangle2","@id":"2549f5a73ef6bee7"}]" + data-symfony--ux-leaflet-map--map-rectangles-value="[{"southWest":{"lat":48.8566,"lng":2.3522},"northEast":{"lat":48.8566,"lng":2.3522},"infoWindow":null,"extra":[],"id":"rectangle1","@id":"a332f101dda4df96"},{"southWest":{"lat":1.1,"lng":2.2},"northEast":{"lat":3.3,"lng":4.4},"infoWindow":{"headerContent":null,"content":"Rectangle","position":null,"opened":false,"autoClose":true,"extra":[]},"extra":[],"id":"rectangle2","@id":"7d501fb4cec964b1"}]" > \ No newline at end of file diff --git a/src/Map/src/Circle.php b/src/Map/src/Circle.php index 76844a5dfae..caca0bcad95 100644 --- a/src/Map/src/Circle.php +++ b/src/Map/src/Circle.php @@ -29,15 +29,10 @@ final class Circle implements Element public function __construct( public readonly Point $center, public readonly float $radius, - public readonly ?string $title = null, public readonly ?InfoWindow $infoWindow = null, public readonly array $extra = [], public readonly ?string $id = null, ) { - if (null !== $title) { - trigger_deprecation('symfony/ux-map', '2.30', 'The "title" parameter is deprecated and will be removed in 3.0. Use "infoWindow" instead.'); - } - if ($radius <= 0) { throw new InvalidArgumentException(\sprintf('Radius must be greater than 0, "%s" given.', $radius)); } @@ -60,7 +55,6 @@ public function toArray(): array return [ 'center' => $this->center->toArray(), 'radius' => $this->radius, - 'title' => $this->title, 'infoWindow' => $this->infoWindow?->toArray(), 'extra' => $this->extra, 'id' => $this->id, diff --git a/src/Map/src/Polygon.php b/src/Map/src/Polygon.php index 068be69eb35..41ffff677c2 100644 --- a/src/Map/src/Polygon.php +++ b/src/Map/src/Polygon.php @@ -28,14 +28,10 @@ final class Polygon implements Element */ public function __construct( private readonly array $points, - private readonly ?string $title = null, private readonly ?InfoWindow $infoWindow = null, private readonly array $extra = [], public readonly ?string $id = null, ) { - if (null !== $title) { - trigger_deprecation('symfony/ux-map', '2.30', 'The "title" parameter is deprecated and will be removed in 3.0. Use "infoWindow" instead.'); - } } /** @@ -55,7 +51,6 @@ public function toArray(): array 'points' => current($this->points) instanceof Point ? array_map(fn (Point $point) => $point->toArray(), $this->points) : array_map(fn (array $path) => array_map(fn (Point $point) => $point->toArray(), $path), $this->points), - 'title' => $this->title, 'infoWindow' => $this->infoWindow?->toArray(), 'extra' => $this->extra, 'id' => $this->id, diff --git a/src/Map/src/Polyline.php b/src/Map/src/Polyline.php index 33ba0375d8c..ea9697956d8 100644 --- a/src/Map/src/Polyline.php +++ b/src/Map/src/Polyline.php @@ -27,14 +27,10 @@ final class Polyline implements Element */ public function __construct( private readonly array $points, - private readonly ?string $title = null, private readonly ?InfoWindow $infoWindow = null, private readonly array $extra = [], public readonly ?string $id = null, ) { - if (null !== $title) { - trigger_deprecation('symfony/ux-map', '2.30', 'The "title" parameter is deprecated and will be removed in 3.0. Use "infoWindow" instead.'); - } } /** @@ -52,7 +48,6 @@ public function toArray(): array { return [ 'points' => array_map(fn (Point $point) => $point->toArray(), $this->points), - 'title' => $this->title, 'infoWindow' => $this->infoWindow?->toArray(), 'extra' => $this->extra, 'id' => $this->id, diff --git a/src/Map/src/Rectangle.php b/src/Map/src/Rectangle.php index 7212d4af028..afd5cc51419 100644 --- a/src/Map/src/Rectangle.php +++ b/src/Map/src/Rectangle.php @@ -28,14 +28,10 @@ final class Rectangle implements Element public function __construct( public readonly Point $southWest, public readonly Point $northEast, - public readonly ?string $title = null, public readonly ?InfoWindow $infoWindow = null, public readonly array $extra = [], public readonly ?string $id = null, ) { - if (null !== $title) { - trigger_deprecation('symfony/ux-map', '2.30', 'The "title" parameter is deprecated and will be removed in 3.0. Use "infoWindow" instead.'); - } } /** @@ -55,7 +51,6 @@ public function toArray(): array return [ 'southWest' => $this->southWest->toArray(), 'northEast' => $this->northEast->toArray(), - 'title' => $this->title, 'infoWindow' => $this->infoWindow?->toArray(), 'extra' => $this->extra, 'id' => $this->id, diff --git a/src/Map/src/Twig/MapExtension.php b/src/Map/src/Twig/MapExtension.php index 6442ff1b340..f0be9f47084 100644 --- a/src/Map/src/Twig/MapExtension.php +++ b/src/Map/src/Twig/MapExtension.php @@ -11,7 +11,6 @@ namespace Symfony\UX\Map\Twig; -use Twig\DeprecatedCallableInfo; use Twig\Extension\AbstractExtension; use Twig\TwigFunction; @@ -25,12 +24,6 @@ final class MapExtension extends AbstractExtension public function getFunctions(): array { return [ - new TwigFunction('render_map', [MapRuntime::class, 'renderMap'], [ - 'is_safe' => ['html'], - ...(class_exists(DeprecatedCallableInfo::class) - ? ['deprecation_info' => new DeprecatedCallableInfo('symfony/ux-map', '2.20', 'ux_map')] - : ['deprecated' => '2.20', 'deprecating_package' => 'symfony/ux-map', 'alternative' => 'ux_map']), - ]), new TwigFunction('ux_map', [MapRuntime::class, 'renderMap'], ['is_safe' => ['html']]), ]; } diff --git a/src/Map/tests/CircleTest.php b/src/Map/tests/CircleTest.php index 21753783480..38d7caa5dc3 100644 --- a/src/Map/tests/CircleTest.php +++ b/src/Map/tests/CircleTest.php @@ -36,7 +36,6 @@ public function testToArray() self::assertSame([ 'center' => ['lat' => 1.1, 'lng' => 2.2], 'radius' => 500.0, - 'title' => null, 'infoWindow' => [ 'headerContent' => 'info content', 'content' => null, @@ -55,7 +54,6 @@ public function testFromArray() $data = [ 'center' => ['lat' => 1.1, 'lng' => 2.2], 'radius' => 500, - 'title' => null, 'infoWindow' => ['content' => 'info content'], 'extra' => ['foo' => 'bar'], 'id' => 'circle1', @@ -69,7 +67,6 @@ public function testFromArray() self::assertSame([ 'center' => ['lat' => 1.1, 'lng' => 2.2], 'radius' => 500.0, - 'title' => null, 'infoWindow' => [ 'headerContent' => null, 'content' => 'info content', diff --git a/src/Map/tests/MapFactoryTest.php b/src/Map/tests/MapFactoryTest.php index 726360e8316..e4368a95c6a 100644 --- a/src/Map/tests/MapFactoryTest.php +++ b/src/Map/tests/MapFactoryTest.php @@ -50,14 +50,12 @@ public function testFromArray() $this->assertCount(1, $polygons = $map->toArray()['polygons']); $this->assertEquals($array['polygons'][0]['points'], $polygons[0]['points']); $this->assertEquals($array['polygons'][0]['points'], $polygons[0]['points']); - $this->assertSame($array['polygons'][0]['title'], $polygons[0]['title']); $this->assertSame($array['polygons'][0]['infoWindow']['headerContent'], $polygons[0]['infoWindow']['headerContent']); $this->assertSame($array['polygons'][0]['infoWindow']['content'], $polygons[0]['infoWindow']['content']); $this->assertCount(1, $polylines = $map->toArray()['polylines']); $this->assertEquals($array['polylines'][0]['points'], $polylines[0]['points']); $this->assertEquals($array['polylines'][0]['points'], $polylines[0]['points']); - $this->assertSame($array['polylines'][0]['title'], $polylines[0]['title']); $this->assertSame($array['polylines'][0]['infoWindow']['headerContent'], $polylines[0]['infoWindow']['headerContent']); $this->assertSame($array['polylines'][0]['infoWindow']['content'], $polylines[0]['infoWindow']['content']); } @@ -221,7 +219,6 @@ private static function createMapArray(): array 'lng' => 2.3522, ], ], - 'title' => null, 'infoWindow' => [ 'headerContent' => 'Polygon 1', 'content' => 'Polygon 1', @@ -244,7 +241,6 @@ private static function createMapArray(): array 'lng' => 2.3522, ], ], - 'title' => null, 'infoWindow' => [ 'headerContent' => 'Polyline 1', 'content' => 'Polyline 1', diff --git a/src/Map/tests/MapTest.php b/src/Map/tests/MapTest.php index c5ed272faa2..1008e141279 100644 --- a/src/Map/tests/MapTest.php +++ b/src/Map/tests/MapTest.php @@ -289,7 +289,6 @@ public function testWithMaximumConfiguration() ['lat' => 48.853, 'lng' => 2.3499], ['lat' => 48.8566, 'lng' => 2.3522], ], - 'title' => null, 'infoWindow' => null, 'extra' => [], 'id' => null, @@ -300,7 +299,6 @@ public function testWithMaximumConfiguration() ['lat' => 45.75, 'lng' => 4.85], ['lat' => 45.77, 'lng' => 4.82], ], - 'title' => null, 'infoWindow' => [ 'headerContent' => 'Polygon 2', 'content' => 'A polygon around Lyon with some additional info.', @@ -320,7 +318,6 @@ public function testWithMaximumConfiguration() ['lat' => 48.853, 'lng' => 2.3499], ['lat' => 48.8566, 'lng' => 2.3522], ], - 'title' => null, 'infoWindow' => null, 'extra' => [], 'id' => null, @@ -331,7 +328,6 @@ public function testWithMaximumConfiguration() ['lat' => 45.75, 'lng' => 4.85], ['lat' => 45.77, 'lng' => 4.82], ], - 'title' => null, 'infoWindow' => [ 'headerContent' => 'Polyline 2', 'content' => 'A polyline around Lyon with some additional info.', @@ -348,7 +344,6 @@ public function testWithMaximumConfiguration() [ 'center' => ['lat' => 48.8566, 'lng' => 2.3522], 'radius' => 500, - 'title' => null, 'infoWindow' => [ 'headerContent' => 'Circle around Paris', 'content' => 'A circle with a radius of 500 meters around Paris.', @@ -363,7 +358,6 @@ public function testWithMaximumConfiguration() [ 'center' => ['lat' => 45.764, 'lng' => 4.8357], 'radius' => 300, - 'title' => null, 'infoWindow' => [ 'headerContent' => 'Circle around Lyon', 'content' => 'A circle with a radius of 300 meters around Lyon.', @@ -380,7 +374,6 @@ public function testWithMaximumConfiguration() [ 'southWest' => ['lat' => 48.853, 'lng' => 2.3499], 'northEast' => ['lat' => 48.8566, 'lng' => 2.3522], - 'title' => null, 'infoWindow' => [ 'headerContent' => 'Rectangle around Paris', 'content' => 'A rectangle around Paris.', @@ -395,7 +388,6 @@ public function testWithMaximumConfiguration() [ 'southWest' => ['lat' => 45.75, 'lng' => 4.85], 'northEast' => ['lat' => 45.77, 'lng' => 4.82], - 'title' => null, 'infoWindow' => [ 'headerContent' => 'Rectangle around Lyon', 'content' => 'A rectangle around Lyon.', diff --git a/src/Map/tests/PolygonTest.php b/src/Map/tests/PolygonTest.php index 88d81475bfc..e9c68ada2b1 100644 --- a/src/Map/tests/PolygonTest.php +++ b/src/Map/tests/PolygonTest.php @@ -36,7 +36,6 @@ public function testToArray() $array = $polygon->toArray(); $this->assertSame([ 'points' => [['lat' => 1.1, 'lng' => 2.2], ['lat' => 3.3, 'lng' => 4.4]], - 'title' => null, 'infoWindow' => [ 'headerContent' => 'info content', 'content' => null, @@ -66,7 +65,6 @@ public function testToArrayMultidimensional() [['lat' => 1.1, 'lng' => 2.2], ['lat' => 3.3, 'lng' => 4.4]], [['lat' => 5.5, 'lng' => 6.6]], ], - 'title' => null, 'infoWindow' => null, 'extra' => $array['extra'], 'id' => null, @@ -91,7 +89,6 @@ public function testFromArray() $array = $polygon->toArray(); $this->assertSame([ 'points' => [['lat' => 1.1, 'lng' => 2.2], ['lat' => 3.3, 'lng' => 4.4]], - 'title' => null, 'infoWindow' => [ 'headerContent' => null, 'content' => 'info content', @@ -127,7 +124,6 @@ public function testFromArrayMultidimensional() [['lat' => 1.1, 'lng' => 2.2], ['lat' => 3.3, 'lng' => 4.4]], [['lat' => 5.5, 'lng' => 6.6]], ], - 'title' => null, 'infoWindow' => [ 'headerContent' => null, 'content' => 'info content', diff --git a/src/Map/tests/RectangleTest.php b/src/Map/tests/RectangleTest.php index d4c3a2a2234..7c242b84da9 100644 --- a/src/Map/tests/RectangleTest.php +++ b/src/Map/tests/RectangleTest.php @@ -26,13 +26,12 @@ public function testToArray() $southWest = new Point(1.0, 2.0); $northEast = new Point(3.0, 4.0); - $rectangle = new Rectangle($southWest, $northEast, null, $infoWindow, ['foo' => 'bar'], 'rect1'); + $rectangle = new Rectangle($southWest, $northEast, $infoWindow, ['foo' => 'bar'], 'rect1'); $array = $rectangle->toArray(); self::assertSame([ 'southWest' => ['lat' => 1.0, 'lng' => 2.0], 'northEast' => ['lat' => 3.0, 'lng' => 4.0], - 'title' => null, 'infoWindow' => $infoWindow->toArray(), 'extra' => ['foo' => 'bar'], 'id' => 'rect1', @@ -44,7 +43,6 @@ public function testFromArray() $data = [ 'southWest' => ['lat' => 1.0, 'lng' => 2.0], 'northEast' => ['lat' => 3.0, 'lng' => 4.0], - 'title' => null, 'infoWindow' => ['content' => 'Hello'], 'extra' => ['foo' => 'bar'], 'id' => 'rect1', @@ -56,7 +54,6 @@ public function testFromArray() self::assertSame([ 'southWest' => ['lat' => 1.0, 'lng' => 2.0], 'northEast' => ['lat' => 3.0, 'lng' => 4.0], - 'title' => null, 'infoWindow' => [ 'headerContent' => null, 'content' => 'Hello',