Jan
23
2016
By abernal
In order to add controls to the google map within Scholarly Theme at Drupal, follow this procedure
1. Get into the path within Drupal
sites/all/themes/scholarly
2. Modify this file
template.php
3. Add these lines
mapTypeControl: true,
mapTypeControlOptions: {
style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR,
position: google.maps.ControlPosition.TOP_CENTER
},
zoomControl: true,
zoomControlOptions: {
position: google.maps.ControlPosition.LEFT_CENTER
},
scaleControl: true,
streetViewControl: true,
streetViewControlOptions: {
position: google.maps.ControlPosition.LEFT_TOP
}4. Within this context
function initialize() {
var mapOptions = {
zoom: myZoom,
mapTypeId: google.maps.MapTypeId.ROADMAP,
center: myLatlng,
scrollwheel: false,
mapTypeControl: true,
mapTypeControlOptions: {
style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR,
position: google.maps.ControlPosition.TOP_CENTER
},
zoomControl: true,
zoomControlOptions: {
position: google.maps.ControlPosition.LEFT_CENTER
},
scaleControl: true,
streetViewControl: true,
streetViewControlOptions: {
position: google.maps.ControlPosition.LEFT_TOP
}
};
map = new google.maps.Map(document.getElementById(Drupal.settings.scholarly[\'google_map_canvas\']),mapOptions);
marker = new google.maps.Marker({
map:map,
draggable:true,
position: myLatlng
});
google.maps.event.addDomListener(window, "resize", function() {
map.setCenter(myLatlng);
});
}
5. Reference