diff --git a/core/modules/entity_reference/entity_reference.views.inc b/core/modules/entity_reference/entity_reference.views.inc index 47f0179..30ae09d 100644 --- a/core/modules/entity_reference/entity_reference.views.inc +++ b/core/modules/entity_reference/entity_reference.views.inc @@ -5,7 +5,6 @@ * Provides views data for the entity_reference module. */ -use Drupal\Core\Entity\ContentEntityDatabaseStorage; use Drupal\field\FieldConfigInterface; /** @@ -14,6 +13,7 @@ function entity_reference_field_views_data(FieldConfigInterface $field) { $data = field_views_field_default_views_data($field); $entity_manager = \Drupal::entityManager(); + $table_mapping = $entity_manager->getStorage($field->getTargetEntityTypeId())->getTableMapping(); foreach ($data as $table_name => $table_data) { // Add a relationship to the target entity type. $target_entity_type_id = $field->getSetting('target_type'); @@ -44,7 +44,7 @@ function entity_reference_field_views_data(FieldConfigInterface $field) { 'help' => t('Relate each @label with a @field_name.', $args), 'id' => 'entity_reverse', 'field_name' => $field->getName(), - 'field table' => ContentEntityDatabaseStorage::_fieldTableName($field), + 'field table' => $table_mapping->getDedicatedDataTableName($field), 'field field' => $field->getName() . '_target_id', 'base' => $target_entity_type->getBaseTable(), 'base field' => $target_entity_type->getKey('id'), diff --git a/core/modules/field/field.views.inc b/core/modules/field/field.views.inc index 573cfd9..8662b4b 100644 --- a/core/modules/field/field.views.inc +++ b/core/modules/field/field.views.inc @@ -69,8 +69,8 @@ function field_views_data_alter(&$data) { function _field_views_get_entity_type_storage(FieldConfigInterface $field) { $result = FALSE; $entity_manager = \Drupal::entityManager(); - if ($entity_manager->hasDefinition($field->getEntityTypeId())) { - $storage = $entity_manager->getStorage($field->getEntityTypeId()); + if ($entity_manager->hasDefinition($field->getTargetEntityTypeId())) { + $storage = $entity_manager->getStorage($field->getTargetEntityTypeId()); $result = $storage instanceof ContentEntityDatabaseStorage ? $storage : FALSE; } return $result; @@ -136,7 +136,7 @@ function field_views_field_default_views_data(FieldConfigInterface $field) { // Grab information about the entity type tables. $entity_manager = \Drupal::entityManager(); - $entity_type_id = $field->getEntityTypeId(); + $entity_type_id = $field->getTargetEntityTypeId(); $entity_type = $entity_manager->getDefinition($entity_type_id); if (!$entity_table = $entity_type->getBaseTable()) { return $data; diff --git a/core/modules/image/image.views.inc b/core/modules/image/image.views.inc index dab3d52..3fdb59a 100644 --- a/core/modules/image/image.views.inc +++ b/core/modules/image/image.views.inc @@ -36,7 +36,7 @@ function image_field_views_data(FieldConfigInterface $field) { * Views integration to provide reverse relationships on image fields. */ function image_field_views_data_views_data_alter(array &$data, FieldConfigInterface $field) { - $entity_type_id = $field->getEntityTypeId(); + $entity_type_id = $field->getTargetEntityTypeId(); $field_name = $field->getName(); $entity_manager = \Drupal::entityManager(); $entity_type = $entity_manager->getDefinition($entity_type_id); diff --git a/core/modules/taxonomy/taxonomy.views.inc b/core/modules/taxonomy/taxonomy.views.inc index eb5f429..3ff26f3 100644 --- a/core/modules/taxonomy/taxonomy.views.inc +++ b/core/modules/taxonomy/taxonomy.views.inc @@ -419,7 +419,7 @@ function taxonomy_field_views_data(FieldConfigInterface $field) { */ function taxonomy_field_views_data_views_data_alter(array &$data, FieldConfigInterface $field) { $field_name = $field->getName(); - $entity_type_id = $field->getEntityTypeId(); + $entity_type_id = $field->getTargetEntityTypeId(); $entity_manager = \Drupal::entityManager(); $entity_type = $entity_manager->getDefinition($entity_type_id); $pseudo_field_name = 'reverse_' . $field_name . '_' . $entity_type_id;