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.
I have a EntityReferenceItemList
$list = {
'list' = [],
'langcode' = 'en'
}
If i try to get entities from this list:
foreact ($list as $delta => $item) {
$entity = $item->entity;
}
I get entity in default language not in ItemList language. How to get entity with language setted in ItemList?
Comments
Comment #3
amateescu CreditAttribution: amateescu for Pfizer, Inc. commentedYou can simply call getTranslation() on
$item->entity
. Something like this: