You are here

function google_map_field_add_maps_api in Google Map Field 7.2

Same name and namespace in other branches
  1. 7 google_map_field.module \google_map_field_add_maps_api()

Helper function to add the Google Maps API.

1 call to google_map_field_add_maps_api()
google_map_field_format_field in ./google_map_field.module
This function formats the google map field for display, called by google_map_field_field_formatter_view().

File

./google_map_field.module, line 411
This file defines all the necessary hooks and functions to create a Google Map Field field type for inserting maps directly into content items (node, entities etc).

Code

function google_map_field_add_maps_api() {
  if (variable_get('google_map_field_apikey', '') != '') {
    $element = array(
      '#type' => 'markup',
      '#markup' => '<script type="text/javascript" src="' . google_map_field_get_protocol() . 'maps.googleapis.com/maps/api/js?key=' . variable_get('google_map_field_apikey', '') . '"></script>',
    );
    drupal_add_html_head($element, 'google_maps_api');
  }
  else {
    drupal_add_js(google_map_field_get_protocol() . 'maps.googleapis.com/maps/api/js', 'external');
  }
}