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