You are here

function location_map_link_my_google in Location 7.3

Google link.

File

supported/location.my.inc, line 84
Malaysia.

Code

function location_map_link_my_google($location = array()) {
  $query_params = array();
  $q = NULL;
  foreach (array(
    'street',
    'city',
    'province',
    'postal_code',
    'country',
  ) as $field) {
    if (isset($location[$field])) {
      $query_params[] = $location[$field];
    }
  }
  if (location_has_coordinates($location)) {
    $q = urlencode($location['latitude'] . ' ' . $location['longitude'] . ' (' . implode(', ', $query_params) . ')');
  }
  elseif (count($query_params) > 0) {
    $q = urlencode(implode(", ", $query_params));
  }
  if ($q != NULL) {
    return 'http://maps.google.com.my?q=' . $q;
  }
  else {
    return NULL;
  }
}