Hello,
I have set a search api solr view for searching in the map and I am using leaflet_views_plugin_style to format results. Everything seems ok, but since I am adding just indexed fields, this notice will throw:

"Notice: Undefined property: leaflet_views_plugin_style::$entity_type in leaflet_views_plugin_style->render() (line 274 of /home/mysite/public_html/sites/all/modules/contrib/leaflet/leaflet_views/leaflet_views_plugin_style.inc)."

I'm been looking at the above file, and I realized that I only had fields and no $this->entity_type variable is set 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 both, but I don't know if it is the good way or I am missing something, so any feedback will be great.

This issue was posted here #1829580: Support Search API and others!, but I think create a new issue is better, since the other one was Fixed and closed.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Amber Himes Matz’s picture

Effectively removes the notice for me. Applied to 7.x-1.1.

Amber Himes Matz’s picture

Status: Needs review » Reviewed & tested by the community
Dean Clayton’s picture

patch worked for me as well, any chance of getting this being applied?

TuWebO’s picture

Status: Reviewed & tested by the community » Closed (duplicate)

Hi,
Looks like another patch has been posted in this issue #2466365: [leaflet views] entity type not detected for search_api views. It looks like it is a more elegant and better solution than this one. I have already tried that one and it is working fine for me.
Could you guys take a look at that one instead?

I will close this one as duplicate, feel free to reopen it if the other one does not work for you.