-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgmapbox.module
51 lines (49 loc) · 1.43 KB
/
gmapbox.module
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
function gmapbox_maptypes() {
$map = array();
$map['dc-nightvision'] = array(
'title' => t('DC Nightvision'),
'default' => TRUE,
'help' => t('DC Nightvision. Internal name: dc-nightvision'),
'minzoom' => '',
);
$map['congressional-districts-110'] = array(
'title' => t('US Congressional Districts'),
'default' => TRUE,
'help' => t('US Congressional Districts. Internal name: us-congressional-districts'),
'minzoom' => '',
);
$map['world-dark'] = array(
'title' => t('World - Dark'),
'default' => TRUE,
'help' => t('World - Dark Internal name: world-dark'),
'minzoom' => '',
);
return $map;
}
/**
* Implementation of hook_gmap
*/
function gmapbox_gmap($op, &$map) {
$maptypes = gmapbox_maptypes();
switch ($op) {
case 'pre_theme_map':
drupal_add_js(array(
'gmapbox' => array(
'mapdefs' => $maptypes,
'img' => drupal_get_path('module', 'gmapbox') . '/assets/mapbox.png',
),
),
'setting'
);
drupal_add_js(drupal_get_path('module', 'gmapbox') .'/gmapbox.js');
$js = 'http://mapbox-js.s3.amazonaws.com/g/2/mapbox.js';
drupal_add_js('document.write(unescape("%3Cscript src=\''. $js . '\' type=\'text/javascript\'%3E%3C/script%3E"));', 'inline');
break;
case 'baselayers':
foreach($maptypes as $name => $params) {
$map['MapBox'][$name] = $params;
}
break;
}
}