function _gmap_doheader in GMap Module 6
Same name and namespace in other branches
- 5 gmap.module \_gmap_doheader()
- 6.2 gmap.module \_gmap_doheader()
- 7.2 gmap.module \_gmap_doheader()
- 7 gmap.module \_gmap_doheader()
Set up the HTML header for GMap. If you are going to include a custom JS file that extends GMap, you probabaly want to call this first to ensure that the core js files have been added.
1 call to _gmap_doheader()
- theme_gmap in ./
gmap.module - Gmap element theme hook
File
- ./
gmap.module, line 289 - GMap -- Routines to use the Google Maps API in Drupal.
Code
function _gmap_doheader() {
static $gmap_initialized = FALSE;
if ($gmap_initialized) {
return;
}
$gmap_path = drupal_get_path('module', 'gmap');
drupal_add_css($gmap_path . '/gmap.css');
drupal_add_js($gmap_path . '/js/gmap.js');
$mm = variable_get('gmap_mm_type', 'gmap');
$mms = variable_get('gmap_markermanager', array());
if (empty($mms[$mm])) {
$mms[$mm] = array();
}
// If you really really want to override the marker manager, implement
// this, take $mm by ref, and have fun. --Bdragon
if (function_exists('_gmap_markermanager_override')) {
_gmap_markermanager_override($mm, $mms);
}
if ($mm == 'clusterer' || $mm == 'clustermarker') {
// Needed for access to clusterer marker.
drupal_add_js($gmap_path . '/js/icon.js');
}
if (isset($mms[$mm]['filename'])) {
drupal_add_js($gmap_path . '/thirdparty/' . $mms[$mm]['filename']);
}
drupal_add_js($gmap_path . '/js/marker.js');
drupal_add_js($gmap_path . '/js/highlight.js');
drupal_add_js($gmap_path . '/js/' . $mm . '_marker.js');
drupal_add_js(array(
'gmap_markermanager' => $mms[$mm],
), 'setting');
// @@@
drupal_add_js($gmap_path . '/js/poly.js');
global $language;
$query = array(
'file' => 'api',
'v' => variable_get('gmap_api_version', GMAP_API_VERSION),
'key' => gmap_get_key(),
'hl' => $language->language,
);
drupal_set_html_head('<script src="' . check_url(url('http://maps.google.com/maps', array(
'query' => $query,
))) . '" type="text/javascript"></script>');
$gmap_initialized = TRUE;
}