function ContentTranslationUITestBase::getTranslation

Same name in other branches
  1. 8.9.x core/modules/content_translation/src/Tests/ContentTranslationUITestBase.php \Drupal\content_translation\Tests\ContentTranslationUITestBase::getTranslation()
  2. 8.9.x core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php \Drupal\Tests\content_translation\Functional\ContentTranslationUITestBase::getTranslation()
  3. 10 core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php \Drupal\Tests\content_translation\Functional\ContentTranslationUITestBase::getTranslation()
  4. 11.x core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php \Drupal\Tests\content_translation\Functional\ContentTranslationUITestBase::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.

1 call to ContentTranslationUITestBase::getTranslation()
ContentTranslationUITestBase::doTestBasicTranslation in core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php
Tests the basic translation workflow.

File

core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php, line 476

Class

ContentTranslationUITestBase
Tests the Content Translation UI.

Namespace

Drupal\Tests\content_translation\Functional

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.