function ContentTranslationUITestBase::getValue

Same name in other branches
  1. 8.9.x core/modules/content_translation/src/Tests/ContentTranslationUITestBase.php \Drupal\content_translation\Tests\ContentTranslationUITestBase::getValue()
  2. 8.9.x core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php \Drupal\Tests\content_translation\Functional\ContentTranslationUITestBase::getValue()
  3. 10 core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php \Drupal\Tests\content_translation\Functional\ContentTranslationUITestBase::getValue()
  4. 11.x core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php \Drupal\Tests\content_translation\Functional\ContentTranslationUITestBase::getValue()

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

Parameters

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

string $property: The property name.

string $langcode: The property value.

Return value

mixed The property value.

1 call to ContentTranslationUITestBase::getValue()
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 493

Class

ContentTranslationUITestBase
Tests the Content Translation UI.

Namespace

Drupal\Tests\content_translation\Functional

Code

protected function getValue(EntityInterface $translation, $property, $langcode) {
    $key = $property == 'user_id' ? 'target_id' : 'value';
    return $translation->get($property)->{$key};
}

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