Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Regarding the issue user friendly input and the patch googlemaps-widget-1415244-4.patch in the issue, it will be great if we can center the map each time we click 'Get location' based on the value in location field.
I have made a js file to do it. But it needs a tweak in ip_geoloc module. I have posted a message in the issue queue there, hopefully the map object will be available in current window.
Following is my js file. Please let me know if I am logically wrong.
Drupal.behaviors.geolocation_proximity = {
attach: function(context) {
var $ = jQuery;
$('.geolocation-address-geocode').click(function() {
var location = $('.geolocation-address :input').val();
geocoder = new google.maps.Geocoder();
geocoder.geocode( { 'address': location }, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
}
});
});
}
}