Custom marker image is not displayed

Created on 23 April 2024, 8 months ago
Updated 9 June 2024, 7 months ago

Drupal 10.2.4

Problem/Motivation

Custom marker image is not displayed.

Steps to reproduce

  1. Upgrade styled_google_map 1.6 -> 2.3
  2. Add a new field with the type "Geofield" to some entity
  3. Manage entity's display. Use the field formatter - Styled Google Maps
  4. Update settings for the Styled Google Maps field formatter - set the field "Pin style" to, for instance, /themes/MY_THEME_NAME/assets/img/marker.png
  5. Add an entity and fill out the Geofield
  6. On the entity view page custom marker is not displayed

Looks like it's caused because of the following code:
styled_google_map/js/styled-google-map.js

if (map_settings.style.pin_width !== '' && map_settings.style.pin_height !== '') {
                icon = {
                  url: map_locations[j].pin,
                  scaledSize: new google.maps.Size(map_settings.style.pin_width, map_settings.style.pin_height)
                }
              }

This condition applies even if map_settings.style.pin_width is undefined.

πŸ› Bug report
Status

Fixed

Version

2.3

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine max-kuzomko

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024