function ip_geoloc_output_map in IP Geolocation Views & Maps 8
Same name and namespace in other branches
- 7 ip_geoloc_api.inc \ip_geoloc_output_map()
Outputs an HTML div placeholder into which will be injected a map.
The map is centered on the supplied lat,long coordinates. Handy for use in Views.
Parameters
string|float $latitude: e.g. "-37.87" or -37.87
string|float $longitude: e.g. "144.98" or 144.98
string $div_id: id of the div placeholder, can be anything as long as it's unique
string $style: CSS style applied to the div, e.g "height:250px; width:300px"
File
- ./
ip_geoloc_api.inc, line 108 - API functions of IP geolocation module
Code
function ip_geoloc_output_map($latitude, $longitude, $div_id = 'ip-geoloc-map', $style = '', $balloon_text = '') {
drupal_add_js(IP_GEOLOC_GOOGLE_MAPS, array(
'type' => 'external',
'group' => JS_LIBRARY,
));
drupal_add_js(drupal_get_path('module', 'ip_geoloc') . '/js/ip_geoloc_gmap.js');
$script_code = "displayGMap({$latitude}, {$longitude}, '{$div_id}', '{$balloon_text}');";
drupal_add_js($script_code, array(
'type' => 'inline',
'scope' => 'footer',
));
$map_placeholder = "<div id='{$div_id}'" . (empty($style) ? '' : " style='{$style}'") . '></div>';
return $map_placeholder;
}