function openlayers_layer_type_google::render in Openlayers 6.2
Same name and namespace in other branches
- 7.2 plugins/layer_types/openlayers_layer_type_google.inc \openlayers_layer_type_google::render()
Render.
Overrides openlayers_layer_type::render
File
- includes/
layer_types/ google.inc, line 109 - Google Layer Type
Class
- openlayers_layer_type_google
- OpenLayers Google Layer Type class
Code
function render(&$map) {
static $google_maps_included;
if (!isset($google_maps_included)) {
// Include files.
drupal_add_js(drupal_get_path('module', 'openlayers') . '/includes/layer_types/js/google.js');
// Create URL for google include
$url = '//maps.google.com/maps?file=api&sensor=false&v=' . variable_get('openlayers_google_version', '2');
$lang = variable_get('openlayers_layers_google_language', '');
$url .= !empty($lang) ? '&hl=' . $lang : '';
$key = variable_get('openlayers_layers_google_api', variable_get('googlemap_api_key', ''));
$url .= !empty($key) ? '&key=' . $key : '';
drupal_set_html_head('<script src="' . $url . '" type="text/javascript"></script>');
$google_maps_included = TRUE;
}
return $this->options;
}