Returns the value for the specified property in the given language.
\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.
The property value.
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};
}
}