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.
I have 2 markers on map and expect when on click, it will display the location of each marker. However, currently when I click, the map will be auto centre and display the title of the node instead.
How can I change that?
Comment | File | Size | Author |
---|---|---|---|
#6 | geofield.1698352-6.patch | 1.22 KB | jrb |
#5 | geofield.1698352-5.patch | 1.04 KB | jrb |
Comments
Comment #1
samgreco CreditAttribution: samgreco commentedI am seeing this now too. Anyone have an answer? I am displaying this in a node.
Comment #2
Manuel Garcia CreditAttribution: Manuel Garcia commentedYup, this is hardwired into geofield_map.module
inside function geofield_map_field_formatter_view....
Line 66:
'description' => entity_label($entity_type, $entity),
I feel it would make a lot of sense to display the address field content if you are using address field as the source of the point geolocation data. Not sure if we can do this without hacking up the module... any hints anyone?
Comment #3
DSquaredB CreditAttribution: DSquaredB commentedIs there a solution for displaying the address field (or other fields within the entity type) instead of the name of the entity type? Entity type name is not a useful field to display in the popup.
Comment #4
RdeBoerTo all the above: use IP Geolocation Views and Maps in combination with Geofield (7.x-1.x or better: 7.x-2.x) to realise more advanced map configuration requirements.
Comment #5
jrbI've created a patch that makes the geofield_map module use a theme function to set that 'description'. This will allow you to use theming/preprocess functions to override this value.
I did something like this in a custom module to make the popup show the address:
Ultimately, it might be nice to make the popup text part of the field display settings where you could even allow the use of tokens, too. But, this at least made it less hard-coded and let me set the value.
Comment #6
jrbThe patch above didn't apply correctly. This one's better.
Comment #7
hasjalil CreditAttribution: hasjalil commentedIP Geolocation Views & Maps (IPGV&M) makes it easy to create Views-based mapping solutions using the map renderer of your choice (Google, OpenLayers or Leaflet) with any location storage module of your choice, e.g. Get Locations, Geofield, Geolocation Field or Location.
Have a glance to https://www.drupal.org/project/ip_geoloc
Comment #8
ITWest-jg CreditAttribution: ITWest-jg commentedCould you also do this for the view plugin? geofield_map_plugin_style_map.inc At the moment it doesn't have any of the options that geofield_map_field_formatter_view has... in fact there is a lot of duplicated code, sort of.
Comment #9
tecjam CreditAttribution: tecjam commentedI created a custom plugin which
a) adds custom markers from a taxonomy term assigned to each content that should be shown in the map (to which I added an image field called 'field_store_type_icon')
b) Edits the popup description and adds any other field values to it, rather than just the single option available in the settings.
Note that some hacks need to be made to - so use this patch: https://www.drupal.org/files/issues/Geofield-Define%20custom%20marker%20...
Now you can use
yourmodule_geofield_map_data_alter(&$datum, $view, $result) {}
Thanks to Arlina - https://www.drupal.org/node/2362929#comment-9279755
My Module is called geofield_maps_markers and here is the code (the comments should be enough for most people ..
Comment #10
RdeBoerHard-coding a solution is an interesting exercise.
However, as mentioned in #4 and #7, all of this has been available for years, fully configurable through the VIews UI, when you use Geofield (or one of the other coordinate storage modules) in combo with http://drupal.org/project/ip_geoloc.
Comment #11
fox mulder CreditAttribution: fox mulder commentedYou can try something like this to override entity label with content of some field of entity
Comment #12
soniaojha CreditAttribution: soniaojha commentedI am using geolocation map in drupal 8 and the map is showing on page but not showing in colorbox pop-up.