Skip to content

Commit fa60799

Browse files
committed
feature #3118 [Map] Display warning when trying to define a custom icon for a Marker that already has an Icon (ker0x)
This PR was merged into the 2.x branch. Discussion ---------- [Map] Display warning when trying to define a custom icon for a `Marker` that already has an `Icon` | Q | A | -------------- | --- | Bug fix? | no | New feature? | feature | Deprecations? | no | Documentation? | no | Issues | Fix #3116 | License | MIT Add additional checks before creating the icon for a marker Commits ------- 6a6b230 [Map] Display warning when trying to define a custom icon for a `Marker` that already has an `Icon`
2 parents dbea936 + 6a6b230 commit fa60799

File tree

6 files changed

+30
-0
lines changed

6 files changed

+30
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# CHANGELOG
22

3+
## 2.31
4+
5+
- Display a warning when trying to define `bridgeOptions.content` for a `Marker` that already has an `Icon`
6+
37
## 2.30
48

59
- Ensure compatibility with PHP 8.5

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: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# CHANGELOG
22

3+
## 2.31
4+
5+
- Display a warning when trying to define `bridgeOptions.icon` for a `Marker` that already has an `Icon`
6+
37
## 2.30
48

59
- Ensure compatibility with PHP 8.5

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)