function getdirections_misc_settings in Get Directions 7.3
Miscellaneous settings form
2 calls to getdirections_misc_settings()
- getdirections_fields_field_formatter_settings_form in modules/
getdirections_fields/ getdirections_fields.module - Implements hook_field_formatter_settings_form(). Returns form elements for a formatter's settings.
- getdirections_settings_form in ./
getdirections.admin.inc - Function to display the getdirections admin settings form
File
- ./
getdirections.module, line 2621 - Fetches google map directions.
Code
function getdirections_misc_settings($defaults, $config = TRUE, $extras = TRUE) {
if ((module_exists('location') || module_exists('getlocations_fields')) && $config) {
$form['keep_title'] = array(
'#type' => 'checkbox',
'#title' => t('Show original title'),
'#description' => t("Show the node title or user name when using 'to' or 'from'."),
'#default_value' => $defaults['keep_title'],
'#return_value' => 1,
);
}
else {
$form['getdirections_misc']['keep_title'] = array(
'#type' => 'value',
'#value' => 0,
);
}
$form['show_distance'] = array(
'#type' => 'checkbox',
'#title' => t('Show total distance'),
'#default_value' => $defaults['show_distance'],
'#return_value' => 1,
);
$form['show_duration'] = array(
'#type' => 'checkbox',
'#title' => t('Show total duration'),
'#default_value' => $defaults['show_duration'],
'#return_value' => 1,
);
$form['geolocation_enable'] = array(
'#type' => 'checkbox',
'#title' => t('Enable geolocation options'),
'#default_value' => $defaults['geolocation_enable'],
'#return_value' => 1,
'#description' => t('For use on mobile devices.'),
);
$form['geolocation_mobile_check'] = array(
'#type' => 'checkbox',
'#title' => t('Enable check for mobiles'),
'#default_value' => $defaults['geolocation_mobile_check'],
'#return_value' => 1,
'#description' => t('Enable geolocation for mobile devices only.'),
'#prefix' => '<div id="wrap-getdirections-geolocation-options">',
);
$geo_opts = array(
1 => t('Browser based geocoding'),
);
if (module_exists('smart_ip')) {
$geo_opts[2] = t('Smart IP based geocoding');
}
if (module_exists('ip_geoloc')) {
$geo_opts[3] = t('IP Geolocation based geocoding');
}
$form['geolocation_option'] = array(
'#type' => 'radios',
'#title' => t('Geolocation option'),
'#default_value' => $defaults['geolocation_option'],
'#options' => $geo_opts,
'#suffix' => '</div>',
);
$form['trafficinfo'] = array(
'#type' => 'checkbox',
'#title' => t('Enable Traffic information'),
'#default_value' => $defaults['trafficinfo'],
'#description' => t('Google trafficinfo layer, limited availability.'),
'#return_value' => 1,
);
$form['trafficinfo']['#suffix'] = '<div id="wrap-getdirections-trafficinfo">';
$form['trafficinfo_state'] = array(
'#type' => 'checkbox',
'#title' => t('Activate Traffic information'),
'#default_value' => $defaults['trafficinfo_state'],
'#description' => t('Activate Traffic layer when map is first displayed'),
'#return_value' => 1,
);
$form['trafficinfo_state']['#suffix'] = '</div>';
$form['bicycleinfo'] = array(
'#type' => 'checkbox',
'#title' => t('Enable Bicycling information'),
'#default_value' => $defaults['bicycleinfo'],
'#description' => t('Google bicycling layer, limited availability.'),
'#return_value' => 1,
);
$form['bicycleinfo']['#suffix'] = '<div id="wrap-getdirections-bicycleinfo">';
$form['bicycleinfo_state'] = array(
'#type' => 'checkbox',
'#title' => t('Activate Bicycling information'),
'#default_value' => $defaults['bicycleinfo_state'],
'#description' => t('Activate Bicycling layer when map is first displayed'),
'#return_value' => 1,
);
$form['bicycleinfo_state']['#suffix'] = '</div>';
$form['transitinfo'] = array(
'#type' => 'checkbox',
'#title' => t('Enable Public transport information'),
'#default_value' => $defaults['transitinfo'],
'#description' => t('Google transit layer, limited availability.'),
'#return_value' => 1,
);
$form['transitinfo']['#suffix'] = '<div id="wrap-getdirections-transitinfo">';
$form['transitinfo_state'] = array(
'#type' => 'checkbox',
'#title' => t('Activate Transit information'),
'#default_value' => $defaults['transitinfo_state'],
'#description' => t('Activate Transit layer when map is first displayed'),
'#return_value' => 1,
);
$form['transitinfo_state']['#suffix'] = '</div>';
if ($config) {
$form['panoramio_use'] = array(
'#type' => 'checkbox',
'#title' => t('Load Panoramio Library'),
'#default_value' => $defaults['panoramio_use'],
'#description' => t('Provide Google panoramio library to all maps.'),
'#return_value' => 1,
);
$form['panoramio_use']['#suffix'] = '<div id="wrap-getdirections-panoramio-use">';
$form['panoramio_show'] = array(
'#type' => 'checkbox',
'#title' => t('Enable Panoramio'),
'#default_value' => $defaults['panoramio_show'],
'#description' => t('Google panoramio picture links.'),
'#return_value' => 1,
);
$form['panoramio_show']['#suffix'] = '<div id="wrap-getdirections-panoramio">';
$form['panoramio_state'] = array(
'#type' => 'checkbox',
'#title' => t('Activate Panoramio'),
'#default_value' => $defaults['panoramio_state'],
'#description' => t('Activate Panoramio layer when map is first displayed'),
'#return_value' => 1,
);
$form['panoramio_state']['#suffix'] = '</div></div>';
}
elseif ($defaults['panoramio_use']) {
$form['panoramio_show'] = array(
'#type' => 'checkbox',
'#title' => t('Enable Panoramio'),
'#default_value' => $defaults['panoramio_show'],
'#description' => t('Google panoramio picture links.'),
'#return_value' => 1,
);
$form['panoramio_show']['#suffix'] = '<div id="wrap-getdirections-panoramio">';
$form['panoramio_state'] = array(
'#type' => 'checkbox',
'#title' => t('Activate Panoramio'),
'#default_value' => $defaults['panoramio_state'],
'#description' => t('Activate Panoramio layer when map is first displayed'),
'#return_value' => 1,
);
$form['panoramio_state']['#suffix'] = '</div>';
}
if ($config) {
// weather
$form['weather_use'] = array(
'#type' => 'checkbox',
'#title' => t('Load Weather Library'),
'#default_value' => $defaults['weather_use'],
'#description' => t('Provide Google Weather library to all maps.'),
'#return_value' => 1,
);
$form['weather_use']['#suffix'] = '<div id="wrap-getdirections-weather-use">';
$form['weather_show'] = array(
'#type' => 'checkbox',
'#title' => t('Enable Weather information'),
'#default_value' => $defaults['weather_show'],
'#description' => t('Google Weather information.'),
'#return_value' => 1,
);
$form['weather_show']['#suffix'] = '<div id="wrap-getdirections-weather">';
$form['weather_state'] = array(
'#type' => 'checkbox',
'#title' => t('Activate Weather information'),
'#default_value' => $defaults['weather_state'],
'#description' => t('Activate Weather information when map is first displayed.'),
'#return_value' => 1,
);
$form['weather_temp'] = array(
'#type' => 'select',
'#title' => t('Temperature units'),
'#default_value' => $defaults['weather_temp'],
'#options' => array(
1 => t('Celsius'),
2 => t('Fahrenheit'),
),
);
$form['weather_speed'] = array(
'#type' => 'select',
'#title' => t('Windspeed units'),
'#default_value' => $defaults['weather_speed'],
'#options' => array(
1 => t('Kilometers per hour'),
2 => t('Meters per second'),
3 => t('Miles per hour'),
),
);
$form['weather_label'] = array(
'#type' => 'select',
'#title' => t('Label colour'),
'#default_value' => $defaults['weather_label'],
'#options' => array(
0 => 'Auto',
1 => t('Black'),
2 => t('White'),
),
);
$form['weather_clickable'] = array(
'#type' => 'checkbox',
'#title' => t('Enable clicking on maps'),
'#default_value' => $defaults['weather_clickable'],
'#return_value' => 1,
);
$form['weather_info'] = array(
'#type' => 'checkbox',
'#title' => t('Enable weather InfoWindows'),
'#default_value' => $defaults['weather_info'],
'#return_value' => 1,
);
$form['weather_info']['#suffix'] = '</div>';
$form['weather_cloud'] = array(
'#type' => 'checkbox',
'#title' => t('Enable Cloud Layer'),
'#default_value' => $defaults['weather_cloud'],
'#description' => t('Google Cloud information.'),
'#return_value' => 1,
);
$form['weather_cloud']['#suffix'] = '<div id="wrap-getdirections-weather-cloud">';
$form['weather_cloud_state'] = array(
'#type' => 'checkbox',
'#title' => t('Activate Cloud Layer'),
'#default_value' => $defaults['weather_cloud_state'],
'#description' => t('Activate Cloud layer when map is first displayed.'),
'#return_value' => 1,
);
$form['weather_cloud_state']['#suffix'] = '</div></div>';
}
elseif ($defaults['weather_use']) {
$form['weather_show'] = array(
'#type' => 'checkbox',
'#title' => t('Enable Weather information'),
'#default_value' => $defaults['weather_show'],
'#description' => t('Google Weather information.'),
'#return_value' => 1,
);
$form['weather_show']['#suffix'] = '<div id="wrap-getdirections-weather">';
$form['weather_state'] = array(
'#type' => 'checkbox',
'#title' => t('Activate Weather information'),
'#default_value' => $defaults['weather_state'],
'#description' => t('Activate Weather information when map is first displayed.'),
'#return_value' => 1,
);
$form['weather_state']['#suffix'] = '</div>';
$form['weather_cloud'] = array(
'#type' => 'checkbox',
'#title' => t('Enable Cloud Layer'),
'#default_value' => $defaults['weather_cloud'],
'#description' => t('Google Cloud information.'),
'#return_value' => 1,
);
$form['weather_cloud']['#suffix'] = '<div id="wrap-getdirections-weather-cloud">';
$form['weather_cloud_state'] = array(
'#type' => 'checkbox',
'#title' => t('Activate Cloud Layer'),
'#default_value' => $defaults['weather_cloud_state'],
'#description' => t('Activate Cloud layer when map is first displayed.'),
'#return_value' => 1,
);
$form['weather_cloud_state']['#suffix'] = '</div>';
}
if ($extras) {
if (!$defaults['use_advanced']) {
$form['switchfromto'] = array(
'#type' => 'checkbox',
'#title' => t('Enable From/To Switch'),
'#default_value' => $defaults['switchfromto'],
'#return_value' => 1,
);
}
else {
$form['switchfromto'] = array(
'#type' => 'value',
'#value' => 0,
);
}
}
return $form;
}