You are here

function location_map_link_google in Location 7.3

Google link.

File

./location.inc, line 147
Public API for the Location module.

Code

function location_map_link_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.com?q=' . urlencode(implode(", ", $query_params));
  }
  else {
    return NULL;
  }
}