function getdirections_comment_setlocation in Get Directions 7.2
Same name and namespace in other branches
- 7.3 getdirections.module \getdirections_comment_setlocation()
Function to setup the map and form
Parameters
string $direction: Required. The direction the supplied input applies to
int $cid: Required. The cid of the location enabled comment
Return value
Returns the themed map and form
1 call to getdirections_comment_setlocation()
1 string reference to 'getdirections_comment_setlocation'
- getdirections_menu in ./
getdirections.module - Implement hook_menu().
File
- ./
getdirections.module, line 1304 - Fetches google map directions.
Code
function getdirections_comment_setlocation($direction, $cid, $width = '', $height = '') {
if (is_numeric($cid) && $cid) {
$locations = getdirections_load_locations($cid, 'cid');
if (count($locations)) {
$country = isset($locations[0]['country']) ? $locations[0]['country'] : '';
$latlon = $locations[0]['latitude'] . ',' . $locations[0]['longitude'];
// sanity check
if (!getdirections_latlon_check($latlon)) {
watchdog('getdirections', 'Lat, Lon failed for comment id !cid', array(
'!cid' => $cid,
), WATCHDOG_WARNING);
$latlon = getdirections_load_latlon_defaults();
}
$comment = comment_load($cid);
// $locs only used for display now
$locs = $comment->subject;
$content = getdirections_direction($direction, $locs, $country, $latlon, $cid, 'comment', $width, $height);
return $content;
}
}
return getdirections_direction();
}