Provide translated entities by default from BuildFieldTrait
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3321251. --> Reported by: [baysaa](https://www.drupal.org/user/1358394) Related to !21 >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>Entities returned from getReferencedEntityFromField is not translated.</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <p>Similar to: <a href="https://www.drupal.org/project/pluggable_entity_view_builder/issues/3292478">https://www.drupal.org/project/pluggable_entity_view_builder/issues/3292478</a> but a proposition to return translated entities by default from `BuildFieldTrait::getReferencedEntityFromField()`, as well as introduce a multi-value getter `BuildFieldTrait::getReferencedEntitiesFromField()` which also returns translated entities.</p> <h3 id="summary-api-changes">API changes</h3> <p>- `BuildFieldTrait::getReferencedEntityFromField()` returns a translated entity now. It's unnecessary to check its language or get translation for them.<br> - `BuildFieldTrait::getReferencedEntitiesFromField()` will be a new method that returns all entities from a multi-value entity reference field, and the entities will also be translated.</p>
issue