function getdirections_direction_other in Get Directions 7.3
Function to setup the map and form
Parameters
string $direction: Optional. The direction the supplied input applies to
string $location: Optional. The string to search with
string $country: Optional. The country
string $latlon: Optional. Comma delimited string containing latitude and longitude
int $lid: Optional. location identifier
$type: Optional. Used to distinguish various sources
Return value
Returns the themed map and form
2 calls to getdirections_direction_other()
- getdirections_latlon in ./
getdirections.module - Function to setup the map and form
- getdirections_setlocation_id in ./
getdirections.module - Function to setup the map and form
File
- ./
getdirections.module, line 370 - Fetches google map directions.
Code
function getdirections_direction_other($direction = '', $location = '', $country = '', $latlon = '', $lid = 0, $type = '', $width = '', $height = '') {
if (!getdirections_check()) {
return t('You need to !c first.', array(
'!c' => l('configure Getdirections', 'admin/config/services/getdirections'),
));
}
$getdirections_defaults = getdirections_defaults();
$getdirections_misc = getdirections_misc_defaults();
getdirections_setup_map($getdirections_defaults, $getdirections_misc);
$getdirections_settings = getdirections_get_settings($getdirections_defaults, $getdirections_misc);
$mapid = getdirections_get_key();
drupal_add_js(array(
'getdirections' => array(
$mapid => $getdirections_settings,
),
), 'setting');
if ($getdirections_misc['keep_title'] && $lid && $direction) {
if ($type == 'location') {
if ($direction == 'to') {
$direction_translated = t('to');
}
elseif ($direction == 'from') {
$direction_translated = t('from');
}
$t = getdirections_get_lid_title($lid);
if ($t) {
drupal_set_title(t('Get directions @d !t', array(
'@d' => $direction_translated,
'!t' => $t,
)));
}
}
}
if (empty($width)) {
$width = $getdirections_defaults['width'];
}
if (empty($height)) {
$height = $getdirections_defaults['height'];
}
// remove brackets if any
$latlon = preg_replace("/^\\(|\\)\$/", '', $latlon);
$raw_form = drupal_get_form('getdirections_direction_form', $mapid, $direction, $location, $country, $latlon);
$form = render($raw_form);
return theme('getdirections_show', array(
'form' => $form,
'mapid' => $mapid,
'width' => $width,
'height' => $height,
'entity_id' => 0,
'entity_type' => '',
'lid' => $lid,
'type' => $type,
));
}