function getlocations_mapbox_settings_form in Get Locations 7
Same name and namespace in other branches
- 7.2 modules/getlocations_mapbox/getlocations_mapbox.module \getlocations_mapbox_settings_form()
1 call to getlocations_mapbox_settings_form()
- getlocations_leaflet_settings_form in modules/
getlocations_leaflet/ getlocations_leaflet.module - Function
File
- modules/
getlocations_mapbox/ getlocations_mapbox.module, line 34 - getlocations_mapbox.module @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL
Code
function getlocations_mapbox_settings_form() {
$form = array();
// mapbox
$getlocations_leaflet_mapbox = variable_get('getlocations_leaflet_mapbox', array(
'mapbox_info' => array(),
));
$mapnum = count($getlocations_leaflet_mapbox['mapbox_info']);
$form['getlocations_leaflet_mapbox'] = array(
'#type' => 'fieldset',
'#title' => t('MapBox maps'),
// This will store all the defaults in one variable.
'#tree' => TRUE,
'#collapsible' => TRUE,
'#collapsed' => $mapnum ? FALSE : TRUE,
);
if ($mapnum == 0) {
$mapnum = 2;
}
else {
$mapnum++;
}
for ($ct = 0; $ct < $mapnum; $ct++) {
$form['getlocations_leaflet_mapbox']['mapbox_info'][$ct]['label'] = getlocations_element_map_tf(t('Name of map @n', array(
'@n' => $ct + 1,
)), isset($getlocations_leaflet_mapbox['mapbox_info'][$ct]['label']) ? $getlocations_leaflet_mapbox['mapbox_info'][$ct]['label'] : '', t('The name of the map, to be shown on selection lists'), 40);
$form['getlocations_leaflet_mapbox']['mapbox_info'][$ct]['key'] = getlocations_element_map_tf(t('Key of map @n', array(
'@n' => $ct + 1,
)), isset($getlocations_leaflet_mapbox['mapbox_info'][$ct]['key']) ? $getlocations_leaflet_mapbox['mapbox_info'][$ct]['key'] : '', t('The identifier provided by <a target="_blank" href="@mapbox">MapBox</a>', array(
'@mapbox' => 'https://www.mapbox.com/',
)), 40);
// token
$form['getlocations_leaflet_mapbox']['mapbox_info'][$ct]['token'] = getlocations_element_map_tf(t('Access token of map @n', array(
'@n' => $ct + 1,
)), isset($getlocations_leaflet_mapbox['mapbox_info'][$ct]['token']) ? $getlocations_leaflet_mapbox['mapbox_info'][$ct]['token'] : '', t('The access token provided by Mapbox.'), 40);
$form['getlocations_leaflet_mapbox']['mapbox_info'][$ct]['type'] = getlocations_element_dd(t('Type of map @n', array(
'@n' => $ct + 1,
)), isset($getlocations_leaflet_mapbox['mapbox_info'][$ct]['type']) ? $getlocations_leaflet_mapbox['mapbox_info'][$ct]['type'] : 'base', array(
'base' => t('Base'),
'overlay' => t('Overlay'),
));
}
// for theme
$form['getlocations_leaflet_mapbox']['mapnum'] = array(
'#type' => 'value',
'#value' => $mapnum,
);
return $form;
}