You are here

function getdirections_locations_via in Get Directions 7.3

Same name and namespace in other branches
  1. 6.2 getdirections.module \getdirections_locations_via()
  2. 6 getdirections.module \getdirections_locations_via()
  3. 7.2 getdirections.module \getdirections_locations_via()

Function to setup the map

Parameters

array $locs: Required. An array of location descriptions.

array $latlons: Required. An array of decimal latitude,longitude

Return value

Returns the themed map.

2 calls to getdirections_locations_via()
getdirections_entity_setlocations_via in ./getdirections.module
Function to setup the map to display waypoints
getdirections_latlons in ./getdirections.module
Function to setup the map

File

./getdirections.module, line 458
Fetches google map directions.

Code

function getdirections_locations_via($locs, $latlons, $width = '', $height = '') {
  if (!getdirections_check()) {
    return t('You need to !c first.', array(
      '!c' => l('configure Getdirections', 'admin/config/services/getdirections'),
    ));
  }
  $getdirections_defaults = getdirections_defaults();
  $getdirections_misc = getdirections_misc_defaults();
  getdirections_setup_map($getdirections_defaults, $getdirections_misc);
  $getdirections_settings = getdirections_get_settings($getdirections_defaults, $getdirections_misc);
  $getdirections_settings['latlons'] = implode('|', $latlons);
  $mapid = getdirections_get_key();
  drupal_add_js(array(
    'getdirections' => array(
      $mapid => $getdirections_settings,
    ),
  ), 'setting');
  if (empty($width)) {
    $width = $getdirections_defaults['width'];
  }
  if (empty($height)) {
    $height = $getdirections_defaults['height'];
  }
  return theme('getdirections_show_locations_via', array(
    'mapid' => $mapid,
    'width' => $width,
    'height' => $height,
    'locs' => $locs,
  ));
}