Download & Extend

Javascript files needed for a GMap are being added twice

Project:GMap Module
Version:7.x-2.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

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

#1

IMO 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()

#2

Version:7.x-2.3» 7.x-2.x-dev
Status:active» needs work

can anyone provide a working patch for fixing this?

#3

@podarok, is the proposed solution the right one?

#4

#3 looks like not right
we should check already included js or not and do the right addition

#5

Status:needs work» active

So, I'll count this as 'no patch'.

#6

Status:active» fixed

This is fixed here: #1931138-29: Fixing all 'single marker' issues

#7

Status:fixed» closed (fixed)

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

nobody click here