diff --git a/core/modules/migrate/src/EntityFieldDefinitionTrait.php b/core/modules/migrate/src/EntityFieldDefinitionTrait.php index 6489287b43..d014b8f36c 100644 --- a/core/modules/migrate/src/EntityFieldDefinitionTrait.php +++ b/core/modules/migrate/src/EntityFieldDefinitionTrait.php @@ -25,14 +25,7 @@ trait EntityFieldDefinitionTrait { * @see \Drupal\Core\Field\FieldStorageDefinitionInterface::getSettings() */ protected function getDefinitionFromEntity($key) { - // For destination plugins the entity type id is obtained from the - // plugin id otherwise get it from use the entityType. - if ($this->entityType) { - $entity_type_id = $this->entityType->id(); - } - else { - $entity_type_id = static::getEntityTypeId($this->getPluginId()); - } + $entity_type_id = static::getEntityTypeId($this->getPluginId()); /** @var \Drupal\Core\Field\FieldStorageDefinitionInterface[] $definitions */ $definitions = $this->entityFieldManager->getBaseFieldDefinitions($entity_type_id); $field_definition = $definitions[$key]; diff --git a/core/modules/migrate_drupal/src/Plugin/migrate/source/ContentEntity.php b/core/modules/migrate_drupal/src/Plugin/migrate/source/ContentEntity.php index e80de1b7f8..87b0dc5f2e 100644 --- a/core/modules/migrate_drupal/src/Plugin/migrate/source/ContentEntity.php +++ b/core/modules/migrate_drupal/src/Plugin/migrate/source/ContentEntity.php @@ -136,6 +136,20 @@ public static function create(ContainerInterface $container, array $configuratio ); } + /** + * Finds the entity type from configuration or plugin ID. + * + * @param string $plugin_id + * The plugin ID. + * + * @return string + * The entity type. + */ + protected static function getEntityTypeId($plugin_id) { + // Remove "content_entity:". + return substr($plugin_id, 15); + } + /** * {@inheritdoc} */