diff --git a/core/MAINTAINERS.txt b/core/MAINTAINERS.txt
index 9408d57..c0c7175 100644
--- a/core/MAINTAINERS.txt
+++ b/core/MAINTAINERS.txt
@@ -316,10 +316,6 @@ Email module
 Editor module
 - Wim Leers 'Wim Leers' https://www.drupal.org/u/wim-leers
 
-Entity Reference module
-- Amitai Burstein 'Amitaibu' https://www.drupal.org/u/amitaibu
-- Andrei Mateescu 'amateescu' https://www.drupal.org/u/amateescu
-
 Field UI module
 - Yves Chedemois 'yched' https://www.drupal.org/u/yched
 - Kristof De Jaeger 'swentel' https://www.drupal.org/u/swentel
diff --git a/core/config/schema/core.data_types.schema.yml b/core/config/schema/core.data_types.schema.yml
index 79e3f14..d39c94e 100644
--- a/core/config/schema/core.data_types.schema.yml
+++ b/core/config/schema/core.data_types.schema.yml
@@ -357,9 +357,6 @@ base_entity_reference_field_settings:
     target_type:
       type: string
       label: 'Type of item to reference'
-    target_bundle:
-      type: string
-      label: 'Bundle of item to reference'
 
 field_config_base:
   type: config_entity
diff --git a/core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionInterface.php b/core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionInterface.php
index 65d86c9..631cfbf 100644
--- a/core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionInterface.php
+++ b/core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionInterface.php
@@ -65,8 +65,6 @@ public function validateReferenceableEntities(array $ids);
    *
    * @return integer|null
    *   Value of a matching entity ID, or NULL if none.
-   *
-   * @see \Drupal\entity_reference\Plugin\Field\FieldWidget::elementValidate()
    */
   public function validateAutocompleteInput($input, &$element, FormStateInterface $form_state, $form, $strict = TRUE);
 
diff --git a/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/SelectionBase.php b/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/SelectionBase.php
index cb8c7d6..86af539 100644
--- a/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/SelectionBase.php
+++ b/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/SelectionBase.php
@@ -12,6 +12,7 @@
 use Drupal\Core\Database\Query\SelectInterface;
 use Drupal\Core\Entity\EntityManagerInterface;
 use Drupal\Core\Extension\ModuleHandlerInterface;
+use Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Entity\EntityReferenceSelection\SelectionInterface;
 use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
@@ -132,7 +133,7 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta
         '#required' => TRUE,
         '#size' => 6,
         '#multiple' => TRUE,
-        '#element_validate' => array('_entity_reference_element_validate_filter'),
+        '#element_validate' => array(array(get_class($this), 'elementValidateFilter')),
       );
     }
     else {
@@ -179,7 +180,7 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta
       $form['sort']['settings'] = array(
         '#type' => 'container',
         '#attributes' => array('class' => array('entity_reference-settings')),
-        '#process' => array('_entity_reference_form_process_merge_parent'),
+        '#process' => array(array('\Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem', 'formProcessMergeParent')),
       );
 
       if ($selection_handler_settings['sort']['field'] != '_none') {
@@ -215,6 +216,16 @@ public function validateConfigurationForm(array &$form, FormStateInterface $form
   public function submitConfigurationForm(array &$form, FormStateInterface $form_state) { }
 
   /**
+   * Form element validation handler; Filters the #value property of an element.
+   *
+   * @todo Move some form of this to Form API itself?
+   */
+  public static function elementValidateFilter(&$element, FormStateInterface $form_state) {
+    $element['#value'] = array_filter($element['#value']);
+    $form_state->setValueForElement($element, $element['#value']);
+  }
+
+  /**
    * {@inheritdoc}
    */
   public function getReferenceableEntities($match = NULL, $match_operator = 'CONTAINS', $limit = 0) {
@@ -338,8 +349,8 @@ protected function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS')
     $query->addTag($target_type . '_access');
 
     // Add the Selection handler for
-    // entity_reference_query_entity_reference_alter().
-    $query->addTag('entity_reference');
+    // system_query_entity_reference_selection_alter().
+    $query->addTag('entity_reference_selection');
     $query->addMetaData('entity_reference_selection_handler', $this);
 
     // Add the sort option.
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 6942f8c..d9666a5 100644
--- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php
+++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php
@@ -7,6 +7,8 @@
 
 namespace Drupal\Core\Field\Plugin\Field\FieldType;
 
+use Drupal\Component\Utility\NestedArray;
+use Drupal\Component\Utility\SafeMarkup;
 use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Entity\EntityTypeInterface;
 use Drupal\Core\Entity\TypedData\EntityDataDefinition;
@@ -14,30 +16,35 @@
 use Drupal\Core\Field\FieldItemBase;
 use Drupal\Core\Field\FieldStorageDefinitionInterface;
 use Drupal\Core\StringTranslation\TranslationWrapper;
+use Drupal\Core\Field\PreconfiguredFieldUiOptionsInterface;
+use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Form\OptGroup;
+use Drupal\Core\Render\Element;
+use Drupal\Core\Session\AccountInterface;
 use Drupal\Core\TypedData\DataDefinition;
 use Drupal\Core\TypedData\DataReferenceDefinition;
+use Drupal\Core\TypedData\OptionsProviderInterface;
+use Drupal\Core\Validation\Plugin\Validation\Constraint\AllowedValuesConstraint;
 
 /**
  * Defines the 'entity_reference' entity field type.
  *
  * Supported settings (below the definition's 'settings' key) are:
  * - target_type: The entity type to reference. Required.
- * - target_bundle: (optional): If set, restricts the entity bundles which may
- *   may be referenced. May be set to an single bundle, or to an array of
- *   allowed bundles.
  *
  * @FieldType(
  *   id = "entity_reference",
  *   label = @Translation("Entity reference"),
  *   description = @Translation("An entity field containing an entity reference."),
  *   category = @Translation("Reference"),
- *   no_ui = TRUE,
  *   default_formatter = "entity_reference_label",
  *   list_class = "\Drupal\Core\Field\EntityReferenceFieldItemList",
+ *   default_widget = "entity_reference_autocomplete",
+ *   default_formatter = "entity_reference_label",
  *   constraints = {"ValidReference" = {}}
  * )
  */
-class EntityReferenceItem extends FieldItemBase {
+class EntityReferenceItem extends FieldItemBase implements OptionsProviderInterface, PreconfiguredFieldUiOptionsInterface {
 
   /**
    * Marker value to identify a newly created entity.
@@ -52,7 +59,6 @@ class EntityReferenceItem extends FieldItemBase {
   public static function defaultStorageSettings() {
     return array(
       'target_type' => \Drupal::moduleHandler()->moduleExists('node') ? 'node' : 'user',
-      'target_bundle' => NULL,
     ) + parent::defaultStorageSettings();
   }
 
@@ -102,14 +108,11 @@ public static function propertyDefinitions(FieldStorageDefinitionInterface $fiel
       ->setTargetDefinition(EntityDataDefinition::create($settings['target_type']))
       ->addConstraint('EntityType', $settings['target_type']);
 
-    if (isset($settings['target_bundle'])) {
-      $properties['entity']->addConstraint('Bundle', $settings['target_bundle']);
-      // Set any further bundle constraints on the target definition as well,
-      // such that it can derive more special data types if possible. For
-      // example, "entity:node:page" instead of "entity:node".
-      $properties['entity']->getTargetDefinition()
-        ->addConstraint('Bundle', $settings['target_bundle']);
+    if (!empty($settings['handler_settings']['target_bundles'])) {
+      $properties['entity']
+        ->addConstraint('Bundle', $settings['handler_settings']['target_bundles']);
     }
+
     return $properties;
   }
 
@@ -242,6 +245,23 @@ public function isEmpty() {
   /**
    * {@inheritdoc}
    */
+  public function getConstraints() {
+    $constraints = parent::getConstraints();
+
+    // Remove the 'AllowedValuesConstraint' validation constraint because entity
+    // reference fields already use the 'ValidReference' constraint.
+    foreach ($constraints as $key => $constraint) {
+      if ($constraint instanceof AllowedValuesConstraint) {
+        unset($constraints[$key]);
+      }
+    }
+
+    return $constraints;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
   public function preSave() {
     if ($this->hasNewEntity()) {
       // Save the entity if it has not already been saved by some other code.
@@ -267,6 +287,107 @@ public static function generateSampleValue(FieldDefinitionInterface $field_defin
   }
 
   /**
+   * {@inheritdoc}
+   */
+  public function storageSettingsForm(array &$form, FormStateInterface $form_state, $has_data) {
+    $element['target_type'] = array(
+      '#type' => 'select',
+      '#title' => t('Type of item to reference'),
+      '#options' => \Drupal::entityManager()->getEntityTypeLabels(TRUE),
+      '#default_value' => $this->getSetting('target_type'),
+      '#required' => TRUE,
+      '#disabled' => $has_data,
+      '#size' => 1,
+    );
+
+    return $element;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function fieldSettingsForm(array $form, FormStateInterface $form_state) {
+    $field = $form_state->getFormObject()->getEntity();
+
+    // Get all selection plugins for this entity type.
+    $selection_plugins = \Drupal::service('plugin.manager.entity_reference_selection')->getSelectionGroups($this->getSetting('target_type'));
+    $handlers_options = array();
+    foreach (array_keys($selection_plugins) as $selection_group_id) {
+      // We only display base plugins (e.g. 'default', 'views', ...) and not
+      // entity type specific plugins (e.g. 'default:node', 'default:user',
+      // ...).
+      if (array_key_exists($selection_group_id, $selection_plugins[$selection_group_id])) {
+        $handlers_options[$selection_group_id] = SafeMarkup::checkPlain($selection_plugins[$selection_group_id][$selection_group_id]['label']);
+      }
+      elseif (array_key_exists($selection_group_id . ':' . $this->getSetting('target_type'), $selection_plugins[$selection_group_id])) {
+        $selection_group_plugin = $selection_group_id . ':' . $this->getSetting('target_type');
+        $handlers_options[$selection_group_plugin] = SafeMarkup::checkPlain($selection_plugins[$selection_group_id][$selection_group_plugin]['base_plugin_label']);
+      }
+    }
+
+    $form = array(
+      '#type' => 'container',
+      '#process' => array(array(get_class($this), 'fieldSettingsAjaxProcess')),
+      '#element_validate' => array(array(get_class($this), 'fieldSettingsFormValidate')),
+
+    );
+    $form['handler'] = array(
+      '#type' => 'details',
+      '#title' => t('Reference type'),
+      '#open' => TRUE,
+      '#tree' => TRUE,
+      '#process' => array(array(get_class($this), 'formProcessMergeParent')),
+    );
+
+    $form['handler']['handler'] = array(
+      '#type' => 'select',
+      '#title' => t('Reference method'),
+      '#options' => $handlers_options,
+      '#default_value' => $field->getSetting('handler'),
+      '#required' => TRUE,
+      '#ajax' => TRUE,
+      '#limit_validation_errors' => array(),
+    );
+    $form['handler']['handler_submit'] = array(
+      '#type' => 'submit',
+      '#value' => t('Change handler'),
+      '#limit_validation_errors' => array(),
+      '#attributes' => array(
+        'class' => array('js-hide'),
+      ),
+      '#submit' => array(array(get_class($this), 'settingsAjaxSubmit')),
+    );
+
+    $form['handler']['handler_settings'] = array(
+      '#type' => 'container',
+      '#attributes' => array('class' => array('entity_reference-settings')),
+    );
+
+    $handler = \Drupal::service('plugin.manager.entity_reference_selection')->getSelectionHandler($field);
+    $form['handler']['handler_settings'] += $handler->buildConfigurationForm(array(), $form_state);
+
+    return $form;
+  }
+
+  /**
+   * Form element validation handler; Stores the new values in the form state.
+   *
+   * @param array $form
+   *   The form where the settings form is being included in.
+   * @param \Drupal\Core\Form\FormStateInterface $form_state
+   *   The form state of the (entire) configuration form.
+   */
+  public static function fieldSettingsFormValidate(array $form, FormStateInterface $form_state) {
+    if ($form_state->hasValue('field')) {
+      $form_state->unsetValue(array('field', 'settings', 'handler_submit'));
+      $form_state->get('field')->settings = $form_state->getValue(['field', 'settings']);
+
+      $handler = \Drupal::service('plugin.manager.entity_reference_selection')->getSelectionHandler($form_state->get('field'));
+      $handler->validateConfigurationForm($form, $form_state);
+    }
+  }
+
+  /**
    * Determines whether the item holds an unsaved entity.
    *
    * This is notably used for "autocreate" widgets, and more generally to
@@ -322,4 +443,141 @@ public static function onDependencyRemoval(FieldDefinitionInterface $field_defin
     return $changed;
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  public function getPossibleValues(AccountInterface $account = NULL) {
+    return $this->getSettableValues($account);
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getPossibleOptions(AccountInterface $account = NULL) {
+    return $this->getSettableOptions($account);
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getSettableValues(AccountInterface $account = NULL) {
+    // Flatten options first, because "settable options" may contain group
+    // arrays.
+    $flatten_options = OptGroup::flattenOptions($this->getSettableOptions($account));
+    return array_keys($flatten_options);
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getSettableOptions(AccountInterface $account = NULL) {
+    $field_definition = $this->getFieldDefinition();
+    if (!$options = \Drupal::service('plugin.manager.entity_reference_selection')->getSelectionHandler($field_definition, $this->getEntity())->getReferenceableEntities()) {
+      return array();
+    }
+
+    // Rebuild the array by changing the bundle key into the bundle label.
+    $target_type = $field_definition->getSetting('target_type');
+    $bundles = \Drupal::entityManager()->getBundleInfo($target_type);
+
+    $return = array();
+    foreach ($options as $bundle => $entity_ids) {
+      $bundle_label = SafeMarkup::checkPlain($bundles[$bundle]['label']);
+      $return[$bundle_label] = $entity_ids;
+    }
+
+    return count($return) == 1 ? reset($return) : $return;
+  }
+
+  /**
+   * Render API callback: Processes the field settings form and allows access to
+   * the form state.
+   *
+   * @see static::fieldSettingsForm()
+   */
+  public static function fieldSettingsAjaxProcess($form, FormStateInterface $form_state) {
+    static::fieldSettingsAjaxProcessElement($form, $form);
+    return $form;
+  }
+
+  /**
+   * Adds entity_reference specific properties to AJAX form elements from the
+   * field settings form.
+   *
+   * @see static::fieldSettingsAjaxProcess()
+   */
+  public static function fieldSettingsAjaxProcessElement(&$element, $main_form) {
+    if (!empty($element['#ajax'])) {
+      $element['#ajax'] = array(
+        'callback' => array(get_called_class(), 'settingsAjax'),
+        'wrapper' => $main_form['#id'],
+        'element' => $main_form['#array_parents'],
+      );
+    }
+
+    foreach (Element::children($element) as $key) {
+      static::fieldSettingsAjaxProcessElement($element[$key], $main_form);
+    }
+  }
+
+  /**
+   * Render API callback: Moves entity_reference specific Form API elements
+   * (i.e. 'handler_settings') up a level for easier processing by the validation
+   * and submission handlers.
+   *
+   * @see _entity_reference_field_settings_process()
+   */
+  public static function formProcessMergeParent($element) {
+    $parents = $element['#parents'];
+    array_pop($parents);
+    $element['#parents'] = $parents;
+    return $element;
+  }
+
+  /**
+   * Ajax callback for the handler settings form.
+   *
+   * @see static::fieldSettingsForm()
+   */
+  public static function settingsAjax($form, FormStateInterface $form_state) {
+    return NestedArray::getValue($form, $form_state->getTriggeringElement()['#ajax']['element']);
+  }
+
+  /**
+   * Submit handler for the non-JS case.
+   *
+   * @see static::fieldSettingsForm()
+   */
+  public static function settingsAjaxSubmit($form, FormStateInterface $form_state) {
+    $form_state->setRebuild();
+  }
+
+    /**
+   * {@inheritdoc}
+   */
+  public static function getPreconfiguredOptions() {
+    $options = array();
+
+    // Add all the commonly referenced entity types as distinct pre-configured
+    // options.
+    $entity_types = \Drupal::entityManager()->getDefinitions();
+    $common_references = array_filter($entity_types, function (EntityTypeInterface $entity_type) {
+      return $entity_type->isCommonReferenceTarget();
+    });
+
+    /** @var \Drupal\Core\Entity\EntityTypeInterface $entity_type */
+    foreach ($common_references as $entity_type) {
+      $options[$entity_type->id()] = [
+        'label' => $entity_type->getLabel(),
+        'field_storage_config' => [
+          'settings' => [
+            'target_type' => $entity_type->id(),
+          ]
+        ]
+      ];
+    }
+
+    return $options;
+  }
+
 }
diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/OptionsButtonsWidget.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/OptionsButtonsWidget.php
index 4f51a2e..4bcaaa9 100644
--- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/OptionsButtonsWidget.php
+++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/OptionsButtonsWidget.php
@@ -18,6 +18,7 @@
  *   label = @Translation("Check boxes/radio buttons"),
  *   field_types = {
  *     "boolean",
+ *     "entity_reference",
  *     "list_integer",
  *     "list_float",
  *     "list_string",
diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/OptionsSelectWidget.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/OptionsSelectWidget.php
index d64d5f9..5c68a8f 100644
--- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/OptionsSelectWidget.php
+++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/OptionsSelectWidget.php
@@ -18,6 +18,7 @@
  *   id = "options_select",
  *   label = @Translation("Select list"),
  *   field_types = {
+ *     "entity_reference",
  *     "list_integer",
  *     "list_float",
  *     "list_string"
diff --git a/core/modules/aggregator/aggregator.info.yml b/core/modules/aggregator/aggregator.info.yml
index 5814712..af55280 100644
--- a/core/modules/aggregator/aggregator.info.yml
+++ b/core/modules/aggregator/aggregator.info.yml
@@ -6,6 +6,5 @@ version: VERSION
 core: 8.x
 configure: aggregator.admin_settings
 dependencies:
-  - entity_reference
   - file
   - options
diff --git a/core/modules/aggregator/config/install/core.entity_view_display.aggregator_item.aggregator_item.summary.yml b/core/modules/aggregator/config/install/core.entity_view_display.aggregator_item.aggregator_item.summary.yml
index 6cb424d..4564bfe 100644
--- a/core/modules/aggregator/config/install/core.entity_view_display.aggregator_item.aggregator_item.summary.yml
+++ b/core/modules/aggregator/config/install/core.entity_view_display.aggregator_item.aggregator_item.summary.yml
@@ -17,4 +17,3 @@ dependencies:
     - core.entity_view_mode.aggregator_item.summary
   module:
     - aggregator
-    - entity_reference
diff --git a/core/modules/aggregator/src/Tests/AggregatorTitleTest.php b/core/modules/aggregator/src/Tests/AggregatorTitleTest.php
index cfa9975..d599d9a 100644
--- a/core/modules/aggregator/src/Tests/AggregatorTitleTest.php
+++ b/core/modules/aggregator/src/Tests/AggregatorTitleTest.php
@@ -24,7 +24,7 @@ class AggregatorTitleTest extends KernelTestBase {
    *
    * @var array
    */
-  public static $modules = array('file', 'field', 'options', 'aggregator', 'entity_reference');
+  public static $modules = ['file', 'field', 'options', 'aggregator'];
 
   /**
    * The field name that is tested.
diff --git a/core/modules/book/config/install/core.entity_form_display.node.book.default.yml b/core/modules/book/config/install/core.entity_form_display.node.book.default.yml
index 0b7ccf6..4c2ea9d 100644
--- a/core/modules/book/config/install/core.entity_form_display.node.book.default.yml
+++ b/core/modules/book/config/install/core.entity_form_display.node.book.default.yml
@@ -5,7 +5,6 @@ dependencies:
     - field.field.node.book.body
     - node.type.book
   module:
-    - entity_reference
     - text
 id: node.book.default
 targetEntityType: node
diff --git a/core/modules/book/src/Tests/BookUninstallTest.php b/core/modules/book/src/Tests/BookUninstallTest.php
index c3739d8..02aa3d1 100644
--- a/core/modules/book/src/Tests/BookUninstallTest.php
+++ b/core/modules/book/src/Tests/BookUninstallTest.php
@@ -23,7 +23,7 @@ class BookUninstallTest extends KernelTestBase {
    *
    * @var array
    */
-  public static $modules = array('system', 'user', 'field', 'filter', 'text', 'entity_reference', 'node', 'book');
+  public static $modules = ['system', 'user', 'field', 'filter', 'text', 'node', 'book'];
 
   /**
    * {@inheritdoc}
diff --git a/core/modules/book/src/Tests/Migrate/d6/MigrateBookConfigsTest.php b/core/modules/book/src/Tests/Migrate/d6/MigrateBookConfigsTest.php
index 9d7a229..1048fb0 100644
--- a/core/modules/book/src/Tests/Migrate/d6/MigrateBookConfigsTest.php
+++ b/core/modules/book/src/Tests/Migrate/d6/MigrateBookConfigsTest.php
@@ -24,7 +24,7 @@ class MigrateBookConfigsTest extends MigrateDrupal6TestBase {
    *
    * @var array
    */
-  public static $modules = array('book', 'system', 'node', 'field', 'text', 'entity_reference');
+  public static $modules = ['book', 'system', 'node', 'field', 'text'];
 
   /**
    * {@inheritdoc}
diff --git a/core/modules/book/src/Tests/Migrate/d6/MigrateBookTest.php b/core/modules/book/src/Tests/Migrate/d6/MigrateBookTest.php
index b0ebebb..e89bab8 100644
--- a/core/modules/book/src/Tests/Migrate/d6/MigrateBookTest.php
+++ b/core/modules/book/src/Tests/Migrate/d6/MigrateBookTest.php
@@ -17,7 +17,7 @@
  */
 class MigrateBookTest extends MigrateDrupal6TestBase {
 
-  public static $modules = array('book', 'system', 'node', 'field', 'text', 'entity_reference', 'user');
+  public static $modules = ['book', 'system', 'node', 'field', 'text', 'user'];
 
   /**
    * {@inheritdoc}
diff --git a/core/modules/config/src/Tests/ConfigImportRecreateTest.php b/core/modules/config/src/Tests/ConfigImportRecreateTest.php
index 83ea2ee..96f8817 100644
--- a/core/modules/config/src/Tests/ConfigImportRecreateTest.php
+++ b/core/modules/config/src/Tests/ConfigImportRecreateTest.php
@@ -32,7 +32,7 @@ class ConfigImportRecreateTest extends KernelTestBase {
    *
    * @var array
    */
-  public static $modules = array('system', 'field', 'text', 'user', 'node', 'entity_reference');
+  public static $modules = ['system', 'field', 'text', 'user', 'node'];
 
   protected function setUp() {
     parent::setUp();
diff --git a/core/modules/config/src/Tests/ConfigImportRenameValidationTest.php b/core/modules/config/src/Tests/ConfigImportRenameValidationTest.php
index 118c1cb..8857a32 100644
--- a/core/modules/config/src/Tests/ConfigImportRenameValidationTest.php
+++ b/core/modules/config/src/Tests/ConfigImportRenameValidationTest.php
@@ -34,7 +34,7 @@ class ConfigImportRenameValidationTest extends KernelTestBase {
    *
    * @var array
    */
-  public static $modules = array('system', 'user', 'node', 'field', 'text', 'config_test', 'entity_reference');
+  public static $modules = ['system', 'user', 'node', 'field', 'text', 'config_test'];
 
   /**
    * {@inheritdoc}
diff --git a/core/modules/config/src/Tests/ConfigImporterTest.php b/core/modules/config/src/Tests/ConfigImporterTest.php
index e39baf6..7ef7935 100644
--- a/core/modules/config/src/Tests/ConfigImporterTest.php
+++ b/core/modules/config/src/Tests/ConfigImporterTest.php
@@ -589,7 +589,7 @@ public function testUnmetDependency() {
       $error_log = $this->configImporter->getErrors();
       $expected = [
         'Unable to install the <em class="placeholder">unknown_module</em> module since it does not exist.',
-        'Unable to install the <em class="placeholder">Book</em> module since it requires the <em class="placeholder">Node, Text, Field, Filter, User, Entity Reference</em> modules.',
+        'Unable to install the <em class="placeholder">Book</em> module since it requires the <em class="placeholder">Node, Text, Field, Filter, User</em> modules.',
         'Unable to install the <em class="placeholder">unknown_theme</em> theme since it does not exist.',
         'Unable to install the <em class="placeholder">Bartik</em> theme since it requires the <em class="placeholder">Classy</em> theme.',
         'Configuration <em class="placeholder">config_test.dynamic.dotted.config</em> depends on the <em class="placeholder">unknown</em> configuration that will not exist after import.',
diff --git a/core/modules/entity_reference/config/schema/entity_reference.views.schema.yml b/core/modules/entity_reference/config/schema/entity_reference.views.schema.yml
deleted file mode 100644
index 2660e53..0000000
--- a/core/modules/entity_reference/config/schema/entity_reference.views.schema.yml
+++ /dev/null
@@ -1,20 +0,0 @@
-# Schema for the views plugins of the Entity Reference module.
-
-views.display.entity_reference:
-  type: views_display
-  label: 'Entity Reference'
-
-views.row.entity_reference:
-  type: views.row.fields
-  label: 'Entity Reference inline fields'
-
-views.style.entity_reference:
-  type: views_style
-  label: 'Entity Reference list'
-  mapping:
-    search_fields:
-      type: sequence
-      label: 'Search fields'
-      sequence:
-        type: string
-        label: 'Search field'
diff --git a/core/modules/entity_reference/entity_reference.module b/core/modules/entity_reference/entity_reference.module
index e206dee..bd84b7c 100644
--- a/core/modules/entity_reference/entity_reference.module
+++ b/core/modules/entity_reference/entity_reference.module
@@ -2,211 +2,7 @@
 
 /**
  * @file
- * Provides a field that can reference other entities.
+ * The functionality of 'Entity Referenece' module was moved in core, in
+ * https://www.drupal.org/node/2429191. The module will be removed from code
+ * base in the next release.
  */
-
-use Drupal\Component\Utility\NestedArray;
-use Drupal\Core\Database\Query\AlterableInterface;
-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;
-
-/**
- * Implements hook_help().
- */
-function entity_reference_help($route_name, RouteMatchInterface $route_match) {
-  switch ($route_name) {
-    case 'help.page.entity_reference':
-      $output = '';
-      $output .= '<h3>' . t('About') . '</h3>';
-      $output .= '<p>' . t('The Entity Reference module allows you to create fields that contain links to other entities (such as content items, taxonomy terms, etc.) within the site. This allows you, for example, to include a link to a user within a content item. For more information, see <a href="!er_do">the online documentation for the Entity Reference module</a> and the <a href="!field_help">Field module help page</a>.', array('!field_help' => \Drupal::url('help.page', array('name' => 'field')), '!er_do' => 'https://www.drupal.org/documentation/modules/entityreference')) . '</p>';
-      $output .= '<h3>' . t('Uses') . '</h3>';
-      $output .= '<dl>';
-      $output .= '<dt>' . t('Managing and displaying entity reference fields') . '</dt>';
-      $output .= '<dd>' . t('The <em>settings</em> and the <em>display</em> of the entity reference field can be configured separately. See the <a href="!field_ui">Field UI help</a> for more information on how to manage fields and their display.', array('!field_ui' => (\Drupal::moduleHandler()->moduleExists('field_ui')) ? \Drupal::url('help.page', array('name' => 'field_ui')) : '#')) . '</dd>';
-      $output .= '<dt>' . t('Selecting reference type') . '</dt>';
-      $output .= '<dd>' . t('In the field settings you can select which type of item you want to create a reference to.') . '</dd>';
-      $output .= '<dt>' . t('Filtering and sorting reference fields') . '</dt>';
-      $output .= '<dd>' . t('Depending on the chosen entity type, additional filtering and sorting options are available for the list of entities that can be referred to, in the field settings. For example, the list of users can be filtered by role and sorted by name or ID.') . '</dd>';
-      $output .= '<dt>' . t('Displaying a reference') . '</dt>';
-      $output .= '<dd>' . t('An entity reference can be displayed as a simple label with or without a link to the entity. Alternatively, the referenced entity can be displayed as a teaser (or any other available view mode) inside the referencing entity. Certain entity types may provide additional display options. You can configure how the entity reference is displayed on the <em>Manage display</em> page for the entity.') . '</dd>';
-      $output .= '<dt>' . t('Configuring form displays') . '</dt>';
-      $output .= '<dd>' . t('Reference fields have several widgets available on the <em>Manage form display</em> page:');
-      $output .= '<ul>';
-      $output .= '<li>' . t('The <em>Check boxes/radio buttons</em> widget displays the existing entities for the entity type as check boxes or radio buttons based on the <em>Allowed number of values</em> set for the field.') . '</li>';
-      $output .= '<li>' . t('The <em>Select list</em> widget displays the existing entities in a drop-down list or scrolling list box based on the <em>Allowed number of values</em> setting for the field.') . '</li>';
-      $output .= '<li>' . t('The <em>Autocomplete</em> widget displays text fields in which users can type entity labels based on the <em>Allowed number of values</em>. The widget can be configured to display all entities that contain the typed characters or restricted to those starting with those characters.') . '</li>';
-      $output .= '<li>' . t('The <em>Autocomplete (Tags style)</em> widget displays a multi-text field in which users can type in a comma-separated list of entity labels.') . '</li>';
-      $output .= '</ul>';
-      $output .= '</dl>';
-      return $output;
-  }
-}
-
-/**
- * Implements hook_field_info_alter().
- */
-function entity_reference_field_info_alter(&$info) {
-  // Make the entity reference field configurable.
-  $info['entity_reference']['no_ui'] = FALSE;
-  $info['entity_reference']['class'] = '\Drupal\entity_reference\ConfigurableEntityReferenceItem';
-  $info['entity_reference']['list_class'] = '\Drupal\Core\Field\EntityReferenceFieldItemList';
-  $info['entity_reference']['default_widget'] = 'entity_reference_autocomplete';
-  $info['entity_reference']['default_formatter'] = 'entity_reference_label';
-  $info['entity_reference']['provider'] = 'entity_reference';
-}
-
-/**
- * Implements hook_field_widget_info_alter().
- */
-function entity_reference_field_widget_info_alter(&$info) {
-  if (isset($info['options_select'])) {
-    $info['options_select']['field_types'][] = 'entity_reference';
-  }
-  if (isset($info['options_buttons'])) {
-    $info['options_buttons']['field_types'][] = 'entity_reference';
-  }
-}
-
-/**
- * Implements hook_ENTITY_TYPE_update() for 'field_storage_config'.
- *
- * Reset the instance handler settings, when the target type is changed.
- */
-function entity_reference_field_storage_config_update(FieldStorageConfigInterface $field_storage) {
-  if ($field_storage->getType() != 'entity_reference') {
-    // Only act on entity reference fields.
-    return;
-  }
-
-  if ($field_storage->isSyncing()) {
-    // Don't change anything during a configuration sync.
-    return;
-  }
-
-  if ($field_storage->getSetting('target_type') == $field_storage->original->getSetting('target_type')) {
-    // Target type didn't change.
-    return;
-  }
-
-  foreach ($field_storage->getBundles() as $bundle) {
-    $field = FieldConfig::loadByName($field_storage->getTargetEntityTypeId(), $bundle, $field_storage->getName());
-    $field->setSetting('handler_settings', []);
-    $field->save();
-  }
-}
-
-/**
- * Implements hook_ENTITY_TYPE_presave() for 'field_config'.
- *
- * Determine the selection handler plugin ID for an entity reference field.
- */
-function entity_reference_field_config_presave(FieldConfigInterface $field) {
-  if ($field->getType() != 'entity_reference') {
-    // Only act on entity reference fields.
-    return;
-  }
-
-  if ($field->isSyncing()) {
-    // Don't change anything during a configuration sync.
-    return;
-  }
-
-  $target_type = $field->getFieldStorageDefinition()->getSetting('target_type');
-  $selection_manager = \Drupal::service('plugin.manager.entity_reference_selection');
-  list($current_handler) = explode(':', $field->getSetting('handler'), 2);
-  $field->setSetting('handler', $selection_manager->getPluginId($target_type, $current_handler));
-}
-
-/**
- * Implements hook_form_FORM_ID_alter() for 'field_ui_field_storage_add_form'.
- */
-function entity_reference_form_field_ui_field_storage_add_form_alter(array &$form) {
-  // Move the "Entity reference" option to the end of the list and rename it to
-  // "Other".
-  unset($form['add']['new_storage_type']['#options'][t('Reference')]['entity_reference']);
-  $form['add']['new_storage_type']['#options'][t('Reference')]['entity_reference'] = t('Other…');
-}
-
-/**
- * Render API callback: Processes the field settings form and allows access to
- * the form state.
- *
- * @see entity_reference_field_field_settings_form()
- */
-function _entity_reference_field_field_settings_ajax_process($form, FormStateInterface $form_state) {
-  _entity_reference_field_field_settings_ajax_process_element($form, $form);
-  return $form;
-}
-
-/**
- * Adds entity_reference specific properties to AJAX form elements from the
- * field settings form.
- *
- * @see _entity_reference_field_field_settings_ajax_process()
- */
-function _entity_reference_field_field_settings_ajax_process_element(&$element, $main_form) {
-  if (!empty($element['#ajax'])) {
-    $element['#ajax'] = array(
-      'callback' => 'entity_reference_settings_ajax',
-      'wrapper' => $main_form['#id'],
-      'element' => $main_form['#array_parents'],
-    );
-  }
-
-  foreach (Element::children($element) as $key) {
-    _entity_reference_field_field_settings_ajax_process_element($element[$key], $main_form);
-  }
-}
-
-/**
- * Render API callback: Moves entity_reference specific Form API elements
- * (i.e. 'handler_settings') up a level for easier processing by the validation
- * and submission handlers.
- *
- * @see _entity_reference_field_settings_process()
- */
-function _entity_reference_form_process_merge_parent($element) {
-  $parents = $element['#parents'];
-  array_pop($parents);
-  $element['#parents'] = $parents;
-  return $element;
-}
-
-/**
- * Form element validation handler; Filters the #value property of an element.
- */
-function _entity_reference_element_validate_filter(&$element, FormStateInterface $form_state) {
-  $element['#value'] = array_filter($element['#value']);
-  $form_state->setValueForElement($element, $element['#value']);
-}
-
-/**
- * Ajax callback for the handler settings form.
- *
- * @see entity_reference_field_field_settings_form()
- */
-function entity_reference_settings_ajax($form, FormStateInterface $form_state) {
-  return NestedArray::getValue($form, $form_state->getTriggeringElement()['#ajax']['element']);
-}
-
-/**
- * Submit handler for the non-JS case.
- *
- * @see entity_reference_field_field_settings_form()
- */
-function entity_reference_settings_ajax_submit($form, FormStateInterface $form_state) {
-  $form_state->setRebuild();
-}
-
-/**
- * Implements hook_query_TAG_alter().
- */
-function entity_reference_query_entity_reference_alter(AlterableInterface $query) {
-  $handler = $query->getMetadata('entity_reference_selection_handler');
-  $handler->entityQueryAlter($query);
-}
diff --git a/core/modules/entity_reference/src/ConfigurableEntityReferenceItem.php b/core/modules/entity_reference/src/ConfigurableEntityReferenceItem.php
deleted file mode 100644
index be11617..0000000
--- a/core/modules/entity_reference/src/ConfigurableEntityReferenceItem.php
+++ /dev/null
@@ -1,233 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\entity_reference\ConfigurableEntityReferenceItem.
- */
-
-namespace Drupal\entity_reference;
-
-use Drupal\Component\Utility\SafeMarkup;
-use Drupal\Core\Entity\EntityTypeInterface;
-use Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem;
-use Drupal\Core\Field\PreconfiguredFieldUiOptionsInterface;
-use Drupal\Core\Form\FormStateInterface;
-use Drupal\Core\Form\OptGroup;
-use Drupal\Core\Session\AccountInterface;
-use Drupal\Core\TypedData\OptionsProviderInterface;
-use Drupal\Core\Validation\Plugin\Validation\Constraint\AllowedValuesConstraint;
-
-/**
- * Alternative plugin implementation of the 'entity_reference' field type.
- *
- * Replaces the Core 'entity_reference' entity field type implementation, this
- * supports configurable fields, auto-creation of referenced entities and more.
- *
- * Required settings are:
- *  - target_type: The entity type to reference.
- *
- * @see entity_reference_field_info_alter().
- */
-class ConfigurableEntityReferenceItem extends EntityReferenceItem implements OptionsProviderInterface, PreconfiguredFieldUiOptionsInterface {
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function defaultStorageSettings() {
-    $settings = parent::defaultStorageSettings();
-    // The target bundle is handled by the 'target_bundles' property in the
-    // 'handler_settings' instance setting.
-    unset($settings['target_bundle']);
-    return $settings;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getPossibleValues(AccountInterface $account = NULL) {
-    return $this->getSettableValues($account);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getPossibleOptions(AccountInterface $account = NULL) {
-    return $this->getSettableOptions($account);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getSettableValues(AccountInterface $account = NULL) {
-    // Flatten options first, because "settable options" may contain group
-    // arrays.
-    $flatten_options = OptGroup::flattenOptions($this->getSettableOptions($account));
-    return array_keys($flatten_options);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getSettableOptions(AccountInterface $account = NULL) {
-    $field_definition = $this->getFieldDefinition();
-    if (!$options = \Drupal::service('plugin.manager.entity_reference_selection')->getSelectionHandler($field_definition, $this->getEntity())->getReferenceableEntities()) {
-      return array();
-    }
-
-    // Rebuild the array by changing the bundle key into the bundle label.
-    $target_type = $field_definition->getSetting('target_type');
-    $bundles = \Drupal::entityManager()->getBundleInfo($target_type);
-
-    $return = array();
-    foreach ($options as $bundle => $entity_ids) {
-      $bundle_label = SafeMarkup::checkPlain($bundles[$bundle]['label']);
-      $return[$bundle_label] = $entity_ids;
-    }
-
-    return count($return) == 1 ? reset($return) : $return;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getConstraints() {
-    $constraints = parent::getConstraints();
-
-    // Remove the 'AllowedValuesConstraint' validation constraint because entity
-    // reference fields already use the 'ValidReference' constraint.
-    foreach ($constraints as $key => $constraint) {
-      if ($constraint instanceof AllowedValuesConstraint) {
-        unset($constraints[$key]);
-      }
-    }
-
-    return $constraints;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function storageSettingsForm(array &$form, FormStateInterface $form_state, $has_data) {
-    $element['target_type'] = array(
-      '#type' => 'select',
-      '#title' => t('Type of item to reference'),
-      '#options' => \Drupal::entityManager()->getEntityTypeLabels(TRUE),
-      '#default_value' => $this->getSetting('target_type'),
-      '#required' => TRUE,
-      '#disabled' => $has_data,
-      '#size' => 1,
-    );
-
-    return $element;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function fieldSettingsForm(array $form, FormStateInterface $form_state) {
-    $field = $form_state->getFormObject()->getEntity();
-
-    // Get all selection plugins for this entity type.
-    $selection_plugins = \Drupal::service('plugin.manager.entity_reference_selection')->getSelectionGroups($this->getSetting('target_type'));
-    $handlers_options = array();
-    foreach (array_keys($selection_plugins) as $selection_group_id) {
-      // We only display base plugins (e.g., 'default', 'views', etc.) and not
-      // entity type specific plugins (e.g., 'default:node', 'default:user',
-      // etc.).
-      if (array_key_exists($selection_group_id, $selection_plugins[$selection_group_id])) {
-        $handlers_options[$selection_group_id] = SafeMarkup::checkPlain($selection_plugins[$selection_group_id][$selection_group_id]['label']);
-      }
-      elseif (array_key_exists($selection_group_id . ':' . $this->getSetting('target_type'), $selection_plugins[$selection_group_id])) {
-        $selection_group_plugin = $selection_group_id . ':' . $this->getSetting('target_type');
-        $handlers_options[$selection_group_plugin] = SafeMarkup::checkPlain($selection_plugins[$selection_group_id][$selection_group_plugin]['base_plugin_label']);
-      }
-    }
-
-    $form = array(
-      '#type' => 'container',
-      '#process' => array(
-        '_entity_reference_field_field_settings_ajax_process',
-      ),
-      '#element_validate' => array(array(get_class($this), 'fieldSettingsFormValidate')),
-    );
-    $form['handler'] = array(
-      '#type' => 'details',
-      '#title' => t('Reference type'),
-      '#open' => TRUE,
-      '#tree' => TRUE,
-      '#process' => array('_entity_reference_form_process_merge_parent'),
-    );
-
-    $form['handler']['handler'] = array(
-      '#type' => 'select',
-      '#title' => t('Reference method'),
-      '#options' => $handlers_options,
-      '#default_value' => $field->getSetting('handler'),
-      '#required' => TRUE,
-      '#ajax' => TRUE,
-      '#limit_validation_errors' => array(),
-    );
-    $form['handler']['handler_submit'] = array(
-      '#type' => 'submit',
-      '#value' => t('Change handler'),
-      '#limit_validation_errors' => array(),
-      '#attributes' => array(
-        'class' => array('js-hide'),
-      ),
-      '#submit' => array('entity_reference_settings_ajax_submit'),
-    );
-
-    $form['handler']['handler_settings'] = array(
-      '#type' => 'container',
-      '#attributes' => array('class' => array('entity_reference-settings')),
-    );
-
-    $handler = \Drupal::service('plugin.manager.entity_reference_selection')->getSelectionHandler($field);
-    $form['handler']['handler_settings'] += $handler->buildConfigurationForm(array(), $form_state);
-
-    return $form;
-  }
-
-  /**
-   * Form element validation handler; Invokes selection plugin's validation.
-   *
-   * @param array $form
-   *   The form where the settings form is being included in.
-   * @param \Drupal\Core\Form\FormStateInterface $form_state
-   *   The form state of the (entire) configuration form.
-   */
-  public static function fieldSettingsFormValidate(array $form, FormStateInterface $form_state) {
-    $field = $form_state->getFormObject()->getEntity();
-    $handler = \Drupal::service('plugin.manager.entity_reference_selection')->getSelectionHandler($field);
-    $handler->validateConfigurationForm($form, $form_state);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function getPreconfiguredOptions() {
-    $options = array();
-
-    // Add all the commonly referenced entity types as distinct pre-configured
-    // options.
-    $entity_types = \Drupal::entityManager()->getDefinitions();
-    $common_references = array_filter($entity_types, function (EntityTypeInterface $entity_type) {
-      return $entity_type->isCommonReferenceTarget();
-    });
-
-    /** @var \Drupal\Core\Entity\EntityTypeInterface $entity_type */
-    foreach ($common_references as $entity_type) {
-      $options[$entity_type->id()] = [
-        'label' => $entity_type->getLabel(),
-        'field_storage_config' => [
-          'settings' => [
-            'target_type' => $entity_type->id(),
-          ]
-        ]
-      ];
-    }
-
-    return $options;
-  }
-
-}
diff --git a/core/modules/field/field.install b/core/modules/field/field.install
new file mode 100644
index 0000000..660a4f8
--- /dev/null
+++ b/core/modules/field/field.install
@@ -0,0 +1,60 @@
+<?php
+
+/**
+ * @file
+ * Contains install and update functions for Field.
+ */
+
+use Drupal\field\Entity\FieldConfig;
+use Drupal\field\Entity\FieldStorageConfig;
+
+/**
+ * Moves the field storage 'target_bundle' setting to field config handler
+ * setting 'target_bundles'. Disable 'entity_reference' module.
+ */
+function field_update_8001() {
+  $config = \Drupal::configFactory();
+  /** @var \Drupal\Core\Extension\ModuleInstallerInterface $installer */
+  $installer = \Drupal::service('module_installer');
+
+  // Iterate on all fields storage to find fields having 'target_setting'.
+  foreach ($config->listAll('field.storage.') as $field_id) {
+    list(,, $entity_type, $field_name) = explode('.', $field_id);
+
+    $field_storage = FieldStorageConfig::loadByName($entity_type, $field_name);
+    $settings = $field_storage->getSettings();
+    if (!empty($settings['target_bundle'])) {
+      // Get all field configs for this field storage.
+      foreach ($config->listAll('field.field.') as $field_config_id) {
+        $pattern = '|\.' . $entity_type . '\.(\w.*)\.' . $field_name . '$|';
+        if (preg_match($pattern, $field_config_id, $found)) {
+          $bundle = $found[1];
+          $field_config = FieldConfig::loadByName($entity_type, $bundle, $field_name);
+          $handler_settings = $field_config->getSetting('handler_settings');
+          $handler_settings = $handler_settings ?: [];
+          $target_bundles = !empty($handler_settings['target_bundles']) ? $handler_settings['target_bundles'] : [];
+
+          // The storage setting 'target_bundle' is defined either as a string,
+          // either as an array. Append to existing values.
+          if (is_string($settings['target_bundle'])) {
+            $target_bundles[$settings['target_bundle']] = $settings['target_bundle'];
+          }
+          elseif (is_array($settings['target_bundle'])) {
+            $target_bundles += array_combine($settings['target_bundle'], $settings['target_bundle']);
+          }
+          else {
+            continue;
+          }
+          $handler_settings['target_bundles'] = $target_bundles;
+          $field_config->setSetting('handler_settings', $handler_settings);
+          $field_config->save();
+        }
+      }
+    }
+    unset($settings['target_bundle']);
+    $field_storage->setSettings($settings)->save();
+  }
+
+  // Disable 'entity_reference' module.
+  $installer->uninstall(['entity_reference']);
+}
diff --git a/core/modules/field/field.module b/core/modules/field/field.module
index d09049e..98d2fa9 100644
--- a/core/modules/field/field.module
+++ b/core/modules/field/field.module
@@ -12,6 +12,8 @@
 use Drupal\Core\Routing\RouteMatchInterface;
 use Drupal\Core\Url;
 use Drupal\field\Entity\FieldStorageConfig;
+use Drupal\field\FieldConfigInterface;
+use Drupal\field\FieldStorageConfigInterface;
 
 /*
  * Load all public Field API functions. Drupal currently has no
@@ -128,6 +130,17 @@ function field_help($route_name, RouteMatchInterface $route_match) {
       $output .= '<dt>' . t('Provided by Drupal core') . '</dt>';
       $output .= '<dd>' . t('As mentioned previously, some field types, widgets, and formatters are provided by Drupal core. Here are some notes on how to use some of these:');
       $output .= '<ul>';
+      $output .= '<li><p>' . t('<strong>Entity Reference</strong> fields allow you to create fields that contain links to other entities (such as content items, taxonomy terms, etc.) within the site. This allows you, for example, to include a link to a user within a content item. For more information, see <a href="!er_do">the online documentation for the Entity Reference module</a>.', array('!er_do' => 'https://drupal.org/documentation/modules/entityreference')) . '</p>';
+      $output .= '<dl>';
+      $output .= '<dt>' . t('Managing and displaying entity reference fields') . '</dt>';
+      $output .= '<dd>' . t('The <em>settings</em> and the <em>display</em> of the entity reference field can be configured separately. See the <a href="!field_ui">Field UI help</a> for more information on how to manage fields and their display.', array('!field_ui' => \Drupal::url('help.page', array('name' => 'field_ui')))) . '</dd>';
+      $output .= '<dt>' . t('Selecting reference type') . '</dt>';
+      $output .= '<dd>' . t('In the field settings you can select which entity type you want to create a reference to.') . '</dd>';
+      $output .= '<dt>' . t('Filtering and sorting reference fields') . '</dt>';
+      $output .= '<dd>' . t('Depending on the chosen entity type, additional filtering and sorting options are available for the list of entities that can be referred to, in the field settings. For example, the list of users can be filtered by role and sorted by name or ID.') . '</dd>';
+      $output .= '<dt>' . t('Displaying a reference') . '</dt>';
+      $output .= '<dd>' . t('An entity reference can be displayed as a simple label with or without a link to the entity. Alternatively, the referenced entity can be displayed as a teaser (or any other available view mode) inside the referencing entity.') . '</dd>';
+      $output .= '</dl></li>';
       $output .= '<li>' . t('<strong>Number fields</strong>: When you add a number field you can choose from three types: <em>decimal</em>, <em>float</em>, and <em>integer</em>. The <em>decimal</em> number field type allows users to enter exact decimal values, with fixed numbers of decimal places. The <em>float</em> number field type allows users to enter approximate decimal values. The <em>integer</em> number field type allows users to enter whole numbers, such as years (for example, 2012) or values (for example, 1, 2, 5, 305). It does not allow decimals.') . '</li>';
       $output .= '</ul></dd>';
       $output .= '</dl>';
@@ -229,6 +242,66 @@ function field_entity_bundle_delete($entity_type, $bundle) {
 }
 
 /**
+ * Implements hook_ENTITY_TYPE_update() for 'field_storage_config'.
+ *
+ * Reset the instance handler settings, when the target type is changed.
+ */
+function field_field_storage_config_update(FieldStorageConfigInterface $field_storage) {
+  if ($field_storage->getType() != 'entity_reference') {
+    // Only act on entity reference fields.
+    return;
+  }
+
+  if ($field_storage->isSyncing()) {
+    // Don't change anything during a configuration sync.
+    return;
+  }
+
+  if ($field_storage->getSetting('target_type') == $field_storage->original->getSetting('target_type')) {
+    // Target type didn't change.
+    return;
+  }
+
+  foreach ($field_storage->getBundles() as $bundle) {
+    $field = FieldConfig::loadByName($field_storage->getTargetEntityTypeId(), $bundle, $field_storage->getName());
+    $field->setSetting('handler_settings', []);
+    $field->save();
+  }
+}
+
+/**
+ * Implements hook_ENTITY_TYPE_presave() for 'field_config'.
+ *
+ * Determine the selection handler plugin ID for an entity reference field.
+ */
+function field_field_config_presave(FieldConfigInterface $field) {
+  if ($field->getType() != 'entity_reference') {
+    // Only act on entity reference fields.
+    return;
+  }
+
+  if ($field->isSyncing()) {
+    // Don't change anything during a configuration sync.
+    return;
+  }
+
+  $target_type = $field->getFieldStorageDefinition()->getSetting('target_type');
+  $selection_manager = \Drupal::service('plugin.manager.entity_reference_selection');
+  list($current_handler) = explode(':', $field->getSetting('handler'), 2);
+  $field->setSetting('handler', $selection_manager->getPluginId($target_type, $current_handler));
+}
+
+/**
+ * Implements hook_form_FORM_ID_alter() for 'field_ui_field_storage_add_form'.
+ */
+function field_form_field_ui_field_storage_add_form_alter(array &$form) {
+  // Move the "Entity reference" option to the end of the list and rename it to
+  // "Other".
+  unset($form['add']['new_storage_type']['#options'][t('Reference')]['entity_reference']);
+  $form['add']['new_storage_type']['#options'][t('Reference')]['entity_reference'] = t('Other…');
+}
+
+/**
  * @} End of "defgroup field".
  */
 
diff --git a/core/modules/entity_reference/src/Tests/EntityReferenceAdminTest.php b/core/modules/field/src/Tests/EntityReference/EntityReferenceAdminTest.php
similarity index 98%
rename from core/modules/entity_reference/src/Tests/EntityReferenceAdminTest.php
rename to core/modules/field/src/Tests/EntityReference/EntityReferenceAdminTest.php
index 0956896..0919411 100644
--- a/core/modules/entity_reference/src/Tests/EntityReferenceAdminTest.php
+++ b/core/modules/field/src/Tests/EntityReference/EntityReferenceAdminTest.php
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Contains \Drupal\entity_reference\Tests\EntityReferenceAdminTest.
+ * Contains \Drupal\field\Tests\EntityReference\EntityReferenceAdminTest.
  */
 
-namespace Drupal\entity_reference\Tests;
+namespace Drupal\field\Tests\EntityReference;
 
 use Drupal\Core\Entity\Entity;
 use Drupal\field_ui\Tests\FieldUiTestTrait;
@@ -31,7 +31,7 @@ class EntityReferenceAdminTest extends WebTestBase {
    *
    * @var array
    */
-  public static $modules = array('node', 'field_ui', 'entity_reference', 'path', 'taxonomy', 'block', 'views', 'views_ui', 'entity_test');
+  public static $modules = ['node', 'field_ui', 'path', 'taxonomy', 'block', 'views_ui'];
 
   /**
    * The name of the content type created for testing purposes.
diff --git a/core/modules/entity_reference/src/Tests/EntityReferenceAutoCreateTest.php b/core/modules/field/src/Tests/EntityReference/EntityReferenceAutoCreateTest.php
similarity index 95%
rename from core/modules/entity_reference/src/Tests/EntityReferenceAutoCreateTest.php
rename to core/modules/field/src/Tests/EntityReference/EntityReferenceAutoCreateTest.php
index dc87dc8..77bede9 100644
--- a/core/modules/entity_reference/src/Tests/EntityReferenceAutoCreateTest.php
+++ b/core/modules/field/src/Tests/EntityReference/EntityReferenceAutoCreateTest.php
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Contains \Drupal\entity_reference\Tests\EntityReferenceAutoCreateTest.
+ * Contains \Drupal\field\Tests\EntityReference\EntityReferenceAutoCreateTest.
  */
 
-namespace Drupal\entity_reference\Tests;
+namespace Drupal\field\Tests\EntityReference;
 
 use Drupal\Core\Field\FieldStorageDefinitionInterface;
 use Drupal\simpletest\WebTestBase;
@@ -18,7 +18,7 @@
  */
 class EntityReferenceAutoCreateTest extends WebTestBase {
 
-  public static $modules = array('entity_reference', 'node');
+  public static $modules = ['node'];
 
   /**
    * The name of a content type that will reference $referencedType.
diff --git a/core/modules/entity_reference/src/Tests/EntityReferenceFieldDefaultValueTest.php b/core/modules/field/src/Tests/EntityReference/EntityReferenceFieldDefaultValueTest.php
similarity index 97%
rename from core/modules/entity_reference/src/Tests/EntityReferenceFieldDefaultValueTest.php
rename to core/modules/field/src/Tests/EntityReference/EntityReferenceFieldDefaultValueTest.php
index c2ceed9..ae6fec7 100644
--- a/core/modules/entity_reference/src/Tests/EntityReferenceFieldDefaultValueTest.php
+++ b/core/modules/field/src/Tests/EntityReference/EntityReferenceFieldDefaultValueTest.php
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Contains \Drupal\entity_reference\Tests\EntityReferenceFieldDefaultValueTest.
+ * Contains \Drupal\field\Tests\EntityReference\EntityReferenceFieldDefaultValueTest.
  */
 
-namespace Drupal\entity_reference\Tests;
+namespace Drupal\field\Tests\EntityReference;
 
 use Drupal\Component\Utility\Unicode;
 use Drupal\config\Tests\SchemaCheckTestTrait;
@@ -18,6 +18,7 @@
  * @group entity_reference
  */
 class EntityReferenceFieldDefaultValueTest extends WebTestBase {
+
   use SchemaCheckTestTrait;
 
   /**
@@ -25,7 +26,7 @@ class EntityReferenceFieldDefaultValueTest extends WebTestBase {
    *
    * @var array
    */
-  public static $modules = array('entity_reference', 'field_ui', 'node');
+  public static $modules = ['field_ui', 'node'];
 
   /**
    * A user with permission to administer content types, node fields, etc.
diff --git a/core/modules/entity_reference/src/Tests/EntityReferenceFieldTranslatedReferenceViewTest.php b/core/modules/field/src/Tests/EntityReference/EntityReferenceFieldTranslatedReferenceViewTest.php
similarity index 98%
rename from core/modules/entity_reference/src/Tests/EntityReferenceFieldTranslatedReferenceViewTest.php
rename to core/modules/field/src/Tests/EntityReference/EntityReferenceFieldTranslatedReferenceViewTest.php
index f72a4de..c1d2e4b 100644
--- a/core/modules/entity_reference/src/Tests/EntityReferenceFieldTranslatedReferenceViewTest.php
+++ b/core/modules/field/src/Tests/EntityReference/EntityReferenceFieldTranslatedReferenceViewTest.php
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Contains \Drupal\entity_reference\Tests\EntityReferenceFieldTranslatedReferenceViewTest.
+ * Contains \Drupal\field\Tests\EntityReference\EntityReferenceFieldTranslatedReferenceViewTest.
  */
 
-namespace Drupal\entity_reference\Tests;
+namespace Drupal\field\Tests\EntityReference;
 
 use Drupal\language\Entity\ConfigurableLanguage;
 use Drupal\Core\Field\FieldStorageDefinitionInterface;
@@ -109,7 +109,6 @@ class EntityReferenceFieldTranslatedReferenceViewTest extends WebTestBase {
   public static $modules = array(
     'language',
     'content_translation',
-    'entity_reference',
     'node',
   );
 
diff --git a/core/modules/field/src/Tests/EntityReference/EntityReferenceFormatterTest.php b/core/modules/field/src/Tests/EntityReference/EntityReferenceFormatterTest.php
index 3c7b9d6..aa0084e 100644
--- a/core/modules/field/src/Tests/EntityReference/EntityReferenceFormatterTest.php
+++ b/core/modules/field/src/Tests/EntityReference/EntityReferenceFormatterTest.php
@@ -10,7 +10,6 @@
 use Drupal\Core\Cache\Cache;
 use Drupal\Core\Cache\CacheableMetadata;
 use Drupal\Core\Field\FieldStorageDefinitionInterface;
-use Drupal\entity_reference\Tests\EntityReferenceTestTrait;
 use Drupal\field\Entity\FieldStorageConfig;
 use Drupal\filter\Entity\FilterFormat;
 use Drupal\system\Tests\Entity\EntityUnitTestBase;
@@ -62,13 +61,6 @@ class EntityReferenceFormatterTest extends EntityUnitTestBase {
    */
   protected $unsavedReferencedEntity;
 
-  /**
-   * Modules to install.
-   *
-   * @var array
-   */
-  public static $modules = array('entity_reference');
-
   protected function setUp() {
     parent::setUp();
 
diff --git a/core/modules/entity_reference/src/Tests/EntityReferenceIntegrationTest.php b/core/modules/field/src/Tests/EntityReference/EntityReferenceIntegrationTest.php
similarity index 97%
rename from core/modules/entity_reference/src/Tests/EntityReferenceIntegrationTest.php
rename to core/modules/field/src/Tests/EntityReference/EntityReferenceIntegrationTest.php
index c059848..0d1fe9b 100644
--- a/core/modules/entity_reference/src/Tests/EntityReferenceIntegrationTest.php
+++ b/core/modules/field/src/Tests/EntityReference/EntityReferenceIntegrationTest.php
@@ -2,15 +2,14 @@
 
 /**
  * @file
- * Contains \Drupal\entity_reference\Tests\EntityReferenceIntegrationTest.
+ * Contains \Drupal\field\Tests\EntityReference\EntityReferenceIntegrationTest.
  */
 
-namespace Drupal\entity_reference\Tests;
+namespace Drupal\field\Tests\EntityReference;
 
 use Drupal\Component\Utility\SafeMarkup;
 use Drupal\config\Tests\AssertConfigEntityImportTrait;
 use Drupal\Core\Config\Entity\ConfigEntityBase;
-use Drupal\entity_reference\Tests\EntityReferenceTestTrait;
 use Drupal\field\Entity\FieldConfig;
 use Drupal\simpletest\WebTestBase;
 
@@ -50,7 +49,7 @@ class EntityReferenceIntegrationTest extends WebTestBase {
    *
    * @var array
    */
-  public static $modules = array('config_test', 'entity_test', 'entity_reference', 'field_ui');
+  public static $modules = ['config_test', 'entity_test', 'field_ui'];
 
   /**
    * {@inheritdoc}
diff --git a/core/modules/field/src/Tests/EntityReference/EntityReferenceItemTest.php b/core/modules/field/src/Tests/EntityReference/EntityReferenceItemTest.php
index 497b2bd..a788dd0 100644
--- a/core/modules/field/src/Tests/EntityReference/EntityReferenceItemTest.php
+++ b/core/modules/field/src/Tests/EntityReference/EntityReferenceItemTest.php
@@ -12,7 +12,6 @@
 use Drupal\Core\Field\FieldItemInterface;
 use Drupal\Core\StringTranslation\TranslationWrapper;
 use Drupal\Core\Language\LanguageInterface;
-use Drupal\entity_reference\Tests\EntityReferenceTestTrait;
 use Drupal\entity_test\Entity\EntityTest;
 use Drupal\entity_test\Entity\EntityTestStringId;
 use Drupal\field\Entity\FieldConfig;
@@ -36,7 +35,7 @@ class EntityReferenceItemTest extends FieldUnitTestBase {
    *
    * @var array
    */
-  public static $modules = array('entity_reference', 'taxonomy', 'text', 'filter', 'views');
+  public static $modules = ['taxonomy', 'text', 'filter', 'views', 'field'];
 
   /**
    * The taxonomy vocabulary to test with.
diff --git a/core/modules/entity_reference/src/Tests/EntityReferenceTestTrait.php b/core/modules/field/src/Tests/EntityReference/EntityReferenceTestTrait.php
similarity index 86%
rename from core/modules/entity_reference/src/Tests/EntityReferenceTestTrait.php
rename to core/modules/field/src/Tests/EntityReference/EntityReferenceTestTrait.php
index 1882079..674a45d 100644
--- a/core/modules/entity_reference/src/Tests/EntityReferenceTestTrait.php
+++ b/core/modules/field/src/Tests/EntityReference/EntityReferenceTestTrait.php
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Contains \Drupal\entity_reference\Tests\EntityReferenceTestTrait.
+ * Contains \Drupal\field\Tests\EntityReference\EntityReferenceTestTrait.
  */
 
-namespace Drupal\entity_reference\Tests;
+namespace Drupal\field\Tests\EntityReference;
 
 use Drupal\field\Entity\FieldConfig;
 use Drupal\field\Entity\FieldStorageConfig;
@@ -39,7 +39,7 @@
    *
    * @see \Drupal\Core\Entity\Plugin\EntityReferenceSelection\SelectionBase::buildConfigurationForm()
    */
-  protected function createEntityReferenceField($entity_type, $bundle, $field_name, $field_label, $target_entity_type, $selection_handler = 'default', $selection_handler_settings = array(), $cardinality = 1) {
+  public function createEntityReferenceField($entity_type, $bundle, $field_name, $field_label, $target_entity_type, $selection_handler = 'default', $selection_handler_settings = array(), $cardinality = 1) {
     // Look for or add the specified field to the requested entity bundle.
     if (!FieldStorageConfig::loadByName($entity_type, $field_name)) {
       FieldStorageConfig::create(array(
diff --git a/core/modules/entity_reference/src/Tests/Views/EntityReferenceRelationshipTest.php b/core/modules/field/src/Tests/EntityReference/Views/EntityReferenceRelationshipTest.php
similarity index 96%
rename from core/modules/entity_reference/src/Tests/Views/EntityReferenceRelationshipTest.php
rename to core/modules/field/src/Tests/EntityReference/Views/EntityReferenceRelationshipTest.php
index 4190f17..8dde1f4 100644
--- a/core/modules/entity_reference/src/Tests/Views/EntityReferenceRelationshipTest.php
+++ b/core/modules/field/src/Tests/EntityReference/Views/EntityReferenceRelationshipTest.php
@@ -2,12 +2,12 @@
 
 /**
  * @file
- * Contains \Drupal\entity_reference\Tests\Views\EntityReferenceRelationshipTest.
+ * Contains \Drupal\field\Tests\EntityReference\Views\EntityReferenceRelationshipTest.
  */
 
-namespace Drupal\entity_reference\Tests\Views;
+namespace Drupal\field\Tests\EntityReference\Views;
 
-use Drupal\entity_reference\Tests\EntityReferenceTestTrait;
+use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;
 use Drupal\entity_test\Entity\EntityTest;
 use Drupal\entity_test\Entity\EntityTestMul;
 use Drupal\views\Tests\ViewTestData;
@@ -18,7 +18,7 @@
  * Tests entity reference relationship data.
  *
  * @group entity_reference
- * @see entity_reference_field_views_data()
+ * @see core_field_views_data()
  */
 class EntityReferenceRelationshipTest extends ViewUnitTestBase {
 
@@ -41,7 +41,7 @@ class EntityReferenceRelationshipTest extends ViewUnitTestBase {
    *
    * @var array
    */
-  public static $modules = array('user', 'field', 'entity_test', 'entity_reference', 'views', 'entity_reference_test_views');
+  public static $modules = ['user', 'field', 'entity_test', 'views', 'entity_reference_test_views'];
 
   /**
    * The entity_test entities used by the test.
diff --git a/core/modules/entity_reference/src/Tests/Views/SelectionTest.php b/core/modules/field/src/Tests/EntityReference/Views/SelectionTest.php
similarity index 94%
rename from core/modules/entity_reference/src/Tests/Views/SelectionTest.php
rename to core/modules/field/src/Tests/EntityReference/Views/SelectionTest.php
index d324b12..f560876 100644
--- a/core/modules/entity_reference/src/Tests/Views/SelectionTest.php
+++ b/core/modules/field/src/Tests/EntityReference/Views/SelectionTest.php
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Contains \Drupal\entity_reference\Tests\Views\SelectionTest.
+ * Contains \Drupal\field\Tests\EntityReference\Views\SelectionTest.
  */
 
-namespace Drupal\entity_reference\Tests\Views;
+namespace Drupal\field\Tests\EntityReference\Views;
 
 use Drupal\simpletest\WebTestBase;
 use Drupal\views\Views;
@@ -17,7 +17,7 @@
  */
 class SelectionTest extends WebTestBase {
 
-  public static $modules = array('node', 'views', 'entity_reference', 'entity_reference_test', 'entity_test');
+  public static $modules = ['node', 'views', 'entity_reference_test', 'entity_test'];
 
   /**
    * Nodes for testing.
diff --git a/core/modules/field/src/Tests/FieldUnitTestBase.php b/core/modules/field/src/Tests/FieldUnitTestBase.php
index 9587a4a..ddcf3f9 100644
--- a/core/modules/field/src/Tests/FieldUnitTestBase.php
+++ b/core/modules/field/src/Tests/FieldUnitTestBase.php
@@ -22,7 +22,7 @@
    *
    * @var array
    */
-  public static $modules = array('user', 'system', 'field', 'text', 'entity_test', 'field_test', 'entity_reference');
+  public static $modules = ['user', 'system', 'field', 'text', 'entity_test', 'field_test'];
 
   /**
    * Bag of created field storages and fields.
diff --git a/core/modules/field/src/Tests/Migrate/d6/MigrateFieldInstanceTest.php b/core/modules/field/src/Tests/Migrate/d6/MigrateFieldInstanceTest.php
index 61bf944..a4c9a47 100644
--- a/core/modules/field/src/Tests/Migrate/d6/MigrateFieldInstanceTest.php
+++ b/core/modules/field/src/Tests/Migrate/d6/MigrateFieldInstanceTest.php
@@ -126,7 +126,6 @@ public function testFieldInstanceSettings() {
       // storages so we end up with the default value for this setting.
       'handler' => 'default:node',
       'handler_settings' => array(),
-      'target_bundle' => NULL,
     );
     $field_settings = $field->getSettings();
     ksort($expected);
diff --git a/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldWidget/TestFieldWidgetMultiple.php b/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldWidget/TestFieldWidgetMultiple.php
index ed43782..3e38772 100644
--- a/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldWidget/TestFieldWidgetMultiple.php
+++ b/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldWidget/TestFieldWidgetMultiple.php
@@ -99,7 +99,7 @@ public static function multipleValidate($element, FormStateInterface $form_state
 
   /**
    * {@inheritdoc}
-   * Used in \Drupal\entity_reference\Tests\EntityReferenceAdminTest::testAvailableFormatters().
+   * Used in \Drupal\field\Tests\EntityReference\EntityReferenceAdminTest::testAvailableFormatters().
    */
   public static function isApplicable(FieldDefinitionInterface $field_definition) {
     // Returns FALSE if machine name of the field equals field_onewidgetfield.
diff --git a/core/modules/field_ui/src/Tests/EntityFormDisplayTest.php b/core/modules/field_ui/src/Tests/EntityFormDisplayTest.php
index 0f8cc6b..b002106 100644
--- a/core/modules/field_ui/src/Tests/EntityFormDisplayTest.php
+++ b/core/modules/field_ui/src/Tests/EntityFormDisplayTest.php
@@ -25,7 +25,7 @@ class EntityFormDisplayTest extends KernelTestBase {
    *
    * @var string[]
    */
-  public static $modules = array('field_ui', 'field', 'entity_test', 'field_test', 'user', 'text', 'entity_reference');
+  public static $modules = ['field_ui', 'field', 'entity_test', 'field_test', 'user', 'text'];
 
   protected function setUp() {
     parent::setUp();
diff --git a/core/modules/field_ui/src/Tests/ManageFieldsTest.php b/core/modules/field_ui/src/Tests/ManageFieldsTest.php
index 3b2ac3e..f33d61e 100644
--- a/core/modules/field_ui/src/Tests/ManageFieldsTest.php
+++ b/core/modules/field_ui/src/Tests/ManageFieldsTest.php
@@ -10,7 +10,7 @@
 use Drupal\Component\Utility\SafeMarkup;
 use Drupal\Core\Field\FieldStorageDefinitionInterface;
 use Drupal\Core\Language\LanguageInterface;
-use Drupal\entity_reference\Tests\EntityReferenceTestTrait;
+use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait ;
 use Drupal\field\Entity\FieldConfig;
 use Drupal\field\Entity\FieldStorageConfig;
 use Drupal\simpletest\WebTestBase;
diff --git a/core/modules/file/src/Plugin/Field/FieldType/FileItem.php b/core/modules/file/src/Plugin/Field/FieldType/FileItem.php
index f609b70..bc4dc38 100644
--- a/core/modules/file/src/Plugin/Field/FieldType/FileItem.php
+++ b/core/modules/file/src/Plugin/Field/FieldType/FileItem.php
@@ -334,4 +334,11 @@ public function isDisplayed() {
     return TRUE;
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  public static function getPreconfiguredOptions() {
+    return [];
+  }
+
 }
diff --git a/core/modules/forum/config/install/core.entity_form_display.node.forum.default.yml b/core/modules/forum/config/install/core.entity_form_display.node.forum.default.yml
index 8731335..a72b0e8 100644
--- a/core/modules/forum/config/install/core.entity_form_display.node.forum.default.yml
+++ b/core/modules/forum/config/install/core.entity_form_display.node.forum.default.yml
@@ -8,7 +8,6 @@ dependencies:
     - node.type.forum
   module:
     - comment
-    - entity_reference
     - text
 id: node.forum.default
 targetEntityType: node
diff --git a/core/modules/hal/src/Tests/NormalizerTestBase.php b/core/modules/hal/src/Tests/NormalizerTestBase.php
index aea5b25..104a5e2 100644
--- a/core/modules/hal/src/Tests/NormalizerTestBase.php
+++ b/core/modules/hal/src/Tests/NormalizerTestBase.php
@@ -33,7 +33,7 @@
    *
    * @var array
    */
-  public static $modules = array('entity_test', 'entity_reference', 'field', 'hal', 'language', 'rest', 'serialization', 'system', 'text', 'user', 'filter');
+  public static $modules = ['entity_test', 'field', 'hal', 'language', 'rest', 'serialization', 'system', 'text', 'user', 'filter'];
 
   /**
    * The mock serializer.
diff --git a/core/modules/migrate/src/Entity/MigrationInterface.php b/core/modules/migrate/src/Entity/MigrationInterface.php
index 5d20723..7650f7f 100644
--- a/core/modules/migrate/src/Entity/MigrationInterface.php
+++ b/core/modules/migrate/src/Entity/MigrationInterface.php
@@ -219,6 +219,8 @@ public function setProcess(array $process);
    *
    * @return $this
    *   The migration entity.
+   *
+   * @see Drupal\migrate_drupal\Plugin\migrate\load\LoadEntity::processLinkField().
    */
   public function setProcessOfProperty($property, $process_of_property);
 
diff --git a/core/modules/node/node.info.yml b/core/modules/node/node.info.yml
index cdbef85..9b53d58 100644
--- a/core/modules/node/node.info.yml
+++ b/core/modules/node/node.info.yml
@@ -7,4 +7,3 @@ core: 8.x
 configure: entity.node_type.collection
 dependencies:
   - text
-  - entity_reference
diff --git a/core/modules/node/src/Tests/Config/NodeImportChangeTest.php b/core/modules/node/src/Tests/Config/NodeImportChangeTest.php
index 4e1fbc1..f42f16b 100644
--- a/core/modules/node/src/Tests/Config/NodeImportChangeTest.php
+++ b/core/modules/node/src/Tests/Config/NodeImportChangeTest.php
@@ -22,7 +22,7 @@ class NodeImportChangeTest extends KernelTestBase {
    *
    * @var array
    */
-  public static $modules = array('node', 'field', 'text', 'system', 'node_test_config', 'user', 'entity_reference');
+  public static $modules = ['node', 'field', 'text', 'system', 'node_test_config', 'user'];
 
   /**
    * Set the default field storage backend for fields created during tests.
diff --git a/core/modules/node/src/Tests/Config/NodeImportCreateTest.php b/core/modules/node/src/Tests/Config/NodeImportCreateTest.php
index 97fe51f..12c73ac 100644
--- a/core/modules/node/src/Tests/Config/NodeImportCreateTest.php
+++ b/core/modules/node/src/Tests/Config/NodeImportCreateTest.php
@@ -23,7 +23,7 @@ class NodeImportCreateTest extends KernelTestBase {
    *
    * @var array
    */
-  public static $modules = array('node', 'field', 'text', 'system', 'user', 'entity_reference');
+  public static $modules = array('node', 'field', 'text', 'system', 'user');
 
   /**
    * Set the default field storage backend for fields created during tests.
diff --git a/core/modules/node/src/Tests/Migrate/d6/MigrateNodeTestBase.php b/core/modules/node/src/Tests/Migrate/d6/MigrateNodeTestBase.php
index a47df1f..996393d 100644
--- a/core/modules/node/src/Tests/Migrate/d6/MigrateNodeTestBase.php
+++ b/core/modules/node/src/Tests/Migrate/d6/MigrateNodeTestBase.php
@@ -16,7 +16,7 @@
  */
 abstract class MigrateNodeTestBase extends MigrateDrupal6TestBase {
 
-  static $modules = array('node', 'text', 'filter', 'entity_reference');
+  public static $modules = ['node', 'text', 'filter'];
 
   /**
    * {@inheritdoc}
diff --git a/core/modules/node/src/Tests/NodeBodyFieldStorageTest.php b/core/modules/node/src/Tests/NodeBodyFieldStorageTest.php
index 2153c7f..33aa98e 100644
--- a/core/modules/node/src/Tests/NodeBodyFieldStorageTest.php
+++ b/core/modules/node/src/Tests/NodeBodyFieldStorageTest.php
@@ -27,7 +27,7 @@ class NodeBodyFieldStorageTest extends KernelTestBase {
    *
    * @var array
    */
-  public static $modules = array('user', 'system', 'field', 'node', 'text', 'filter', 'entity_reference');
+  public static $modules = ['user', 'system', 'field', 'node', 'text', 'filter'];
 
   protected function setUp() {
     parent::setUp();
diff --git a/core/modules/node/src/Tests/PagePreviewTest.php b/core/modules/node/src/Tests/PagePreviewTest.php
index 44a280f..4b8bc8a 100644
--- a/core/modules/node/src/Tests/PagePreviewTest.php
+++ b/core/modules/node/src/Tests/PagePreviewTest.php
@@ -11,7 +11,7 @@
 use Drupal\Core\Field\FieldStorageDefinitionInterface;
 use Drupal\Component\Utility\Unicode;
 use Drupal\Core\Language\LanguageInterface;
-use Drupal\entity_reference\Tests\EntityReferenceTestTrait;
+use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait ;
 use Drupal\node\Entity\NodeType;
 
 /**
diff --git a/core/modules/options/tests/options_config_install_test/config/install/core.entity_form_display.node.options_install_test.default.yml b/core/modules/options/tests/options_config_install_test/config/install/core.entity_form_display.node.options_install_test.default.yml
index 6d0f3e8..19a2ef7 100644
--- a/core/modules/options/tests/options_config_install_test/config/install/core.entity_form_display.node.options_install_test.default.yml
+++ b/core/modules/options/tests/options_config_install_test/config/install/core.entity_form_display.node.options_install_test.default.yml
@@ -5,7 +5,6 @@ dependencies:
     - field.field.node.options_install_test.body
     - node.type.options_install_test
   module:
-    - entity_reference
     - text
 id: node.options_install_test.default
 targetEntityType: node
diff --git a/core/modules/quickedit/src/Tests/QuickEditAutocompleteTermTest.php b/core/modules/quickedit/src/Tests/QuickEditAutocompleteTermTest.php
index 81eaa97..db95713 100644
--- a/core/modules/quickedit/src/Tests/QuickEditAutocompleteTermTest.php
+++ b/core/modules/quickedit/src/Tests/QuickEditAutocompleteTermTest.php
@@ -10,7 +10,7 @@
 use Drupal\Component\Serialization\Json;
 use Drupal\Core\Field\FieldStorageDefinitionInterface;
 use Drupal\Core\Language\LanguageInterface;
-use Drupal\entity_reference\Tests\EntityReferenceTestTrait;
+use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait ;
 use Drupal\simpletest\WebTestBase;
 
 /**
diff --git a/core/modules/quickedit/src/Tests/QuickEditTestBase.php b/core/modules/quickedit/src/Tests/QuickEditTestBase.php
index fbbd1a7..eb779ad 100644
--- a/core/modules/quickedit/src/Tests/QuickEditTestBase.php
+++ b/core/modules/quickedit/src/Tests/QuickEditTestBase.php
@@ -19,7 +19,7 @@
    *
    * @var array
    */
-  public static $modules = array('system', 'entity_test', 'field', 'field_test', 'filter', 'user', 'text', 'quickedit', 'entity_reference');
+  public static $modules = ['system', 'entity_test', 'field', 'field_test', 'filter', 'user', 'text', 'quickedit'];
 
   /**
    * Bag of created fields.
diff --git a/core/modules/rdf/src/Tests/Field/EntityReferenceRdfaTest.php b/core/modules/rdf/src/Tests/Field/EntityReferenceRdfaTest.php
index 15760c7..73e6e53 100644
--- a/core/modules/rdf/src/Tests/Field/EntityReferenceRdfaTest.php
+++ b/core/modules/rdf/src/Tests/Field/EntityReferenceRdfaTest.php
@@ -6,7 +6,7 @@
 
 namespace Drupal\rdf\Tests\Field;
 
-use Drupal\entity_reference\Tests\EntityReferenceTestTrait;
+use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;
 use Drupal\user\Entity\Role;
 use Drupal\user\RoleInterface;
 
@@ -48,7 +48,7 @@ class EntityReferenceRdfaTest extends FieldRdfaTestBase {
   /**
    * {@inheritdoc}
    */
-  public static $modules = array('entity_reference', 'text', 'filter');
+  public static $modules = ['text', 'filter'];
 
   protected function setUp() {
     parent::setUp();
diff --git a/core/modules/serialization/src/Tests/EntityResolverTest.php b/core/modules/serialization/src/Tests/EntityResolverTest.php
index 7d174c3..f63d96d 100644
--- a/core/modules/serialization/src/Tests/EntityResolverTest.php
+++ b/core/modules/serialization/src/Tests/EntityResolverTest.php
@@ -20,7 +20,7 @@ class EntityResolverTest extends NormalizerTestBase {
    *
    * @var array
    */
-  public static $modules = array('entity_reference', 'hal', 'rest');
+  public static $modules = ['hal', 'rest'];
 
   /**
    * The format being tested.
diff --git a/core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php b/core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php
index 8f10556..366b1f9 100644
--- a/core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php
+++ b/core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php
@@ -28,7 +28,7 @@
    *
    * @var array
    */
-  public static $modules = array('entity_reference', 'entity_test', 'field_test');
+  public static $modules = ['entity_test', 'field_test'];
 
   /**
    * The main entity used for testing.
diff --git a/core/modules/system/src/Tests/Entity/EntityFieldTest.php b/core/modules/system/src/Tests/Entity/EntityFieldTest.php
index 308132d..b42472e 100644
--- a/core/modules/system/src/Tests/Entity/EntityFieldTest.php
+++ b/core/modules/system/src/Tests/Entity/EntityFieldTest.php
@@ -689,7 +689,9 @@ public function testEntityConstraintValidation() {
       ->setLabel('Test entity')
       ->setSettings(array(
         'target_type' => 'node',
-        'target_bundle' => 'article',
+        'handler_settings' => array(
+          'target_bundles' => array('article'),
+        ),
       ));
     $reference_field = \Drupal::TypedDataManager()->create($definition);
     $reference = $reference_field->appendItem(array('entity' => $node))->get('entity');
diff --git a/core/modules/system/src/Tests/Entity/EntityQueryRelationshipTest.php b/core/modules/system/src/Tests/Entity/EntityQueryRelationshipTest.php
index 254bfdb..fc83fcd 100644
--- a/core/modules/system/src/Tests/Entity/EntityQueryRelationshipTest.php
+++ b/core/modules/system/src/Tests/Entity/EntityQueryRelationshipTest.php
@@ -7,7 +7,7 @@
 
 namespace Drupal\system\Tests\Entity;
 use Drupal\Component\Utility\Unicode;
-use Drupal\entity_reference\Tests\EntityReferenceTestTrait;
+use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait ;
 
 /**
  * Tests the Entity Query relationship API.
diff --git a/core/modules/system/src/Tests/Entity/EntityReferenceFieldTest.php b/core/modules/system/src/Tests/Entity/EntityReferenceFieldTest.php
index 14a67ef..24ffec4 100644
--- a/core/modules/system/src/Tests/Entity/EntityReferenceFieldTest.php
+++ b/core/modules/system/src/Tests/Entity/EntityReferenceFieldTest.php
@@ -12,7 +12,7 @@
 use Drupal\Core\Entity\EntityStorageException;
 use Drupal\Core\Field\BaseFieldDefinition;
 use Drupal\Core\Field\FieldStorageDefinitionInterface;
-use Drupal\entity_reference\Tests\EntityReferenceTestTrait;
+use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;
 use Drupal\field\Entity\FieldConfig;
 use Drupal\user\Entity\Role;
 use Drupal\user\Entity\User;
diff --git a/core/modules/system/src/Tests/Entity/EntityViewBuilderTest.php b/core/modules/system/src/Tests/Entity/EntityViewBuilderTest.php
index 169af5f..58b9577 100644
--- a/core/modules/system/src/Tests/Entity/EntityViewBuilderTest.php
+++ b/core/modules/system/src/Tests/Entity/EntityViewBuilderTest.php
@@ -8,7 +8,7 @@
 namespace Drupal\system\Tests\Entity;
 
 use Drupal\Core\Language\LanguageInterface;
-use Drupal\entity_reference\Tests\EntityReferenceTestTrait;
+use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;
 use Drupal\Core\Cache\Cache;
 use Drupal\user\Entity\Role;
 use Drupal\user\RoleInterface;
@@ -23,13 +23,6 @@ class EntityViewBuilderTest extends EntityUnitTestBase {
   use EntityReferenceTestTrait;
 
   /**
-   * Modules to enable.
-   *
-   * @var array
-   */
-  public static $modules = array('entity_reference');
-
-  /**
    * {@inheritdoc}
    */
   protected function setUp() {
diff --git a/core/modules/system/src/Tests/Entity/FieldAccessTest.php b/core/modules/system/src/Tests/Entity/FieldAccessTest.php
index b44d84a..70fc629 100644
--- a/core/modules/system/src/Tests/Entity/FieldAccessTest.php
+++ b/core/modules/system/src/Tests/Entity/FieldAccessTest.php
@@ -22,7 +22,7 @@ class FieldAccessTest extends KernelTestBase {
    *
    * @var array
    */
-  public static $modules = array('entity_test', 'field', 'system', 'text', 'filter', 'user', 'entity_reference');
+  public static $modules = ['entity_test', 'field', 'system', 'text', 'filter', 'user'];
 
   /**
    * Holds the currently active global user ID that initiated the test run.
diff --git a/core/modules/system/src/Tests/Field/Update/FieldSettingsTest.php b/core/modules/system/src/Tests/Field/Update/FieldSettingsTest.php
new file mode 100644
index 0000000..c960184
--- /dev/null
+++ b/core/modules/system/src/Tests/Field/Update/FieldSettingsTest.php
@@ -0,0 +1,65 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\system\Tests\Field\Update\FieldSettingsTest.
+ */
+
+namespace Drupal\system\Tests\Field\Update;
+
+use Drupal\Component\Utility\Unicode;
+use Drupal\field\Entity\FieldConfig;
+use Drupal\field\Entity\FieldStorageConfig;
+use Drupal\system\Tests\Update\UpdatePathTestBase;
+
+/**
+ * Tests that field settings are properly updated during database updates.
+ *
+ * @group Field
+ */
+class FieldSettingsTest extends UpdatePathTestBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function setUp() {
+    $this->databaseDumpFiles = [
+      __DIR__ . '/../../../../tests/fixtures/update/drupal-8.bare.standard.php.gz',
+    ];
+    parent::setUp();
+  }
+
+  /**
+   * Tests field_update_8001().
+   */
+  public function testFieldUpdate8001() {
+    $id = 'node.field_image';
+    $config = \Drupal::configFactory();
+
+    $field_storage = FieldStorageConfig::load($id);
+    $settings = $field_storage->getSettings();
+    $this->assertTrue(array_key_exists('target_bundle', $settings));
+
+    // The 'target_bundle' setting is NULL by default for fields created by
+    // 'standard' profile.
+    $this->assertNull($settings['target_bundle']);
+
+    // Add a value to 'target_bundle'. We use here the Config API to avoid
+    // validations and store the setting directly in the backend.
+    $target_bundle = Unicode::strtolower($this->randomMachineName());
+    $config->getEditable("field.storage.$id")
+      ->set('settings.target_bundle', $target_bundle)
+      ->save(TRUE);
+
+    // Run updates.
+    $this->runUpdates();
+
+    $field_config = FieldConfig::loadByName('node', 'article', 'field_image');
+    $settings = $field_config->getSettings();
+
+    // Setting 'target_bundle' has been moved under 'handler_settings' as array.
+    $this->assertFalse(array_key_exists('target_bundle', $settings));
+    $this->assertIdentical($settings['handler_settings']['target_bundles'][$target_bundle], $target_bundle);
+  }
+
+}
diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index d6d98c8..9e1bf4b 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -8,6 +8,7 @@
 use Drupal\Component\Utility\UrlHelper;
 use Drupal\Core\Asset\AttachedAssetsInterface;
 use Drupal\Core\Cache\Cache;
+use Drupal\Core\Database\Query\AlterableInterface;
 use Drupal\Core\Extension\Extension;
 use Drupal\Core\Extension\ExtensionDiscovery;
 use Drupal\Core\Form\FormStateInterface;
@@ -1427,3 +1428,11 @@ function system_path_insert() {
 function system_path_delete($path) {
   \Drupal::service('path.alias_manager')->cacheClear();
 }
+
+/**
+ * Implements hook_query_TAG_alter() for entity reference selection handlers.
+ */
+function system_query_entity_reference_selection_alter(AlterableInterface $query) {
+  $handler = $query->getMetadata('entity_reference_selection_handler');
+  $handler->entityQueryAlter($query);
+}
diff --git a/core/modules/entity_reference/entity_reference.views.inc b/core/modules/system/system.views.inc
similarity index 83%
rename from core/modules/entity_reference/entity_reference.views.inc
rename to core/modules/system/system.views.inc
index 191005f..cf38836 100644
--- a/core/modules/entity_reference/entity_reference.views.inc
+++ b/core/modules/system/system.views.inc
@@ -2,7 +2,7 @@
 
 /**
  * @file
- * Provides views data for the entity_reference module.
+ * Provides views data for field types that do not have their own module.
  */
 
 use Drupal\field\FieldStorageConfigInterface;
@@ -10,9 +10,19 @@
 /**
  * Implements hook_field_views_data().
  */
-function entity_reference_field_views_data(FieldStorageConfigInterface $field_storage) {
+function core_field_views_data(FieldStorageConfigInterface $field_storage) {
   $data = views_field_default_views_data($field_storage);
+
+  // The code below only deals with the Entity reference field.
+  if ($field_storage->getType() != 'entity_reference') {
+    return $data;
+  }
+
   $entity_manager = \Drupal::entityManager();
+  $entity_type_id = $field_storage->getTargetEntityTypeId();
+  /** @var \Drupal\Core\Entity\Sql\DefaultTableMapping $table_mapping */
+  $table_mapping = $entity_manager->getStorage($entity_type_id)->getTableMapping();
+
   foreach ($data as $table_name => $table_data) {
     // Add a relationship to the target entity type.
     $target_entity_type_id = $field_storage->getSetting('target_type');
@@ -45,8 +55,6 @@ function entity_reference_field_views_data(FieldStorageConfigInterface $field_st
     $args['@entity'] = $entity_type->getLabel();
     $args['@label'] = $target_entity_type->getLowercaseLabel();
     $pseudo_field_name = 'reverse__' . $entity_type_id . '__' . $field_name;
-    /** @var \Drupal\Core\Entity\Sql\DefaultTableMapping $table_mapping */
-    $table_mapping = $entity_manager->getStorage($entity_type_id)->getTableMapping();
     $data[$target_base_table][$pseudo_field_name]['relationship'] = array(
       'title' => t('@entity using @field_name', $args),
       'label' => t('@field_name', array('@field_name' => $field_name)),
diff --git a/core/modules/entity_reference/tests/modules/entity_reference_test/config/install/views.view.test_entity_reference.yml b/core/modules/system/tests/modules/entity_reference_test/config/install/views.view.test_entity_reference.yml
similarity index 99%
rename from core/modules/entity_reference/tests/modules/entity_reference_test/config/install/views.view.test_entity_reference.yml
rename to core/modules/system/tests/modules/entity_reference_test/config/install/views.view.test_entity_reference.yml
index 919028b..3fde0ec 100644
--- a/core/modules/entity_reference/tests/modules/entity_reference_test/config/install/views.view.test_entity_reference.yml
+++ b/core/modules/system/tests/modules/entity_reference_test/config/install/views.view.test_entity_reference.yml
@@ -2,7 +2,6 @@ langcode: en
 status: true
 dependencies:
   module:
-    - entity_reference
     - entity_reference_test
     - node
     - user
diff --git a/core/modules/entity_reference/tests/modules/entity_reference_test/config/install/views.view.test_entity_reference_entity_test.yml b/core/modules/system/tests/modules/entity_reference_test/config/install/views.view.test_entity_reference_entity_test.yml
similarity index 99%
rename from core/modules/entity_reference/tests/modules/entity_reference_test/config/install/views.view.test_entity_reference_entity_test.yml
rename to core/modules/system/tests/modules/entity_reference_test/config/install/views.view.test_entity_reference_entity_test.yml
index ec3ab5b..752e528 100644
--- a/core/modules/entity_reference/tests/modules/entity_reference_test/config/install/views.view.test_entity_reference_entity_test.yml
+++ b/core/modules/system/tests/modules/entity_reference_test/config/install/views.view.test_entity_reference_entity_test.yml
@@ -2,7 +2,6 @@ langcode: en
 status: true
 dependencies:
   module:
-    - entity_reference
     - entity_reference_test
     - entity_test
 id: test_entity_reference_entity_test
diff --git a/core/modules/entity_reference/tests/modules/entity_reference_test/entity_reference_test.info.yml b/core/modules/system/tests/modules/entity_reference_test/entity_reference_test.info.yml
similarity index 90%
rename from core/modules/entity_reference/tests/modules/entity_reference_test/entity_reference_test.info.yml
rename to core/modules/system/tests/modules/entity_reference_test/entity_reference_test.info.yml
index 883c70e..62830f4 100644
--- a/core/modules/entity_reference/tests/modules/entity_reference_test/entity_reference_test.info.yml
+++ b/core/modules/system/tests/modules/entity_reference_test/entity_reference_test.info.yml
@@ -5,7 +5,6 @@ core: 8.x
 package: Testing
 version: VERSION
 dependencies:
-  - entity_reference
   - node
   - user
   - views
diff --git a/core/modules/entity_reference/tests/modules/entity_reference_test/entity_reference_test.module b/core/modules/system/tests/modules/entity_reference_test/entity_reference_test.module
similarity index 100%
rename from core/modules/entity_reference/tests/modules/entity_reference_test/entity_reference_test.module
rename to core/modules/system/tests/modules/entity_reference_test/entity_reference_test.module
diff --git a/core/modules/entity_reference/tests/modules/entity_reference_test_views/entity_reference_test_views.info.yml b/core/modules/system/tests/modules/entity_reference_test_views/entity_reference_test_views.info.yml
similarity index 90%
rename from core/modules/entity_reference/tests/modules/entity_reference_test_views/entity_reference_test_views.info.yml
rename to core/modules/system/tests/modules/entity_reference_test_views/entity_reference_test_views.info.yml
index 04fb33b..19678f8 100644
--- a/core/modules/entity_reference/tests/modules/entity_reference_test_views/entity_reference_test_views.info.yml
+++ b/core/modules/system/tests/modules/entity_reference_test_views/entity_reference_test_views.info.yml
@@ -5,5 +5,4 @@ package: Testing
 version: VERSION
 core: 8.x
 dependencies:
- - entity_reference
  - views
diff --git a/core/modules/entity_reference/tests/modules/entity_reference_test_views/test_views/views.view.test_entity_reference_entity_test_mul_view.yml b/core/modules/system/tests/modules/entity_reference_test_views/test_views/views.view.test_entity_reference_entity_test_mul_view.yml
similarity index 100%
rename from core/modules/entity_reference/tests/modules/entity_reference_test_views/test_views/views.view.test_entity_reference_entity_test_mul_view.yml
rename to core/modules/system/tests/modules/entity_reference_test_views/test_views/views.view.test_entity_reference_entity_test_mul_view.yml
diff --git a/core/modules/entity_reference/tests/modules/entity_reference_test_views/test_views/views.view.test_entity_reference_entity_test_view.yml b/core/modules/system/tests/modules/entity_reference_test_views/test_views/views.view.test_entity_reference_entity_test_view.yml
similarity index 100%
rename from core/modules/entity_reference/tests/modules/entity_reference_test_views/test_views/views.view.test_entity_reference_entity_test_view.yml
rename to core/modules/system/tests/modules/entity_reference_test_views/test_views/views.view.test_entity_reference_entity_test_view.yml
diff --git a/core/modules/entity_reference/tests/modules/entity_reference_test_views/test_views/views.view.test_entity_reference_reverse_entity_test_mul_view.yml b/core/modules/system/tests/modules/entity_reference_test_views/test_views/views.view.test_entity_reference_reverse_entity_test_mul_view.yml
similarity index 100%
rename from core/modules/entity_reference/tests/modules/entity_reference_test_views/test_views/views.view.test_entity_reference_reverse_entity_test_mul_view.yml
rename to core/modules/system/tests/modules/entity_reference_test_views/test_views/views.view.test_entity_reference_reverse_entity_test_mul_view.yml
diff --git a/core/modules/entity_reference/tests/modules/entity_reference_test_views/test_views/views.view.test_entity_reference_reverse_entity_test_view.yml b/core/modules/system/tests/modules/entity_reference_test_views/test_views/views.view.test_entity_reference_reverse_entity_test_view.yml
similarity index 100%
rename from core/modules/entity_reference/tests/modules/entity_reference_test_views/test_views/views.view.test_entity_reference_reverse_entity_test_view.yml
rename to core/modules/system/tests/modules/entity_reference_test_views/test_views/views.view.test_entity_reference_reverse_entity_test_view.yml
diff --git a/core/modules/system/tests/modules/entity_test/entity_test.info.yml b/core/modules/system/tests/modules/entity_test/entity_test.info.yml
index 8d3200c..bd4382e 100644
--- a/core/modules/system/tests/modules/entity_test/entity_test.info.yml
+++ b/core/modules/system/tests/modules/entity_test/entity_test.info.yml
@@ -7,4 +7,3 @@ core: 8.x
 dependencies:
   - field
   - text
-  - entity_reference
diff --git a/core/modules/taxonomy/src/Tests/Migrate/d6/MigrateTermNodeTestBase.php b/core/modules/taxonomy/src/Tests/Migrate/d6/MigrateTermNodeTestBase.php
index 0d51f64..3ea2f12 100644
--- a/core/modules/taxonomy/src/Tests/Migrate/d6/MigrateTermNodeTestBase.php
+++ b/core/modules/taxonomy/src/Tests/Migrate/d6/MigrateTermNodeTestBase.php
@@ -8,7 +8,7 @@
 namespace Drupal\taxonomy\Tests\Migrate\d6;
 
 use Drupal\Core\Field\FieldStorageDefinitionInterface;
-use Drupal\entity_reference\Tests\EntityReferenceTestTrait;
+use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait ;
 use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
 
 /**
@@ -21,7 +21,7 @@
   /**
    * {@inheritdoc}
    */
-  static $modules = array('node', 'taxonomy', 'text', 'filter', 'entity_reference');
+  public static $modules = ['node', 'taxonomy', 'text', 'filter'];
 
   /**
    * {@inheritdoc}
diff --git a/core/modules/taxonomy/src/Tests/Migrate/d6/MigrateVocabularyEntityDisplayTest.php b/core/modules/taxonomy/src/Tests/Migrate/d6/MigrateVocabularyEntityDisplayTest.php
index bcf6b69..318f5e1 100644
--- a/core/modules/taxonomy/src/Tests/Migrate/d6/MigrateVocabularyEntityDisplayTest.php
+++ b/core/modules/taxonomy/src/Tests/Migrate/d6/MigrateVocabularyEntityDisplayTest.php
@@ -21,7 +21,7 @@ class MigrateVocabularyEntityDisplayTest extends MigrateDrupal6TestBase {
    *
    * @var array
    */
-  static $modules = array('field', 'node', 'taxonomy', 'text', 'entity_reference');
+  public static $modules = ['field', 'node', 'taxonomy', 'text'];
 
   /**
    * {@inheritdoc}
diff --git a/core/modules/taxonomy/src/Tests/Migrate/d6/MigrateVocabularyEntityFormDisplayTest.php b/core/modules/taxonomy/src/Tests/Migrate/d6/MigrateVocabularyEntityFormDisplayTest.php
index 80efa09..b42f843 100644
--- a/core/modules/taxonomy/src/Tests/Migrate/d6/MigrateVocabularyEntityFormDisplayTest.php
+++ b/core/modules/taxonomy/src/Tests/Migrate/d6/MigrateVocabularyEntityFormDisplayTest.php
@@ -21,7 +21,7 @@ class MigrateVocabularyEntityFormDisplayTest extends MigrateDrupal6TestBase {
    *
    * @var array
    */
-  static $modules = array('node', 'taxonomy', 'field', 'text', 'entity_reference');
+  public static $modules = ['node', 'taxonomy', 'field', 'text'];
 
   /**
    * {@inheritdoc}
diff --git a/core/modules/taxonomy/src/Tests/Migrate/d6/MigrateVocabularyFieldInstanceTest.php b/core/modules/taxonomy/src/Tests/Migrate/d6/MigrateVocabularyFieldInstanceTest.php
index f5c02ad..c1186cd 100644
--- a/core/modules/taxonomy/src/Tests/Migrate/d6/MigrateVocabularyFieldInstanceTest.php
+++ b/core/modules/taxonomy/src/Tests/Migrate/d6/MigrateVocabularyFieldInstanceTest.php
@@ -23,7 +23,7 @@ class MigrateVocabularyFieldInstanceTest extends MigrateDrupal6TestBase {
    *
    * @var array
    */
-  static $modules = array('node', 'field', 'taxonomy', 'text', 'entity_reference');
+  public static $modules = ['node', 'field', 'taxonomy', 'text'];
 
   /**
    * {@inheritdoc}
@@ -87,7 +87,7 @@ public function testVocabularyFieldInstance() {
 
     $settings = $field->getSettings();
     $this->assertIdentical('default:taxonomy_term', $settings['handler'], 'The handler plugin ID is correct.');
-    $this->assertIdentical(['tags'], $settings['handler_settings']['target_bundles'], 'The target_bundle handler setting is correct.');
+    $this->assertIdentical(['tags'], $settings['handler_settings']['target_bundles'], 'The target_bundles handler setting is correct.');
     $this->assertIdentical(TRUE, $settings['handler_settings']['auto_create'], 'The "auto_create" setting is correct.');
 
     $this->assertIdentical(array('node', 'article', 'tags'), entity_load('migration', 'd6_vocabulary_field_instance')->getIdMap()->lookupDestinationID(array(4, 'article')));
diff --git a/core/modules/taxonomy/src/Tests/Migrate/d6/MigrateVocabularyFieldTest.php b/core/modules/taxonomy/src/Tests/Migrate/d6/MigrateVocabularyFieldTest.php
index 0c588c8..227897a 100644
--- a/core/modules/taxonomy/src/Tests/Migrate/d6/MigrateVocabularyFieldTest.php
+++ b/core/modules/taxonomy/src/Tests/Migrate/d6/MigrateVocabularyFieldTest.php
@@ -22,7 +22,7 @@ class MigrateVocabularyFieldTest extends MigrateDrupal6TestBase {
    *
    * @var array
    */
-  static $modules = array('node', 'taxonomy', 'field', 'text', 'entity_reference');
+  static $modules = ['node', 'taxonomy', 'field', 'text'];
 
   /**
    * {@inheritdoc}
diff --git a/core/modules/taxonomy/src/Tests/TaxonomyTestBase.php b/core/modules/taxonomy/src/Tests/TaxonomyTestBase.php
index c26ed2f..5202429 100644
--- a/core/modules/taxonomy/src/Tests/TaxonomyTestBase.php
+++ b/core/modules/taxonomy/src/Tests/TaxonomyTestBase.php
@@ -7,7 +7,7 @@
 
 namespace Drupal\taxonomy\Tests;
 
-use Drupal\entity_reference\Tests\EntityReferenceTestTrait;
+use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait ;
 use Drupal\simpletest\WebTestBase;
 
 /**
diff --git a/core/modules/taxonomy/src/Tests/TaxonomyTranslationTestTrait.php b/core/modules/taxonomy/src/Tests/TaxonomyTranslationTestTrait.php
index 4b828cf..c2a38db 100644
--- a/core/modules/taxonomy/src/Tests/TaxonomyTranslationTestTrait.php
+++ b/core/modules/taxonomy/src/Tests/TaxonomyTranslationTestTrait.php
@@ -8,7 +8,7 @@
 namespace Drupal\taxonomy\Tests;
 
 use Drupal\Core\Field\FieldStorageDefinitionInterface;
-use Drupal\entity_reference\Tests\EntityReferenceTestTrait;
+use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;
 use Drupal\field\Entity\FieldStorageConfig;
 use Drupal\language\Entity\ConfigurableLanguage;
 
diff --git a/core/modules/taxonomy/src/Tests/TermEntityReferenceTest.php b/core/modules/taxonomy/src/Tests/TermEntityReferenceTest.php
index fc452ff..ec28677 100644
--- a/core/modules/taxonomy/src/Tests/TermEntityReferenceTest.php
+++ b/core/modules/taxonomy/src/Tests/TermEntityReferenceTest.php
@@ -22,7 +22,7 @@ class TermEntityReferenceTest extends TaxonomyTestBase {
    *
    * @var array
    */
-  public static $modules = array('entity_reference', 'entity_reference_test', 'entity_test');
+  public static $modules = ['entity_reference_test', 'entity_test'];
 
   /**
    * Tests an entity reference field restricted to a single vocabulary.
diff --git a/core/modules/taxonomy/src/Tests/Views/TaxonomyIndexTidUiTest.php b/core/modules/taxonomy/src/Tests/Views/TaxonomyIndexTidUiTest.php
index 4ea9e32..394e0f5 100644
--- a/core/modules/taxonomy/src/Tests/Views/TaxonomyIndexTidUiTest.php
+++ b/core/modules/taxonomy/src/Tests/Views/TaxonomyIndexTidUiTest.php
@@ -8,7 +8,7 @@
 namespace Drupal\taxonomy\Tests\Views;
 
 use Drupal\Core\Field\FieldStorageDefinitionInterface;
-use Drupal\entity_reference\Tests\EntityReferenceTestTrait;
+use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait ;
 use Drupal\taxonomy\Entity\Term;
 use Drupal\taxonomy\Entity\Vocabulary;
 use Drupal\views\Tests\ViewTestData;
@@ -36,7 +36,7 @@ class TaxonomyIndexTidUiTest extends UITestBase {
    *
    * @var array
    */
-  public static $modules = array('node', 'taxonomy', 'taxonomy_test_views', 'entity_reference');
+  public static $modules = ['node', 'taxonomy', 'taxonomy_test_views'];
 
   /**
    * A nested array of \Drupal\taxonomy\TermInterface objects.
diff --git a/core/modules/taxonomy/src/Tests/Views/TaxonomyTestBase.php b/core/modules/taxonomy/src/Tests/Views/TaxonomyTestBase.php
index ae84b09..e079557 100644
--- a/core/modules/taxonomy/src/Tests/Views/TaxonomyTestBase.php
+++ b/core/modules/taxonomy/src/Tests/Views/TaxonomyTestBase.php
@@ -9,7 +9,7 @@
 
 use Drupal\Core\Field\FieldStorageDefinitionInterface;
 use Drupal\Core\Language\LanguageInterface;
-use Drupal\entity_reference\Tests\EntityReferenceTestTrait;
+use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait ;
 use Drupal\views\Tests\ViewTestBase;
 use Drupal\views\Tests\ViewTestData;
 
diff --git a/core/modules/taxonomy/taxonomy.info.yml b/core/modules/taxonomy/taxonomy.info.yml
index a54f7d1..ceca3dd 100644
--- a/core/modules/taxonomy/taxonomy.info.yml
+++ b/core/modules/taxonomy/taxonomy.info.yml
@@ -5,7 +5,6 @@ package: Core
 version: VERSION
 core: 8.x
 dependencies:
-  - entity_reference
   - node
   - text
 configure: entity.taxonomy_vocabulary.collection
diff --git a/core/modules/taxonomy/taxonomy.module b/core/modules/taxonomy/taxonomy.module
index f7c8c0e..71bbf4e 100644
--- a/core/modules/taxonomy/taxonomy.module
+++ b/core/modules/taxonomy/taxonomy.module
@@ -501,9 +501,12 @@ function taxonomy_build_node_index($node) {
   if ($status && $node->isDefaultRevision()) {
     // Collect a unique list of all the term IDs from all node fields.
     $tid_all = array();
+    $entity_reference_class = 'Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem';
     foreach ($node->getFieldDefinitions() as $field) {
       $field_name = $field->getName();
-      if (is_subclass_of($field->getItemDefinition()->getClass(), '\Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem') && $field->getSetting('target_type') == 'taxonomy_term') {
+      $class = $field->getItemDefinition()->getClass();
+      $is_entity_reference_class = $class == $entity_reference_class || is_subclass_of($class, $entity_reference_class);
+      if ($is_entity_reference_class && $field->getSetting('target_type') == 'taxonomy_term') {
         foreach ($node->getTranslationLanguages() as $language) {
           foreach ($node->getTranslation($language->getId())->$field_name as $item) {
             if (!$item->isEmpty()) {
diff --git a/core/modules/user/src/Plugin/EntityReferenceSelection/UserSelection.php b/core/modules/user/src/Plugin/EntityReferenceSelection/UserSelection.php
index e2dd03d..0728c99 100644
--- a/core/modules/user/src/Plugin/EntityReferenceSelection/UserSelection.php
+++ b/core/modules/user/src/Plugin/EntityReferenceSelection/UserSelection.php
@@ -120,7 +120,7 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta
     $form['filter']['settings'] = array(
       '#type' => 'container',
       '#attributes' => array('class' => array('entity_reference-settings')),
-      '#process' => array('_entity_reference_form_process_merge_parent'),
+      '#process' => array(array('\Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem', 'formProcessMergeParent')),
     );
 
     if ($selection_handler_settings['filter']['type'] == 'role') {
diff --git a/core/modules/user/src/Tests/UserEntityReferenceTest.php b/core/modules/user/src/Tests/UserEntityReferenceTest.php
index 6c8bca8..65b92e5 100644
--- a/core/modules/user/src/Tests/UserEntityReferenceTest.php
+++ b/core/modules/user/src/Tests/UserEntityReferenceTest.php
@@ -7,7 +7,7 @@
 
 namespace Drupal\user\Tests;
 
-use Drupal\entity_reference\Tests\EntityReferenceTestTrait;
+use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;
 use Drupal\field\Entity\FieldConfig;
 use Drupal\system\Tests\Entity\EntityUnitTestBase;
 
@@ -35,13 +35,6 @@ class UserEntityReferenceTest extends EntityUnitTestBase {
   protected $role2;
 
   /**
-   * Modules to enable.
-   *
-   * @var array
-   */
-  public static $modules = array('entity_reference', 'user');
-
-  /**
    * {@inheritdoc}
    */
   protected function setUp() {
diff --git a/core/modules/views/config/schema/views.display.schema.yml b/core/modules/views/config/schema/views.display.schema.yml
index d31678f..16b0d1d 100644
--- a/core/modules/views/config/schema/views.display.schema.yml
+++ b/core/modules/views/config/schema/views.display.schema.yml
@@ -127,3 +127,7 @@ views.display.attachment:
     render_pager:
       type: boolean
       label: 'Render pager'
+
+views.display.entity_reference:
+  type: views_display
+  label: 'Entity Reference'
diff --git a/core/modules/views/config/schema/views.row.schema.yml b/core/modules/views/config/schema/views.row.schema.yml
index 4378f0c..3eae0c9 100644
--- a/core/modules/views/config/schema/views.row.schema.yml
+++ b/core/modules/views/config/schema/views.row.schema.yml
@@ -85,3 +85,7 @@ views.row.opml_fields:
     url_field:
       type: string
       label: 'URL attribute'
+
+views.row.entity_reference:
+  type: views.row.fields
+  label: 'Entity Reference inline fields'
diff --git a/core/modules/views/config/schema/views.style.schema.yml b/core/modules/views/config/schema/views.style.schema.yml
index f819aeb..ad0571b 100644
--- a/core/modules/views/config/schema/views.style.schema.yml
+++ b/core/modules/views/config/schema/views.style.schema.yml
@@ -143,3 +143,14 @@ views.style.unformatted_summary:
     separator:
       type: string
       label: 'Separator'
+
+views.style.entity_reference:
+  type: views_style
+  label: 'Entity Reference list'
+  mapping:
+    search_fields:
+      type: sequence
+      label: 'Search fields'
+      sequence:
+        type: string
+        label: 'Search field'
diff --git a/core/modules/entity_reference/src/Plugin/views/display/EntityReference.php b/core/modules/views/src/Plugin/views/display/EntityReference.php
similarity index 96%
rename from core/modules/entity_reference/src/Plugin/views/display/EntityReference.php
rename to core/modules/views/src/Plugin/views/display/EntityReference.php
index e55481c..cf4e915 100644
--- a/core/modules/entity_reference/src/Plugin/views/display/EntityReference.php
+++ b/core/modules/views/src/Plugin/views/display/EntityReference.php
@@ -2,12 +2,10 @@
 
 /**
  * @file
- * Contains \Drupal\entity_reference\Plugin\views\display\EntityReference.
+ * Contains \Drupal\views\Plugin\views\display\EntityReference.
  */
 
-namespace Drupal\entity_reference\Plugin\views\display;
-
-use Drupal\views\Plugin\views\display\DisplayPluginBase;
+namespace Drupal\views\Plugin\views\display;
 
 /**
  * The plugin that handles an EntityReference display.
diff --git a/core/modules/entity_reference/src/Plugin/views/row/EntityReference.php b/core/modules/views/src/Plugin/views/row/EntityReference.php
similarity index 90%
rename from core/modules/entity_reference/src/Plugin/views/row/EntityReference.php
rename to core/modules/views/src/Plugin/views/row/EntityReference.php
index 3323933..abed3c2 100644
--- a/core/modules/entity_reference/src/Plugin/views/row/EntityReference.php
+++ b/core/modules/views/src/Plugin/views/row/EntityReference.php
@@ -2,13 +2,12 @@
 
 /**
  * @file
- * Contains \Drupal\entity_reference\Plugin\views\row\EntityReference.
+ * Contains \Drupal\views\Plugin\views\row\EntityReference.
  */
 
-namespace Drupal\entity_reference\Plugin\views\row;
+namespace Drupal\views\Plugin\views\row;
 
 use Drupal\Core\Form\FormStateInterface;
-use Drupal\views\Plugin\views\row\Fields;
 
 /**
  * EntityReference row plugin.
diff --git a/core/modules/entity_reference/src/Plugin/views/style/EntityReference.php b/core/modules/views/src/Plugin/views/style/EntityReference.php
similarity index 94%
rename from core/modules/entity_reference/src/Plugin/views/style/EntityReference.php
rename to core/modules/views/src/Plugin/views/style/EntityReference.php
index 328d96e..a66b6b5 100644
--- a/core/modules/entity_reference/src/Plugin/views/style/EntityReference.php
+++ b/core/modules/views/src/Plugin/views/style/EntityReference.php
@@ -2,14 +2,13 @@
 
 /**
  * @file
- * Contains \Drupal\entity_reference\Plugin\views\style\EntityReference.
+ * Contains \Drupal\views\Plugin\views\style\EntityReference.
  */
 
-namespace Drupal\entity_reference\Plugin\views\style;
+namespace Drupal\views\Plugin\views\style;
 
 use Drupal\Component\Utility\Xss;
 use Drupal\Core\Form\FormStateInterface;
-use Drupal\views\Plugin\views\style\StylePluginBase;
 
 /**
  * EntityReference style plugin.
diff --git a/core/modules/views/src/Tests/DefaultViewsTest.php b/core/modules/views/src/Tests/DefaultViewsTest.php
index 3df4082..61aa72e 100644
--- a/core/modules/views/src/Tests/DefaultViewsTest.php
+++ b/core/modules/views/src/Tests/DefaultViewsTest.php
@@ -13,7 +13,7 @@
 use Drupal\Core\Field\FieldStorageDefinitionInterface;
 use Drupal\Core\Language\LanguageInterface;
 use Drupal\Core\Url;
-use Drupal\entity_reference\Tests\EntityReferenceTestTrait;
+use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait ;
 use Drupal\views\Views;
 
 /**
diff --git a/core/modules/views/src/Tests/Entity/RowEntityRenderersTest.php b/core/modules/views/src/Tests/Entity/RowEntityRenderersTest.php
index 1037f45..eff9507 100644
--- a/core/modules/views/src/Tests/Entity/RowEntityRenderersTest.php
+++ b/core/modules/views/src/Tests/Entity/RowEntityRenderersTest.php
@@ -25,7 +25,7 @@ class RowEntityRenderersTest extends ViewUnitTestBase {
    *
    * @var array
    */
-  public static $modules = array('field', 'filter', 'text', 'node', 'user', 'language', 'entity_reference', 'views_test_language');
+  public static $modules = ['field', 'filter', 'text', 'node', 'user', 'language', 'views_test_language'];
 
   /**
    * Views used by this test.
diff --git a/core/modules/views/src/Tests/Entity/ViewEntityDependenciesTest.php b/core/modules/views/src/Tests/Entity/ViewEntityDependenciesTest.php
index 8805214..b412c84 100644
--- a/core/modules/views/src/Tests/Entity/ViewEntityDependenciesTest.php
+++ b/core/modules/views/src/Tests/Entity/ViewEntityDependenciesTest.php
@@ -32,7 +32,7 @@ class ViewEntityDependenciesTest extends ViewUnitTestBase {
    *
    * @var array
    */
-  public static $modules = ['node', 'comment', 'user', 'field', 'text', 'entity_reference', 'search'];
+  public static $modules = ['node', 'comment', 'user', 'field', 'text', 'search'];
 
   /**
    * {@inheritdoc}
diff --git a/core/modules/views/src/Tests/ViewExecutableTest.php b/core/modules/views/src/Tests/ViewExecutableTest.php
index 26e381d..4cf699f 100644
--- a/core/modules/views/src/Tests/ViewExecutableTest.php
+++ b/core/modules/views/src/Tests/ViewExecutableTest.php
@@ -35,7 +35,7 @@ class ViewExecutableTest extends ViewUnitTestBase {
 
   use CommentTestTrait;
 
-  public static $modules = array('system', 'node', 'comment', 'user', 'filter', 'field', 'text', 'entity_reference');
+  public static $modules = ['system', 'node', 'comment', 'user', 'filter', 'field', 'text'];
 
   /**
    * Views used by this test.
diff --git a/core/modules/views/src/Tests/Wizard/TaggedWithTest.php b/core/modules/views/src/Tests/Wizard/TaggedWithTest.php
index b9c58f7..931cd29 100644
--- a/core/modules/views/src/Tests/Wizard/TaggedWithTest.php
+++ b/core/modules/views/src/Tests/Wizard/TaggedWithTest.php
@@ -8,7 +8,7 @@
 namespace Drupal\views\Tests\Wizard;
 
 use Drupal\Core\Field\FieldStorageDefinitionInterface;
-use Drupal\entity_reference\Tests\EntityReferenceTestTrait;
+use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait ;
 
 /**
  * Tests the ability of the views wizard to create views filtered by taxonomy.
diff --git a/core/profiles/standard/config/install/core.entity_form_display.node.article.default.yml b/core/profiles/standard/config/install/core.entity_form_display.node.article.default.yml
index 64f8efc..c767b11 100644
--- a/core/profiles/standard/config/install/core.entity_form_display.node.article.default.yml
+++ b/core/profiles/standard/config/install/core.entity_form_display.node.article.default.yml
@@ -9,7 +9,6 @@ dependencies:
     - node.type.article
   module:
     - comment
-    - entity_reference
     - image
     - path
     - taxonomy
diff --git a/core/profiles/standard/config/install/core.entity_form_display.node.page.default.yml b/core/profiles/standard/config/install/core.entity_form_display.node.page.default.yml
index 967c74e..cfdb2a9 100644
--- a/core/profiles/standard/config/install/core.entity_form_display.node.page.default.yml
+++ b/core/profiles/standard/config/install/core.entity_form_display.node.page.default.yml
@@ -5,7 +5,6 @@ dependencies:
     - field.field.node.page.body
     - node.type.page
   module:
-    - entity_reference
     - path
     - text
 id: node.page.default
diff --git a/core/profiles/standard/config/install/field.field.node.article.field_tags.yml b/core/profiles/standard/config/install/field.field.node.article.field_tags.yml
index d69a558..90267bf 100644
--- a/core/profiles/standard/config/install/field.field.node.article.field_tags.yml
+++ b/core/profiles/standard/config/install/field.field.node.article.field_tags.yml
@@ -22,5 +22,3 @@ dependencies:
   config:
     - field.storage.node.field_tags
     - node.type.article
-  module:
-    - entity_reference
diff --git a/core/profiles/standard/standard.info.yml b/core/profiles/standard/standard.info.yml
index a356ae8..5c7b10b 100644
--- a/core/profiles/standard/standard.info.yml
+++ b/core/profiles/standard/standard.info.yml
@@ -19,7 +19,6 @@ dependencies:
   - block_content
   - quickedit
   - editor
-  - entity_reference
   - help
   - image
   - menu_ui
