protected function ProductBundle::ensureTranslations in Commerce Product Bundle 8
Ensures that the provided entities are in the current entity's language.
Parameters
\Drupal\Core\Entity\ContentEntityInterface[] $entities: The entities to process.
Return value
\Drupal\Core\Entity\ContentEntityInterface[] The processed entities.
1 call to ProductBundle::ensureTranslations()
- ProductBundle::getBundleItems in src/
Entity/ ProductBundle.php - @inheritdoc
File
- src/
Entity/ ProductBundle.php, line 439
Class
- ProductBundle
- Defines the product bundle entity.
Namespace
Drupal\commerce_product_bundle\EntityCode
protected function ensureTranslations(array $entities) {
$langcode = $this
->language()
->getId();
foreach ($entities as $index => $entity) {
/** @var \Drupal\Core\Entity\ContentEntityInterface $entity */
if ($entity
->hasTranslation($langcode)) {
$entities[$index] = $entity
->getTranslation($langcode);
}
}
return $entities;
}