As far as I can see, all the gmap views work with the default settings of the gmap_location module. So it is e.g. not possible to have two views, the first with a fixed zoom level, that opens the info window on marker action and a second that uses autozoom and links to the nodes by clicking on it.
So: Wouldn't it be a great thing to get such settings for every view?
Comments
Comment #1
ultimikeYou're correct in your understanding that there's only one set of defaults for GMap and that all GMap views will share these settings.
I'm not sure it is possible to have individual GMap settings for each view - there would have to be a place edit this information within the views interface, and I'm not sure that's possible.
It seems more likely that it would be possible to provide another settings fieldset on admin/settings/gmap_location - one for views, but this would be shared by all views, not customizable on a per-view basis.
-mike
Comment #2
tom_o_t commentedIt used to be possible to put a GMap Macro in the arguments handler for each view, and that would change the settings for each individual GMap view. But this doesn't seem to work any more. I think it may only have been a 4.7 thing, or perhaps a code hack. I'll dig around and see if I can find how it was done. It wasn't very intuitive, but it worked!
Comment #3
hairforce commentedThis is possible and kind of supported, though its a little bit of a hack
The discussion is here - http://drupal.org/node/74920, but i'll summarize.
You can set a unique macro for each view by declaring $view->gmap_macro in the argument handling code section of the view. It works even if your view isn't using any arguments..
So pasting this there works just fine for me on a gmap page view:
$view->gmap_macro = "[gmap |center=47, 8 |zoom=11 |width=604px |height=200px |control=Small |type=Map]";
With the current functionality in Views i don't think we could expect any better implementation than that.
Comment #4
mrb commentedI also would like to override the global 'Marker action:' setting for different views.
Please do you know if there is any way to override this via a macro command, so we can use the method described in #3 above?
Or are there any other techniques to override it?
Thanks, MrB
Comment #5
mrb commentedA read through the code shows there is a variable we can add in the macro to control what happens when a user clicks the marker. The options are:
'markermode=0' : do nothing
'markermode=1' : the default. open a pop-up window
'markermode=2' : open the node that the marker points to
So for the map where I want to go straight to the node when the user clicks the marker, the argument handling code now looks like this:
$view->gmap_macro = "[gmap |behavior=+autozoom|markermode=2]";(The map also happens to use autozoom, but that's not necessary).
You can see the finished result here: http://www.batgung.com/place-map-search
Comment #6
dadderley commentedThis is a great solution. It works like a charm. Thank you.