function getdirections_entity_setlocations in Get Directions 7.3
Function to setup the map
Parameters
string $from_entity_type: Required. The Entity type of the starting point, eg node, user etc
int $from_entity_id: Required. The identifier of the starting point.
string $from_entity_type: Required. The Entity type of the destination, eg node, user etc
int $from_entity_id: Required. The identifier of the destination.
Return value
Returns the themed map
5 calls to getdirections_entity_setlocations()
- getdirections_direction_box in ./
getdirections.module - for colorbox and suchlike
- getdirections_n2u_setlocation in ./
getdirections.module - Function to setup the map
- getdirections_node_setlocations in ./
getdirections.module - Function to setup the map
- getdirections_u2n_setlocation in ./
getdirections.module - Function to setup the map and form
- getdirections_user_setlocations in ./
getdirections.module - Function to setup the map
1 string reference to 'getdirections_entity_setlocations'
- getdirections_menu in ./
getdirections.module - Implement hook_menu().
File
- ./
getdirections.module, line 1017 - Fetches google map directions.
Code
function getdirections_entity_setlocations($from_entity_type, $from_entity_id, $to_entity_type, $to_entity_id, $width = '', $height = '') {
if (is_numeric($from_entity_id) && $from_entity_id && is_numeric($to_entity_id) && $to_entity_id && getdirections_check_entity_type($from_entity_type) && getdirections_check_entity_type($to_entity_type)) {
// from
$from_location = getdirections_load_locations($from_entity_id, $from_entity_type);
if (count($from_location)) {
$from_latlon = $from_location[0]['latitude'] . ',' . $from_location[0]['longitude'];
// sanity check
if (!getdirections_latlon_check($from_latlon)) {
watchdog('getdirections', 'Lat, Lon failed for !e id !nid', array(
'!e' => $from_entity_type,
'!nid' => $from_entity_id,
), WATCHDOG_WARNING);
$from_latlon = getdirections_load_latlon_defaults();
}
$from_locs = _getdirections_loadaddress($from_location[0]);
// to
$to_location = getdirections_load_locations($to_entity_id, $to_entity_type);
if (count($to_location)) {
$to_latlon = $to_location[0]['latitude'] . ',' . $to_location[0]['longitude'];
// sanity check
if (!getdirections_latlon_check($to_latlon)) {
watchdog('getdirections', 'Lat, Lon failed for !e id !nid', array(
'!e' => $to_entity_type,
'!nid' => $to_entity_id,
), WATCHDOG_WARNING);
$to_latlon = getdirections_load_latlon_defaults();
}
$to_locs = _getdirections_loadaddress($to_location[0]);
$content = getdirections_locations($from_locs, $from_latlon, $to_locs, $to_latlon, $width, $height);
return $content;
}
}
}
return getdirections_direction();
}