function getdirections_direction in Get Directions 6
Same name and namespace in other branches
- 6.2 getdirections.module \getdirections_direction()
- 7.3 getdirections.module \getdirections_direction()
- 7.2 getdirections.module \getdirections_direction()
Function to setup the map and form
Parameters
$direction: Optional. The direction the supplied input applies to
$location: Optional. The string to search with
$country: Optional. The country
$latlon: Optional. Comma delimted string containg latitude and longitude
Return value
Returns the themed map and form
2 calls to getdirections_direction()
- getdirections_setlocation in ./
getdirections.module - Function to setup the map and form
- getdirections_user_setlocation in ./
getdirections.module - Function to setup the map and form
1 string reference to 'getdirections_direction'
- getdirections_menu in ./
getdirections.module - Implementation of hook_menu().
File
- ./
getdirections.module, line 162 - Fetches google map directions.
Code
function getdirections_direction($direction = '', $location = '', $country = '', $latlon = '') {
$getdirections_defaults = getdirections_defaults();
getdirections_setup_map($getdirections_defaults);
$lla = split(',', $getdirections_defaults['latlong']);
$getdirections_settings = array(
'lat' => $lla[0],
'lng' => $lla[1],
'zoom' => $getdirections_defaults['zoom'],
'maptype' => $getdirections_defaults['maptype'],
'controltype' => $getdirections_defaults['controltype'],
'mtc' => $getdirections_defaults['mtc'],
'baselayers' => $getdirections_defaults['baselayers'],
'scale' => $getdirections_defaults['behavior']['scale'],
'overview' => $getdirections_defaults['behavior']['overview'],
'scrollwheel' => $getdirections_defaults['behavior']['scrollwheel'],
'draggable' => $getdirections_defaults['behavior']['draggable'],
'unitsystem' => $getdirections_defaults['unitsystem'],
);
drupal_add_js(array(
'getdirections' => $getdirections_settings,
), 'setting');
drupal_set_title(t("Get Directions"));
$width = $getdirections_defaults['width'];
$height = $getdirections_defaults['height'];
$form = drupal_get_form('getdirections_direction_form', $direction, $location, $country, $latlon);
return theme('getdirections_show', $form, $width, $height);
}