function getdirections_defaults in Get Directions 7.2
Same name and namespace in other branches
- 6.2 getdirections.module \getdirections_defaults()
- 6 getdirections.module \getdirections_defaults()
- 7.3 getdirections.module \getdirections_defaults()
Some defaults.
9 calls to getdirections_defaults()
- getdirections_direction in ./
getdirections.module - Function to setup the map and form
- getdirections_direction_form in ./
getdirections.module - Function to setup the form
- getdirections_is_advanced in ./
getdirections.module - getdirections_load_latlon_defaults in ./
getdirections.module - getdirections_locations in ./
getdirections.module - Function to setup the map
File
- ./
getdirections.module, line 727 - Fetches google map directions.
Code
function getdirections_defaults() {
$getdirections_use_v3 = variable_get('getdirections_use_v3', 0);
if (module_exists('getlocations_fields') && !$getdirections_use_v3) {
variable_set('getdirections_use_v3', 1);
$getdirections_use_v3 = 1;
}
// no gmap for v3 googlemap API
if ($getdirections_use_v3) {
$defaults = array(
'api_version' => 3,
'width' => '300px',
'height' => '200px',
'zoom' => 3,
'controltype' => 'small',
'pancontrol' => 1,
'latlong' => '40,0',
'maptype' => 'Map',
'mtc' => 'standard',
'baselayers' => array(
'Map' => 1,
'Satellite' => 1,
'Hybrid' => 1,
'Physical' => 1,
),
'behavior' => array(
'scale' => 0,
'scrollwheel' => 0,
'draggable' => 1,
'overview' => 0,
'overview_opened' => 0,
'googlebar' => 0,
),
'unitsystem' => 'metric',
'from_width' => 20,
'to_width' => 20,
'travelmode_show' => 0,
'transit_dates' => 0,
'transit_date_format' => 'int',
'travelextras_show' => 0,
'streetview_show' => 0,
'use_advanced' => 0,
'use_country_dropdown' => 1,
'waypoints' => 0,
'waypoint_color' => 'white',
'waypoints_optimise' => 0,
'advanced_alternate' => 0,
'advanced_autocomplete' => 0,
'advanced_autocomplete_bias' => 0,
'advanced_autocomplete_via' => 0,
'advanced_autocomplete_via_width' => 20,
'map_backgroundcolor' => '',
);
}
else {
if (module_exists('gmap')) {
$defaults = gmap_defaults();
$defaults['api_version'] = GMAP_API_VERSION;
$defaults['from_width'] = 20;
$defaults['to_width'] = 20;
$defaults['use_advanced'] = 0;
$defaults['waypoints'] = 0;
$defaults['waypoint_color'] = 'white';
$defaults['waypoints_optimise'] = 0;
$defaults['advanced_alternate'] = 0;
$defaults['advanced_autocomplete'] = 0;
$defaults['advanced_autocomplete_bias'] = 0;
$defaults['advanced_autocomplete_via'] = 0;
$defaults['advanced_autocomplete_via_width'] = 20;
}
else {
$defaults = array(
'api_version' => 2,
'width' => '300px',
'height' => '200px',
'zoom' => 3,
'controltype' => 'small',
'latlong' => '40,0',
'maptype' => 'Map',
'mtc' => 'standard',
'baselayers' => array(
'Map' => 1,
'Satellite' => 1,
'Hybrid' => 1,
'Physical' => 0,
),
'behavior' => array(
'scale' => 0,
'overview' => 0,
'googlebar' => 0,
),
'from_width' => 20,
'to_width' => 20,
'use_advanced' => 0,
'waypoints' => 0,
'waypoint_color' => 'white',
'waypoints_optimise' => 0,
'advanced_alternate' => 0,
'advanced_autocomplete' => 0,
'advanced_autocomplete_bias' => 0,
'advanced_autocomplete_via' => 0,
'advanced_autocomplete_via_width' => 20,
);
}
}
$defaults['use_country_dropdown'] = 1;
global $is_https;
$defaults['use_https'] = $is_https ? 1 : 0;
$getdirections_defaults = variable_get('getdirections_default', array());
// array_merge deletes things in $defaults that are not in $getdirections_defaults ;-/
// roll my own
$newdefaults = array();
foreach ($defaults as $k => $v) {
if (is_array($v)) {
foreach ($defaults[$k] as $k1 => $v1) {
if (isset($getdirections_defaults[$k][$k1])) {
$newdefaults[$k][$k1] = $getdirections_defaults[$k][$k1];
}
else {
$newdefaults[$k][$k1] = $v1;
}
}
}
else {
if (isset($getdirections_defaults[$k])) {
$newdefaults[$k] = $getdirections_defaults[$k];
}
else {
$newdefaults[$k] = $v;
}
}
}
return $newdefaults;
}