I have a view with 3 content types - store, event and promotion

  • store has a geofield, called field_geo
  • event has a geofield called field_geo
  • promotion has an entity reference to store

Store and event map fine. The promotion event does not map.

My intent was to map all three on the same map, whereby the promotions would map using the geofield from the stores. I have created an entity relationship in the view, but it's not mapping these. In a regular view, the points show up for all three content types.

I'm assuming this is because the field name is this view is different from simply field_geo? When we setup the map can we enter in more than one field type with a comma separator, or is there some kind of other strategy?

I'm trying to avoid a store, listing a promotion, and having to enter their address again every single time since the promo is attached to their store.

Thanks for your help in tackling this!

CommentFileSizeAuthor
#9 1904490.patch4.64 KBbalagan
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

magicmirror’s picture

Status: Closed (works as designed) » Active

I solved this.

I had listed two fields, one field_geo and the other an entity reference field related back to the field_geo in the promotion. That didn't work.

Instead, I listed field_geo twice in the fields list. On one, it does not use an entity relationship, which covers the first two content types - store, event. On the other, I set it to use the entity_relationship for the store reference, which gets the promotion type mapped. Now they are all three showing up as field_geo and map properly.

Nevermind, that's not working either.

magicmirror’s picture

Status: Active » Closed (works as designed)
magicmirror’s picture

This got the promo displaying, but then the other two don't display. If I set it to display only the promo, they display. But if I set it to display all three, then none display.

magicmirror’s picture

Reopening.

magicmirror’s picture

I can't even get it to display a map of the promo type anymore. It simply won't do it. If I display it as a list, the point is there. It's pulling it in, but when I switch to map it won't display at all. Nor will any other map points.

Is this capable of mapping the geofield from a referenced entity?

magicmirror’s picture

Anybody?

magicmirror’s picture

Any ideas on this? I would at least like to know if it is "supposed" to be possible? I can't be alone in needing to map a field from a referenced entity?

smerth’s picture

Did you find a solution to this I also need to do the same thing and haven't been able to make it work???

balagan’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
4.64 KB

I wrote a patch, where you can select Leaflet field formatter for entityreference fields. Then you can also select which geofields of the referenced entities you want to use as sources. Upon displaying the content type containing the entityreference fields pointing to entities with geofields, the map shows all referenced geofields.

balagan’s picture

Assigned: Unassigned » balagan
Status: Needs review » Needs work

I will have to reroll the patch, because another patch got committed into this file.

magicmirror’s picture

Thanks for the efforts.

levelos’s picture

Thanks for working on this gang. A couple of thoughts.

  1. Should this be handled through a CTools plugin by extending EntityReference_BehaviorHandler_Abstract
  2. This can also be handled by implementing a custom view mode, although I realize that would require writing some glue code.

I'm not convinced an additional field formatter based on the existence of the entity_reference module is the way to go.

balagan’s picture

I will take a look at CTools plugins. They are still scary things for me.

balagan’s picture

I took a look at this EntityReference_BehaviorHandler_Abstract, and I just could not get how it would solve my problem. I have reread the thread, and realized that magicmirror was using views to create the display, whereas I would like to display all the referenced geofields in one map with the entity. I am writing this GPX parser module, and this module uses a content type to store a list of tracks and waypoints. There it would be useful to see all of the referenced geofields on one map. Should I create a new issue for this? Any thoughts about my approach?

balagan’s picture

Assigned: balagan » Unassigned