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.
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.
Comment | File | Size | Author |
---|---|---|---|
#4 | leaflet-support-search-api-others-1829580-4.patch | 2.46 KB | TuWebO |
#1 | 1829580.view_style_get_field_value.1.patch | 1.89 KB | tnightingale |
Comments
Comment #1
tnightingale CreditAttribution: tnightingale commentedPatch attached
Comment #2
pvhee CreditAttribution: pvhee commentedGreat patch, committed!
Comment #4
TuWebO CreditAttribution: TuWebO commentedHello,
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:
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.
Comment #5
TuWebO CreditAttribution: TuWebO commentedMoving comment #4 to a #2224171: Notice: Undefined property: leaflet_views_plugin_style::$entity_type since this was fixed and closed.