Remove EntityTranslationRenderTrait from RenderedEntity views field plugin

Created on 20 October 2020, almost 5 years ago
Updated 19 August 2025, about 2 months ago

Problem/Motivation

Search results rendering are failing with some of my site content types:

Error: Call to undefined method Drupal\elasticsearch_helper_views\Plugin\views\field\RenderedEntity::getEntityRepository() in Drupal\elasticsearch_helper_views\Plugin\views\field\RenderedEntity->getEntityTranslation() (line 77 of core/modules/views/src/Entity/Render/EntityTranslationRenderTrait.php).

Steps to reproduce

Drupal 9.0.7 with ES 7.9, elasticsearch_helper:7.x-dev and elasticsearch_helper_views:8.x-7.x-dev. Content type with translatable and non-translatable fields.

I could not figure out the field config differences of that failing content type rendenring but it seems requesting for $this->getEntityTranslation() is unnecessary for the entity in the render method, results are shown in correct translation even without.

Proposed resolution

Remove unnecessary EntityTranslationRenderTrait and call to getEntityTranslation() from \Drupal\elasticsearch_helper_views\Plugin\views\field\RenderedEntity.

🐛 Bug report
Status

RTBC

Version

8.0

Component

Code

Created by

🇫🇮Finland kirkkala Helsinki

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024