diff --git a/core/modules/views/src/Plugin/views/field/EntityField.php b/core/modules/views/src/Plugin/views/field/EntityField.php index 4c8032d..cbcaed9 100644 --- a/core/modules/views/src/Plugin/views/field/EntityField.php +++ b/core/modules/views/src/Plugin/views/field/EntityField.php @@ -1035,10 +1035,13 @@ protected function getTableMapping() { */ public function getValue(ResultRow $values, $field = NULL) { $entity = $this->getEntity($values); + // Retrieve the translated object. + $translated_entity = $this->getEntityFieldRenderer()->getEntityTranslation($entity, $values); + // Some bundles might not have a specific field, in which case the entity // (potentially a fake one) doesn't have it either. /** @var \Drupal\Core\Field\FieldItemListInterface $field_item_list */ - $field_item_list = isset($entity->{$this->definition['field_name']}) ? $entity->{$this->definition['field_name']} : NULL; + $field_item_list = isset($translated_entity->{$this->definition['field_name']}) ? $translated_entity->{$this->definition['field_name']} : NULL; if (!isset($field_item_list)) { // There isn't anything we can do without a valid field. diff --git a/core/modules/views/src/Plugin/views/field/Field.php.orig b/core/modules/views/src/Plugin/views/field/Field.php.orig deleted file mode 100644 index 625d3c8..0000000 --- a/core/modules/views/src/Plugin/views/field/Field.php.orig +++ /dev/null @@ -1,13 +0,0 @@ -getEntity($values); -+ // Retrieve the translated object. -+ $translated_entity = $this->getEntityFieldRenderer()->getEntityTranslation($entity, $values); -+ - // Some bundles might not have a specific field, in which case the entity - // (potentially a fake one) doesn't have it either. - /** @var \Drupal\Core\Field\FieldItemListInterface $field_item_list */ -- $field_item_list = isset($entity->{$this->definition['field_name']}) ? $entity->{$this->definition['field_name']} : NULL; -+ $field_item_list = isset($translated_entity->{$this->definition['field_name']}) ? $translated_entity->{$this->definition['field_name']} : NULL; - - if (!isset($field_item_list)) { - // There isn't anything we can do without a valid field. diff --git a/core/modules/views/views.module b/core/modules/views/views.module index 4e0b5dd..2026c0e 100644 --- a/core/modules/views/views.module +++ b/core/modules/views/views.module @@ -434,21 +434,21 @@ function views_add_contextual_links(&$render_element, $location, $display_id, ar } /** - * Implements hook_ENTITY_TYPE_insert(). + * Implements hook_ENTITY_TYPE_insert() for 'field_config'. */ function views_field_config_insert(EntityInterface $field) { Views::viewsData()->clear(); } /** - * Implements hook_ENTITY_TYPE_update(). + * Implements hook_ENTITY_TYPE_update() for 'field_config'. */ function views_field_config_update(EntityInterface $entity) { Views::viewsData()->clear(); } /** - * Implements hook_ENTITY_TYPE_delete(). + * Implements hook_ENTITY_TYPE_delete() for 'field_config'. */ function views_field_config_delete(EntityInterface $entity) { Views::viewsData()->clear(); diff --git a/core/modules/views/views.views.inc b/core/modules/views/views.views.inc index 68fc4cb..55448f8 100644 --- a/core/modules/views/views.views.inc +++ b/core/modules/views/views.views.inc @@ -483,6 +483,8 @@ function views_field_default_views_data(FieldStorageConfigInterface $field_stora } $group_name = $entity_type->getLabel(); + // Get the list of bundles the field appears in. + $bundles_names = $field_storage->getBundles(); // Build the list of additional fields to add to queries. $add_fields = array('delta', 'langcode', 'bundle'); foreach (array_keys($field_columns) as $column) {