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.
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
Comment | File | Size | Author |
---|---|---|---|
#3 | rendered_entity_tooltip-2890641-2.patch | 1006 bytes | plopesc |
Comments
Comment #2
plopescAttaching patch
Comment #3
plopescComment #4
ckaotikAs far as I can tell,
LeafletMap
is the old formatter and probably won't be updated anymore. Have you tried using the newLeaflet
plugin instead?