You are here

function getdirections_location_latlon_path in Get Directions 6.2

Same name and namespace in other branches
  1. 7.3 getdirections.api.inc \getdirections_location_latlon_path()
  2. 7.2 getdirections.api.inc \getdirections_location_latlon_path()

API Function to generate a url path for use by other modules/themes.

Example Usage: $path = getdirections_location_latlon_path('to', '1.1234,1.234', 'my place'); $url = l(t('Get directions'), $path);

Parameters

string $direction: Required. The direction the supplied input applies to. Must be either 'to' or 'from'

string $latlon: Required. The location point to be used. In decimal latitude,longitude

string $locs: Optional. A description of the point.

Return value

Returns a path relative to the drupal root.

File

./getdirections.api.inc, line 194
Get directions API

Code

function getdirections_location_latlon_path($direction, $latlon, $locs = '') {
  if (($direction == 'to' || $direction == 'from') && preg_match("/[0-9.\\-],[0-9.\\-]/", $latlon)) {
    $out = "getdirections/latlon/{$direction}/{$latlon}";
    if ($locs) {
      $out .= "/{$locs}";
    }
    return $out;
  }
}