Problem/Motivation

When adding a custom icon via the backend of Drupal at for example: "/admin/structure/block-content/manage/map/display" but the type doesn't really matter the custom icon is not shown.

This is due to the fact that inside of "LeafletMarkerIcon.js"
we have:

    if (!currentIcon) {
      if (this.settings.marker_icon_path === 'string') {
        iconUrl = this.settings.marker_icon_path;
      } else {
        return;
      }
    } else {
      iconUrl = currentIcon;
    }

This code checks if marker_icon_path is a string, but we should check if typeof marker_icon_path is a string as we did above (more or less):

    if (typeof marker.wrapper !== 'undefined') {
      currentIcon = marker.wrapper.dataset.icon ?? null;
    }

When changing the code to add "typeof" my custom marker icon is shown properly.

leaflet backend settings picture

Steps to reproduce

Utilize a custom marker icon inside of leaflet maps.

Proposed resolution

Add typeof.

Remaining tasks

Review the code

CommentFileSizeAuthor
leaflet1.png128.32 KBmschudders
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mschudders created an issue. See original summary.

mschudders’s picture

it's just this commit: https://git.drupalcode.org/issue/geolocation-3562586/-/commit/9503b5d1dc...
Probably it started of 3.x I guess. Will wait if I need to change.

christianadamski made their first commit to this issue’s fork.

christianadamski’s picture

Status: Needs review » Fixed

Thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.