Skip to content
Snippets Groups Projects
Commit cbdee739 authored by Brandon Bergren's avatar Brandon Bergren
Browse files

#291162, part 2: Fix how the mapid is determined.

parent ea62c4d0
No related branches found
No related tags found
No related merge requests found
......@@ -1103,21 +1103,31 @@ function theme_gmap_align($element) {
function theme_gmap($element) {
_gmap_doheader();
// Stuff moved from expand_gmap().
// @@@ Clean this up once and for all...
$mapid = 'map';
$mapid = FALSE;
if ($element['#map']) {
// The default mapid is #map.
$mapid = $element['#map'];
}
else {
$element['#map'] = $mapid;
if (isset($element['#settings']['id'])) {
// Settings overrides it.
$mapid = $element['#settings']['id'];
}
if (!$mapid) {
// Hmm, no mapid. Generate one.
$mapid = gmap_get_auto_mapid();
}
// Push the mapid back into #map.
$element['#map'] = $mapid;
gmap_widget_setup($element, 'gmap');
gmap_widget_setup($element, 'gmap', $mapid);
if (!$element['#settings']) {
$element['#settings'] = array();
}
// Push the mapid back into #settings.
$element['#settings']['id'] = $mapid;
$map = array_merge(gmap_defaults(), $element['#settings']);
gmap_map_cleanup($map);
......@@ -1137,7 +1147,7 @@ function theme_gmap($element) {
$style[] = 'width: '. $map['width'];
$style[] = 'height: '. $map['height'];
$element['#attributes']['class'] = trim($element['#attributes']['class'] .'gmap gmap-map gmap-'. $element['#map'] .'-gmap');
$element['#attributes']['class'] = trim($element['#attributes']['class'] .'gmap gmap-map gmap-'. $mapid .'-gmap');
// Some markup parsers (IE) don't handle empty inners well. Use the space to let users know javascript is required.
// @@@ Bevan sez: Google static maps could be useful here.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment