function getlocations_cloudmade_settings_form in Get Locations 7
Same name and namespace in other branches
- 7.2 modules/getlocations_cloudmade/getlocations_cloudmade.module \getlocations_cloudmade_settings_form()
1 call to getlocations_cloudmade_settings_form()
- getlocations_leaflet_settings_form in modules/
getlocations_leaflet/ getlocations_leaflet.module - Function
File
- modules/
getlocations_cloudmade/ getlocations_cloudmade.module, line 68 - getlocations_cloudmade.module @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL
Code
function getlocations_cloudmade_settings_form() {
$form = array();
// cloudmade
$getlocations_leaflet_cloudmade = variable_get('getlocations_leaflet_cloudmade', array(
'cloudmade_key' => '',
'cloudmade_maps' => array(),
));
$mapnum = count($getlocations_leaflet_cloudmade['cloudmade_maps']);
$form['getlocations_leaflet_cloudmade'] = array(
'#type' => 'fieldset',
'#title' => t('Cloudmade maps'),
// This will store all the defaults in one variable.
'#tree' => TRUE,
'#collapsible' => TRUE,
'#collapsed' => $mapnum ? FALSE : TRUE,
);
$form['getlocations_leaflet_cloudmade']['cloudmade_key'] = getlocations_element_map_tf(t('CloudMade Developers Key'), $getlocations_leaflet_cloudmade['cloudmade_key'], t('In order to use the <a target="_blank" href="@services">CloudMade services</a>, you must <a target="_blank" href="@key">register and get a key</a> first.', array(
'@services' => 'http://developers.cloudmade.com/projects',
'@key' => 'http://account.cloudmade.com/register',
)), 40);
if ($mapnum == 0) {
$mapnum = 2;
}
else {
$mapnum++;
}
// limit mapnum
if ($mapnum > 5) {
$mapnum = 5;
}
$res = getlocations_cloudmade_get_resolutions();
for ($ct = 0; $ct < $mapnum; $ct++) {
$form['getlocations_leaflet_cloudmade']['cloudmade_maps'][$ct]['style_name'] = getlocations_element_dd(t('Style Name @num', array(
'@num' => $ct + 1,
)), isset($getlocations_leaflet_cloudmade['cloudmade_maps'][$ct]['style_name']) ? $getlocations_leaflet_cloudmade['cloudmade_maps'][$ct]['style_name'] : '', $res, t('"Standard Resolution" is for general use, "High Resolution" is best for tablets, "High Resolution Small tile" is best for smartphones.'));
$form['getlocations_leaflet_cloudmade']['cloudmade_maps'][$ct]['style_id'] = getlocations_element_map_tf(t('Style ID @num', array(
'@num' => $ct + 1,
)), isset($getlocations_leaflet_cloudmade['cloudmade_maps'][$ct]['style_id']) ? $getlocations_leaflet_cloudmade['cloudmade_maps'][$ct]['style_id'] : '', t('The style ID for the map you want to include, see <a href="@editor">Cloudmade style editor</a>, note the number in the bottom righthand corner of the examples.', array(
'@editor' => 'http://maps.cloudmade.com/editor',
)), 10);
$form['getlocations_leaflet_cloudmade']['cloudmade_maps'][$ct]['style_token'] = getlocations_element_map_tf(t('Style Token @num', array(
'@num' => $ct + 1,
)), isset($getlocations_leaflet_cloudmade['cloudmade_maps'][$ct]['style_token']) ? $getlocations_leaflet_cloudmade['cloudmade_maps'][$ct]['style_token'] : '', t('Some styles require a token.'), 40);
}
return $form;
}