You are here

function _gmap_base_js in GMap Module 7

Same name and namespace in other branches
  1. 7.2 gmap.module \_gmap_base_js()

Get the basic js files needed for a GMap.

1 call to _gmap_base_js()
gmap_element_info in ./gmap.module
Implement hook_element_info().

File

./gmap.module, line 279
GMap -- Routines to use the Google Maps API in Drupal.

Code

function _gmap_base_js() {
  $ret = array();
  $path = drupal_get_path('module', 'gmap');
  $ret[$path . '/js/gmap.js'] = array(
    'weight' => 1,
  );
  $ret[$path . '/js/icon.js'] = array(
    'weight' => 2,
  );

  /*
    $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']);
    }
  */
  $ret[$path . '/js/marker.js'] = array(
    'weight' => 2,
  );
  $ret[$path . '/js/highlight.js'] = array(
    'weight' => 2,
  );

  // Add the markermanager.
  // @@@TODO Need to allow multiple inclusion and have marker manager set at the map level.
  $mm = variable_get('gmap_mm_type', 'gmap');
  $mms = variable_get('gmap_markermanager', array());
  if (isset($mms[$mm]['filename'])) {
    $ret[$path . '/thirdparty/' . $mms[$mm]['filename']] = array(
      'weight' => 3,
    );
  }
  $ret[$path . '/js/' . $mm . '_marker.js'] = array(
    'weight' => 4,
  );

  /*
    drupal_add_js(array('gmap_markermanager' => $mms[$mm]), 'setting');
  */
  $ret[$path . '/js/poly.js'] = array(
    'weight' => 3,
  );
  global $language;
  $query = array(
    'file' => 'api',
    'v' => variable_get('gmap_api_version', GMAP_API_VERSION),
    'key' => gmap_get_key(),
    'hl' => $language->language,
  );
  $ret[url(gmap_views_protocol() . '://maps.google.com/maps', array(
    'query' => $query,
  ))] = array(
    'type' => 'external',
  );
  $ret[file_create_url('public://js/gmap_markers.js')] = array(
    'type' => 'external',
    'weight' => 2,
  );
  return $ret;
}