You are here

function location_map_link_ca_google in Location 7.4

Same name and namespace in other branches
  1. 5.3 supported/location.ca.inc \location_map_link_ca_google()
  2. 5 supported/location.ca.inc \location_map_link_ca_google()
  3. 6.3 supported/location.ca.inc \location_map_link_ca_google()
  4. 7.5 supported/location.ca.inc \location_map_link_ca_google()
  5. 7.3 supported/location.ca.inc \location_map_link_ca_google()

File

supported/location.ca.inc, line 131

Code

function location_map_link_ca_google($location = array()) {
  $query_params = array();
  foreach (array(
    'street',
    'city',
    'province',
    'postal_code',
    'country',
  ) as $field) {
    if (isset($location[$field])) {
      $query_params[] = $location[$field];
    }
  }
  if (count($query_params)) {
    return 'http://maps.google.ca?q=' . urlencode(implode(", ", $query_params));
  }
  else {
    return NULL;
  }
}