protected function EntityTranslationUITest::getValue

Returns the value for the specified property in the given language.

Parameters

\Drupal\Core\TypedData\TranslatableInterface $translation: The translation object the property value should be retrieved from.

string $property: The property name.

string $langcode: The property value.

Return value

The property value.

3 calls to EntityTranslationUITest::getValue()
CommentTranslationUITest::assertPublishedStatus in drupal/core/modules/comment/lib/Drupal/comment/Tests/CommentTranslationUITest.php
Overrides \Drupal\translation_entity\Tests\EntityTranslationUITest::assertPublishedStatus().
ConfigTestTranslationUITest::testTranslationUI in drupal/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/ConfigTestTranslationUITest.php
Overrides EntityTranslationTest::testTranslationUI().
EntityTranslationUITest::assertBasicTranslation in drupal/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationUITest.php
Tests the basic translation workflow.

File

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

Class

EntityTranslationUITest
Tests the Entity Translation UI.

Namespace

Drupal\translation_entity\Tests

Code

protected function getValue(ComplexDataInterface $translation, $property, $langcode) {
  $key = $property == 'user_id' ? 'target_id' : 'value';

  // @todo remove EntityBCDecorator condition once EntityBCDecorator is gone.
  if ($translation instanceof EntityInterface && !$translation instanceof EntityNG && !$translation instanceof EntityBCDecorator) {
    return is_array($translation->{$property}) ? $translation->{$property}[$langcode][0][$key] : $translation->{$property};
  }
  else {
    return $translation
      ->get($property)->{$key};
  }
}