From 4b4325724055428c08000c35a3e17f411bc79a6c Mon Sep 17 00:00:00 2001 From: catch Date: Thu, 11 Jul 2019 15:42:31 +0100 Subject: [PATCH] Issue #3065609 by Charlie ChX Negyesi: Document translations vs getEntity() --- .../lib/Drupal/Core/Entity/Plugin/DataType/EntityAdapter.php | 5 ++++- core/lib/Drupal/Core/Field/FieldItemListInterface.php | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/core/lib/Drupal/Core/Entity/Plugin/DataType/EntityAdapter.php b/core/lib/Drupal/Core/Entity/Plugin/DataType/EntityAdapter.php index 95ddfd36868..3154d1776f8 100644 --- a/core/lib/Drupal/Core/Entity/Plugin/DataType/EntityAdapter.php +++ b/core/lib/Drupal/Core/Entity/Plugin/DataType/EntityAdapter.php @@ -168,7 +168,10 @@ class EntityAdapter extends TypedData implements \IteratorAggregate, ComplexData * Returns the wrapped entity object. * * @return \Drupal\Core\Entity\EntityInterface - * The wrapped entity object. + * The wrapped entity object. If the entity is translatable and a specific + * translation is required, always request it by calling ::getTranslation() + * or ::getUntranslated() as the language of the returned object is not + * defined. */ public function getEntity() { return $this->entity; diff --git a/core/lib/Drupal/Core/Field/FieldItemListInterface.php b/core/lib/Drupal/Core/Field/FieldItemListInterface.php index ca24bd4e0fa..5367f39fb41 100644 --- a/core/lib/Drupal/Core/Field/FieldItemListInterface.php +++ b/core/lib/Drupal/Core/Field/FieldItemListInterface.php @@ -31,7 +31,10 @@ interface FieldItemListInterface extends ListInterface, AccessibleInterface { * Gets the entity that field belongs to. * * @return \Drupal\Core\Entity\FieldableEntityInterface - * The entity object. + * The entity object. If the entity is translatable and a specific + * translation is required, always request it by calling ::getTranslation() + * or ::getUntranslated() as the language of the returned object is not + * defined. */ public function getEntity();