Scenario: I want to display my Search API views search results on a map!

Problem: The current views_leaflet style assumes $this->view->result to always be a data structure consistent with the one set by the built-in database query handler. However this isn't guaranteed and in the case of seach_api_views, it's not.

Solution: get_field_value() should return a consistent value for the geofield which can them be used to pass to leaflet_process_geofield() to get the points to pass to the map.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tnightingale’s picture

Title: Refactor leaflet_views style plugin to support other views query handlers » Support Search API and others!
Status: Active » Needs review
FileSize
1.89 KB

Patch attached

pvhee’s picture

Status: Needs review » Fixed

Great patch, committed!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

TuWebO’s picture

Issue summary: View changes
Status: Closed (fixed) » Active
FileSize
2.46 KB

Hello,
Sorry about open this issue, but I'm using search_api_solr among search_api_views for rendering some indexed items. It works pretty well, but I'm having this notice:
"Notice: Undefined property: leaflet_views_plugin_style::$entity_type in leaflet_views_plugin_style->render() (line 274 of /sites/all/modules/contrib/leaflet/leaflet_views/leaflet_views_plugin_style.inc)."

I'm been looking at the code above, and I realize that I only had fields and no $this->entity_type variable at that point, so calling:

leaflet_apply_map_settings($map, $data, $this->options, $this->entity_type) 

will throw the above mentioned notice.

I've changed this function, passing NULL if no entity_type is configured, but this will bring another problem when tokenizen the icons and popups in leaflet_apply_map_settings function.

So I've added a patch, that solve this, but I don't know if it is the good way or I am missing something, so any feedback will be great.

TuWebO’s picture

Status: Active » Closed (fixed)

Moving comment #4 to a #2224171: Notice: Undefined property: leaflet_views_plugin_style::$entity_type since this was fixed and closed.