Problem/Motivation

When creating a Leaflet map view where the rendered entity type is not "node" and using the rendered entity tooltip option, the site throws a fatal exception:

Error: Call to a member function getEntityTypeId() on null in Drupal\leaflet_views\Plugin\views\style\LeafletMap->render() (line 421 of modules/contrib/leaflet/leaflet_views/src/Plugin/views/style/LeafletMap.php).

This is why the current code has a hardcoded referenced to "nid" property.
$entity = $this->entityManager->getStorage($this->entityType)->load($result->nid);
So when the view is rendering a different entity type IE: user, fails.

Proposed resolution

Refactor that piece of code to make it work with any entity type.

Remaining tasks

Provide patch
Pass QA

User interface changes

None

API changes

None

Data model changes

None

CommentFileSizeAuthor
#3 rendered_entity_tooltip-2890641-2.patch1006 bytesplopesc
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

plopesc created an issue. See original summary.

plopesc’s picture

Issue summary: View changes
Priority: Normal » Major
Status: Active » Needs review

Attaching patch

plopesc’s picture

ckaotik’s picture

As far as I can tell, LeafletMap is the old formatter and probably won't be updated anymore. Have you tried using the new Leaflet plugin instead?