From e2ec797398326b88782988d0b9719e21c278a584 Mon Sep 17 00:00:00 2001 From: Iain Patterson Date: Thu, 7 Nov 2013 11:32:50 -0500 Subject: [PATCH] Use popup div for Google Maps. Show an embedded Google Maps view in the popup div. It is displayed when hovering over the Map link for a preview of the map. Following the link will go to the full map on maps.google.co.uk as before. We make sure to include the output=embedded argument and specify https so that browsers don't refuse to load the preview on security grounds. --- lib/functions.php | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/lib/functions.php b/lib/functions.php index f1e7145..ec0b35a 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -320,7 +320,32 @@ function get_address_map_link($address) { $postcode = trim($address->getPostcode()); if ($postcode) { - return " " . get_small_link("Map", "http://maps.google.co.uk/maps?q=" . urlencode($postcode)); + # mrt=loc specifies a location search. + $map = "maps.google.co.uk/maps?q=" . urlencode($postcode) . "&mrt=loc"; + $url = "http://$map"; + # output=embed allows display in an iframe. + # iwloc=near hides the popup window for the embedded view. + $embed = $GLOBALS['http'] . "://$map&output=embed&iwloc=near"; + $html = " "; + $html .= get_small_link_with_id("map", "Map", $url); + $html .= ""; + return $html; } } -- 2.7.4