Skip to content

Commit b3d5c4d

Browse files
ker0xKocal
authored andcommitted
[Map] Display warning when trying to define a custom icon for a Marker that already has an Icon
1 parent b40c59c commit b3d5c4d

File tree

6 files changed

+24
-0
lines changed

6 files changed

+24
-0
lines changed

src/Map/src/Bridge/Google/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## 2.30
44

55
- Ensure compatibility with PHP 8.5
6+
- Display a warning when trying to define `bridgeOptions.content` for a `Marker` that already has an `Icon`
67

78
## 2.29.0
89

src/Map/src/Bridge/Google/assets/dist/map_controller.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,11 @@ var map_controller_default = class extends abstract_map_controller_default {
248248
this.createInfoWindow({ definition: infoWindow, element: marker });
249249
}
250250
if (icon) {
251+
if (Object.prototype.hasOwnProperty.call(bridgeOptions, "content")) {
252+
console.warn('[Symfony UX Map] Defining "bridgeOptions.content" for a marker with a custom icon is not supported and will be ignored.');
253+
} else if (Object.prototype.hasOwnProperty.call(rawOptions, "content")) {
254+
console.warn('[Symfony UX Map] Defining "rawOptions.content" for a marker with a custom icon is not supported and will be ignored.');
255+
}
251256
this.doCreateIcon({ definition: icon, element: marker });
252257
}
253258
return marker;

src/Map/src/Bridge/Google/assets/src/map_controller.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,12 @@ export default class extends AbstractMapController<
188188
}
189189

190190
if (icon) {
191+
if (Object.prototype.hasOwnProperty.call(bridgeOptions, 'content')) {
192+
console.warn('[Symfony UX Map] Defining "bridgeOptions.content" for a marker with a custom icon is not supported and will be ignored.');
193+
} else if (Object.prototype.hasOwnProperty.call(rawOptions, 'content')) {
194+
console.warn('[Symfony UX Map] Defining "rawOptions.content" for a marker with a custom icon is not supported and will be ignored.');
195+
}
196+
191197
this.doCreateIcon({ definition: icon, element: marker });
192198
}
193199

src/Map/src/Bridge/Leaflet/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## 2.30
44

55
- Ensure compatibility with PHP 8.5
6+
- Display a warning when trying to define `bridgeOptions.icon` for a `Marker` that already has an `Icon`
67

78
## 2.29.0
89

src/Map/src/Bridge/Leaflet/assets/dist/map_controller.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,11 @@ var map_controller_default = class extends abstract_map_controller_default {
228228
this.createInfoWindow({ definition: infoWindow, element: marker2 });
229229
}
230230
if (icon2) {
231+
if (Object.prototype.hasOwnProperty.call(bridgeOptions, "icon")) {
232+
console.warn('[Symfony UX Map] Defining "bridgeOptions.icon" for a marker with a custom icon is not supported and will be ignored.');
233+
} else if (Object.prototype.hasOwnProperty.call(rawOptions, "icon")) {
234+
console.warn('[Symfony UX Map] Defining "rawOptions.icon" for a marker with a custom icon is not supported and will be ignored.');
235+
}
231236
this.doCreateIcon({ definition: icon2, element: marker2 });
232237
}
233238
return marker2;

src/Map/src/Bridge/Leaflet/assets/src/map_controller.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,12 @@ export default class extends AbstractMapController<
154154
}
155155

156156
if (icon) {
157+
if (Object.prototype.hasOwnProperty.call(bridgeOptions, 'icon')) {
158+
console.warn('[Symfony UX Map] Defining "bridgeOptions.icon" for a marker with a custom icon is not supported and will be ignored.');
159+
} else if (Object.prototype.hasOwnProperty.call(rawOptions, 'icon')) {
160+
console.warn('[Symfony UX Map] Defining "rawOptions.icon" for a marker with a custom icon is not supported and will be ignored.');
161+
}
162+
157163
this.doCreateIcon({ definition: icon, element: marker });
158164
}
159165

0 commit comments

Comments
 (0)