function getdirections_entity_setlocations_via in Get Directions 7.3
Function to setup the map to display waypoints
Parameters
string $entity_ids: Required. A comma delimited list of identifiers
string $from_entity_type: Required. The Entity type of the points, eg node, user etc
Return value
Returns the themed map
2 calls to getdirections_entity_setlocations_via()
- getdirections_node_setlocations_via in ./
getdirections.module - Function to setup the map to display waypoints
- getdirections_user_setlocations_via in ./
getdirections.module - Function to setup the map to display waypoints
File
- ./
getdirections.module, line 1057 - Fetches google map directions.
Code
function getdirections_entity_setlocations_via($entity_ids, $entity_type, $width = '', $height = '') {
// $entity_ids is a comma delimeted list
$arr_entity_ids = explode(',', $entity_ids);
foreach ($arr_entity_ids as $key => $entity_id) {
if ($key > GETDIRECTIONS_WAYPOINTS_MAX && $key < count($arr_entity_ids)) {
continue;
}
if (!is_numeric($entity_id) || !$entity_id) {
continue;
}
$locations = getdirections_load_locations($entity_id, $entity_type);
if (!count($locations)) {
continue;
}
$locs[] = _getdirections_loadaddress($locations[0]);
$latlon = $locations[0]['latitude'] . ',' . $locations[0]['longitude'];
// sanity check
if (!getdirections_latlon_check($latlon)) {
watchdog('getdirections', 'Lat, Lon failed for user id !nid', array(
'!nid' => $entity_id,
), WATCHDOG_WARNING);
continue;
}
$latlons[] = $latlon;
}
$content = getdirections_locations_via($locs, $latlons, $width, $height);
return $content;
}