public function SerializeCdfEntityFieldEvent::getFieldTranslation in Acquia Content Hub 8.2
The field item list object for a particular language.
Parameters
string $langcode: The language of the field value to get.
Return value
\Drupal\Core\Field\FieldItemListInterface Field item list object.
File
- src/
Event/ SerializeCdfEntityFieldEvent.php, line 115
Class
- SerializeCdfEntityFieldEvent
- Event fired when serializing individual entity fields for syndication.
Namespace
Drupal\acquia_contenthub\EventCode
public function getFieldTranslation($langcode) {
$entity = $this
->getEntity()
->getTranslation($langcode);
return $entity->{$this
->getField()
->getName()};
}