diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php index 22f36c7a8fa..baf83b6011e 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php @@ -283,12 +283,11 @@ class EntityReferenceItem extends FieldItemBase implements OptionsProviderInterf $options = [ 'target_type' => $field_definition->getFieldStorageDefinition()->getSetting('target_type'), 'handler' => $field_definition->getSetting('handler'), - 'handler_settings' => $field_definition->getSetting('handler_settings') ?: [], 'entity' => NULL, - ]; + ] + $field_definition->getSetting('handler_settings') ?: []; $entity_type = \Drupal::entityTypeManager()->getDefinition($options['target_type']); - $options['handler_settings']['sort'] = [ + $options['sort'] = [ 'field' => $entity_type->getKey('id'), 'direction' => 'DESC', ]; @@ -305,7 +304,7 @@ class EntityReferenceItem extends FieldItemBase implements OptionsProviderInterf // Attempt to create a sample entity, avoiding recursion. $entity_storage = \Drupal::entityTypeManager()->getStorage($options['target_type']); if ($entity_storage instanceof ContentEntityStorageInterface) { - $bundle = static::getRandomBundle($entity_type, $options['handler_settings']); + $bundle = static::getRandomBundle($entity_type, $options); // Track the generated entity by reference type, target type, and bundle. $key = $field_definition->getTargetEntityTypeId() . ':' . $options['target_type'] . ':' . $bundle; diff --git a/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php b/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php index 65b0b35d060..4265028db64 100644 --- a/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php +++ b/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php @@ -123,7 +123,6 @@ trait DeprecationListenerTrait { 'MigrateCckFieldPluginManager is deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.x. Use \Drupal\migrate_drupal\Annotation\MigrateFieldPluginManager instead.', 'MigrateCckFieldPluginManagerInterface is deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.x. Use \Drupal\migrate_drupal\Annotation\MigrateFieldPluginManagerInterface instead.', 'The "plugin.manager.migrate.cckfield" service is deprecated. You should use the \'plugin.manager.migrate.field\' service instead. See https://www.drupal.org/node/2751897', - 'Providing settings under \'handler_settings\' is deprecated and will be removed before 9.0.0. Move the settings in the root of the configuration array. See https://www.drupal.org/node/2870971.', 'The Drupal\editor\Plugin\EditorBase::settingsFormValidate method is deprecated since version 8.3.x and will be removed in 9.0.0.', 'The Drupal\migrate\Plugin\migrate\process\Migration is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Instead, use Drupal\migrate\Plugin\migrate\process\MigrationLookup', 'Drupal\system\Plugin\views\field\BulkForm is deprecated in Drupal 8.5.x, will be removed before Drupal 9.0.0. Use \Drupal\views\Plugin\views\field\BulkForm instead. See https://www.drupal.org/node/2916716.',