You are here

public function CommerceContentEntityBase::getTranslatedReferencedEntities in Commerce Core 8.2

Gets the translations of an entity reference field.

Parameters

string $field_name: The entity reference field name.

Return value

\Drupal\Core\Entity\ContentEntityInterface[] The translated entities.

Overrides CommerceContentEntityInterface::getTranslatedReferencedEntities

4 calls to CommerceContentEntityBase::getTranslatedReferencedEntities()
CommerceContentEntityBase::getTranslatedReferencedEntity in src/Entity/CommerceContentEntityBase.php
Gets the translation of a referenced entity.
Product::getStores in modules/product/src/Entity/Product.php
Gets the stores.
Product::getVariations in modules/product/src/Entity/Product.php
Gets the variations.
Promotion::getStores in modules/promotion/src/Entity/Promotion.php
Gets the stores.

File

src/Entity/CommerceContentEntityBase.php, line 16

Class

CommerceContentEntityBase
Provides the base class for Commerce content entities.

Namespace

Drupal\commerce\Entity

Code

public function getTranslatedReferencedEntities($field_name) {
  $referenced_entities = $this
    ->get($field_name)
    ->referencedEntities();
  return $this
    ->ensureTranslations($referenced_entities);
}