Because leaflet_widget_leaflet_widget_base_layers() returns a URL starting with http://, using the Leaflet widget will trigger dozens of warnings (or errors depending on your browser's settings) about insecure content for users on a site which implements a secure admin section. The fix for this is to use "//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", instead of "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png". This will make the user's browser use the same protocol that the site is being served through.

I've attached a patch that implement this change. It requires a database update, because the old non-relative URL is saved into the database in the instance settings for each field that's configured to use Leaflet.widget.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

coredumperror’s picture

Here's an updated patch that also incorporates an improved version of rudetrue's suggestion from comment #1 of #1997540: Not compatible with most Leaflet More Maps.

das-peter’s picture

@coredumperror Did you create the patch against the latest dev? I get the error "fatal: corrupt patch at line 78" if I try to apply the patch.

vlooivlerke’s picture

Hi, I patched this manually on latest dev and did the database update and all maps still work.

Now how can I use google maps urlTemplate.

Does this patch bring us closer to achieving this?
Could I change the urlTemplate

'//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'

to

'//{s}.googleapis.com/vt?{x}/{y}/{z}'

e.g a tile in google looks like this //mt1.googleapis.com/vt?x=2306&y=2459&z=12

Or is it better to integrate with leaflet more maps module?

Thanks

coredumperror’s picture

Hmm, I may have accidentally rolled this patch against the latest release code. I'm not using this module any more, though, so someone else will need to re-roll it for the latest dev.

formatC'vt’s picture

re-roll for the latest dev.