protected function EntityTranslationUITest::getTranslation

Returns the translation object to use to retrieve the translated values.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity being tested.

string $langcode: The language code identifying the translation to be retrieved.

Return value

\Drupal\Core\TypedData\TranslatableInterface The translation object to act on.

2 calls to EntityTranslationUITest::getTranslation()
ConfigTestTranslationUITest::testTranslationUI in drupal/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/ConfigTestTranslationUITest.php
Overrides EntityTranslationTest::testTranslationUI().
EntityTranslationUITest::testTranslationUI in drupal/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationUITest.php
Tests the basic translation UI.

File

drupal/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationUITest.php, line 294
Definition of Drupal\entity\Tests\EntityTranslationUITest.

Class

EntityTranslationUITest
Tests the Entity Translation UI.

Namespace

Drupal\translation_entity\Tests

Code

protected function getTranslation(EntityInterface $entity, $langcode) {
  return $entity instanceof EntityNG ? $entity
    ->getTranslation($langcode) : $entity;
}