Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This one is part of META issue #1931138: Fixing all 'single marker' issues
I'm adding a gmap from a .tpl, this is my code:
$map = array();
$map['markers'] = $markers;
$element = array(
'#type' => 'gmap',
'#gmap_settings' => $map,
);
$output = drupal_render($element);
print_r($output);
The map is loaded succesfully but the JS libraries are being added twice on header. My temporary workaround was to comment line 983 from gmap.module.
// Track the mapids we've used already.
static $mapids = array();
//_gmap_doheader(); <-- comment this line
$mapid = FALSE;
if (isset($element['#map']) && $element['#map']) {
Comments
Comment #1
johnvIMO this is introduced in commit #1061444-64: Javascript is required to view this map.: missing gmap_markers.js.
See also it's initial analysis in #13.
several functions do the same:
- function _gmap_base_js()
- _gmap_doheader()
- gmap_gmap()
Comment #2
podarokcan anyone provide a working patch for fixing this?
Comment #3
johnv@podarok, is the proposed solution the right one?
Comment #4
podarok#3 looks like not right
we should check already included js or not and do the right addition
Comment #5
johnvSo, I'll count this as 'no patch'.
Comment #5.0
johnvAdded line commented
Comment #6
johnvThis is fixed here: #1931138-29: Fixing all 'single marker' issues
Comment #7.0
(not verified) CreditAttribution: commentedUpdated issue summary.