public function getEntityTranslationByRelationship(EntityInterface
$entity, ResultRow
$row, string
$relationship = 'none'
): EntityInterface
{ // We assume the same language should be used for all entity fields
// belonging to a single row, even if they are attached to different entity
// types. Below we apply language fallback to ensure a valid value is always
// picked.
if ($entity instanceof TranslatableInterface &&
count($entity->
getTranslationLanguages()) > 1
) { $langcode =
$this->
getEntityTranslationRenderer()->
getLangcodeByRelationship($row,
$relationship);
$translation =
$this->
getEntityRepository()->
getTranslationFromContext($entity,
$langcode);
} return $translation ??
$entity;
} /**
* Returns the entity type identifier.
*
* @return string
* The entity type identifier.
*/
abstract public function getEntityTypeId();