protected function TaxonomyStorages::getTranslationFromContext in Client-side Hierarchical Select 8
Same name and namespace in other branches
- 8.3 src/TaxonomyStorages.php \Drupal\cshs\TaxonomyStorages::getTranslationFromContext()
- 8.2 src/TaxonomyStorages.php \Drupal\cshs\TaxonomyStorages::getTranslationFromContext()
Returns the entity translation to be used in the given context.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity whose translation will be returned.
Return value
\Drupal\Core\Entity\EntityInterface The translated entity.
1 call to TaxonomyStorages::getTranslationFromContext()
- CshsFormatterBase::getTermsLabels in src/
Plugin/ Field/ FieldFormatter/ CshsFormatterBase.php - Returns the list of terms labels.
File
- src/
TaxonomyStorages.php, line 66
Class
- TaxonomyStorages
- The taxonomy storages.
Namespace
Drupal\cshsCode
protected function getTranslationFromContext(EntityInterface $entity) : EntityInterface {
if (NULL === $this->entityRepository) {
$this->entityRepository = \Drupal::service('entity.repository');
}
return $this->entityRepository
->getTranslationFromContext($entity);
}