diff --git a/core/lib/Drupal/Core/Entity/EntityManager.php b/core/lib/Drupal/Core/Entity/EntityManager.php index 40f0efe..71a15ab 100644 --- a/core/lib/Drupal/Core/Entity/EntityManager.php +++ b/core/lib/Drupal/Core/Entity/EntityManager.php @@ -689,9 +689,9 @@ public function getFieldMapByFieldType($field_type) { /** * {@inheritdoc} */ - public function getFieldsReferencing($target_type, $target_bundle) { + public function getFieldsReferencing($field_type, $target_type, $target_bundle) { if (!isset($this->fieldsReferencing[$target_type][$target_bundle])) { - $map = $this->getFieldMapByFieldType('entity_reference'); + $map = $this->getFieldMapByFieldType($field_type); $ids = []; foreach ($map as $type => $info) { foreach ($info as $name => $data) { diff --git a/core/lib/Drupal/Core/Entity/EntityManagerInterface.php b/core/lib/Drupal/Core/Entity/EntityManagerInterface.php index 5626fa6..f3cbce5 100644 --- a/core/lib/Drupal/Core/Entity/EntityManagerInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityManagerInterface.php @@ -146,6 +146,8 @@ public function getFieldMapByFieldType($field_type); * Returns a list of entity reference field configurations that are targeting * a specific bundle. * + * @param string $field_type + * The the field type to be searched. * @param string $target_type * The entity type of target * @param string $target_bundle @@ -154,7 +156,7 @@ public function getFieldMapByFieldType($field_type); * @return string[] * A list of field IDs. */ - public function getFieldsReferencing($target_type, $target_bundle); + public function getFieldsReferencing($field_type, $target_type, $target_bundle); /** * Creates a new access control handler instance. diff --git a/core/modules/entity_reference/entity_reference.module b/core/modules/entity_reference/entity_reference.module index 369f7b5..96e0c6e 100644 --- a/core/modules/entity_reference/entity_reference.module +++ b/core/modules/entity_reference/entity_reference.module @@ -10,7 +10,6 @@ use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Render\Element; use Drupal\Core\Routing\RouteMatchInterface; -use Drupal\field\Entity\FieldStorageConfig; use Drupal\field\Entity\FieldConfig; use Drupal\field\FieldStorageConfigInterface; use Drupal\field\FieldConfigInterface; @@ -231,7 +230,7 @@ function entity_reference_entity_bundle_delete($entity_type, $bundle) { */ function entity_reference_sync_fields($entity_type, $bundle, $bundle_new = NULL) { $manager = \Drupal::entityManager(); - $ids = $manager->getFieldsReferencing($entity_type, $bundle); + $ids = $manager->getFieldsReferencing('entity_reference', $entity_type, $bundle); /** @var \Drupal\field\Entity\FieldConfig $field_config */ foreach (FieldConfig::loadMultiple($ids) as $field_config) { diff --git a/core/modules/entity_reference/src/Tests/EntityReferenceSettingsTest.php b/core/modules/entity_reference/src/Tests/EntityReferenceSettingsTest.php index c8d6f2a..17e986f 100644 --- a/core/modules/entity_reference/src/Tests/EntityReferenceSettingsTest.php +++ b/core/modules/entity_reference/src/Tests/EntityReferenceSettingsTest.php @@ -9,7 +9,6 @@ use Drupal\Component\Utility\Unicode; use Drupal\field\Entity\FieldConfig; -use Drupal\field\Entity\FieldStorageConfig; use Drupal\node\Entity\NodeType; use Drupal\simpletest\KernelTestBase; use Drupal\taxonomy\Entity\Vocabulary;