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.
When using translatable entities you get the following warning:
Illegal offset type in Drupal\language\ConfigurableLanguageManager->getFallbackCandidates()
This happens because the method "renderLeafletMarkers" within the class LeafletMarker in the file "leaflet/leaflet_views/src/Plugin/views/row/LeafletMarker.php" has a getViewBuilder->view method where the whole language object is inserted as a parameter. This is not correct due the fact that it should be the id of the language.
Anyhow, is it not better to get the translated entity on the query method itself of the view?
Patch will follow later.
Comment | File | Size | Author |
---|---|---|---|
#5 | get.translated.entities-2891194-5.patch | 6.21 KB | jwilson3 |
Comments
Comment #2
IJsbrandy CreditAttribution: IJsbrandy commentedThe patch
Comment #3
jwilson3Work perfectly. Thanks.
Comment #4
jwilson3I thought this was fixed but it turned up again, and I tracked the problem down to a very similar issue in LeafletMap.php, the fix in LeafletMarker.php on patch 2 is not enough to fix this.
Stack Trace:
The problem is that LeafletMap on line 421 calls EntityViewBuilderInterface::view passing an object
$entity->language()
the third parameter, but it expects that to be a string$langcode
.Here is my one-line addition and accompanying interdiff.
Comment #5
jwilson3Patch no longer applies. here is a reroll of #4.
Comment #7
itamair CreditAttribution: itamair as a volunteer commentedComment #9
jwilson3Thanks for the second fix 155f469 to fix the $entity->language()->getId(). I missed that.