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.

2 calls to EntityTranslationUITest::getValue()
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 311
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) {
  if ($translation instanceof EntityInterface && !$translation instanceof EntityNG) {
    return is_array($translation->{$property}) ? $translation->{$property}[$langcode][0]['value'] : $translation->{$property};
  }
  else {
    return $translation
      ->get($property)->value;
  }
}