function _gmap_pre_render_map in GMap Module 7
Same name and namespace in other branches
- 7.2 gmap.module \_gmap_pre_render_map()
Pre render function to make sure all required JS is available.
1 string reference to '_gmap_pre_render_map'
- gmap_element_info in ./
gmap.module - Implement hook_element_info().
File
- ./
gmap.module, line 695 - GMap -- Routines to use the Google Maps API in Drupal.
Code
function _gmap_pre_render_map($element) {
$path = drupal_get_path('module', 'gmap') . '/js';
if (!isset($element['#gmap_settings'])) {
$element['#gmap_settings'] = $element['#settings'];
}
$map = $element['#gmap_settings'];
if (isset($map['behavior']['locpick']) && $map['behavior']['locpick']) {
$element['#attached']['js']["{$path}/locpick.js"] = array(
'weight' => 2,
);
}
if (!empty($map['markers']) || !empty($map['lines'])) {
$element['#attached']['js']["{$path}/markerloader_static.js"] = array(
'weight' => 5,
);
}
if (!empty($map['shapes'])) {
$element['#attached']['js']["{$path}/shapeloader_static.js"] = array(
'weight' => 5,
);
$element['#attached']['js']["{$path}/gmap_shapes.js"] = array(
'weight' => 5,
);
}
if (isset($map['feed']) && is_array($map['feed'])) {
$element['#attached']['js']["{$path}/markerloader_georss.js"] = array(
'weight' => 5,
);
}
return $element;
}