diff --git a/core/lib/Drupal/Core/Entity/Field/Type/EntityReferenceItem.php b/core/lib/Drupal/Core/Entity/Field/Type/EntityReferenceItem.php
index 496a720..a5a63a0 100644
--- a/core/lib/Drupal/Core/Entity/Field/Type/EntityReferenceItem.php
+++ b/core/lib/Drupal/Core/Entity/Field/Type/EntityReferenceItem.php
@@ -73,13 +73,16 @@ public function setValue($values) {
     if (isset($values['target_id'])) {
       $this->properties['target_id']->setValue($values['target_id']);
     }
+    elseif (isset($values['revision_id'])) {
+      $this->properties['revision_id']->setValue($values['revision_id']);
+    }
     elseif (isset($values['entity'])) {
       $this->properties['entity']->setValue($values['entity']);
     }
     else {
       $this->properties['entity']->setValue(NULL);
     }
-    unset($values['entity'], $values['target_id']);
+    unset($values['entity'], $values['target_id'], $values['revision_id']);
     if ($values) {
       throw new \InvalidArgumentException('Property ' . key($values) . ' is unknown.');
     }
diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Type/Selection/SelectionInterface.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Type/Selection/SelectionInterface.php
index 069a2cb..dcc0c42 100644
--- a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Type/Selection/SelectionInterface.php
+++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Type/Selection/SelectionInterface.php
@@ -23,8 +23,9 @@
    * Returns a list of referencable entities.
    *
    * @return array
-   *   An array of referencable entities. Keys are entity IDs and
-   *   values are (safe HTML) labels to be displayed to the user.
+   *   A multidimensional array of referencable entities. The first level of
+   *   keys are entity bundles. The second level are entity IDs and values are
+   *   (safe HTML) labels to be displayed to the user.
    */
   public function getReferencableEntities($match = NULL, $match_operator = 'CONTAINS', $limit = 0);
 
diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/entity_reference/selection/SelectionBase.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/entity_reference/selection/SelectionBase.php
index 205df06..b92cc8b 100644
--- a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/entity_reference/selection/SelectionBase.php
+++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/entity_reference/selection/SelectionBase.php
@@ -218,7 +218,10 @@ public function validateReferencableEntities(array $ids) {
    * Implements SelectionInterface::validateAutocompleteInput().
    */
   public function validateAutocompleteInput($input, &$element, &$form_state, $form, $strict = TRUE) {
-    $entities = $this->getReferencableEntities($input, '=', 6);
+    $entities = array();
+    foreach ($this->getReferencableEntities($input, '=', 6) as $bundle => $bundle_entities) {
+      $entities += $bundle_entities;
+    }
     $params = array(
       '%value' => $input,
       '@value' => $input,
diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceItemTest.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceItemTest.php
index 8906e4d..d8e91b0 100644
--- a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceItemTest.php
+++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceItemTest.php
@@ -7,26 +7,25 @@
 
 namespace Drupal\entity_reference\Tests;
 
-use Drupal\simpletest\WebTestBase;
-use Drupal\entity_reference\Type\EntityReferenceItem;
-use Drupal\Core\Entity\Field\FieldItemInterface;
 use Drupal\Core\Entity\Field\FieldInterface;
+use Drupal\Core\Entity\Field\FieldItemInterface;
+use Drupal\field\Tests\FieldItemUnitTestBase;
 
 /**
  * Tests the new entity API for the entity reference field type.
  */
-class EntityReferenceItemTest extends WebTestBase {
+class EntityReferenceItemTest extends FieldItemUnitTestBase {
 
   /**
    * Modules to enable.
    *
    * @var array
    */
-  public static $modules = array('field', 'field_sql_storage', 'entity_test', 'options', 'entity_reference');
+  public static $modules = array('entity_reference', 'taxonomy', 'options');
 
   public static function getInfo() {
     return array(
-      'name' => 'Entity Reference field API',
+      'name' => 'Entity Reference field item',
       'description' => 'Tests using entity fields of the entity reference field type.',
       'group' => 'Entity Reference',
     );
@@ -34,23 +33,30 @@ public static function getInfo() {
 
   public function setUp() {
     parent::setUp();
+    $this->installSchema('taxonomy', 'taxonomy_term_data');
+    $this->installSchema('taxonomy', 'taxonomy_term_hierarchy');
+
+    $vocabulary = entity_create('taxonomy_vocabulary', array(
+      'name' => $this->randomName(),
+      'vid' => drupal_strtolower($this->randomName()),
+      'langcode' => LANGUAGE_NOT_SPECIFIED,
+    ));
+    $vocabulary->save();
 
     $field = array(
       'translatable' => FALSE,
-      'entity_types' => array(),
       'settings' => array(
-        'target_type' => 'node',
+        'target_type' => 'taxonomy_term',
       ),
-      'field_name' => 'field_test',
+      'field_name' => 'field_test_taxonomy',
       'type' => 'entity_reference',
       'cardinality' => FIELD_CARDINALITY_UNLIMITED,
     );
-
     field_create_field($field);
 
     $instance = array(
       'entity_type' => 'entity_test',
-      'field_name' => 'field_test',
+      'field_name' => 'field_test_taxonomy',
       'bundle' => 'entity_test',
       'widget' => array(
         'type' => 'options_select',
@@ -61,42 +67,51 @@ public function setUp() {
       ),
     );
     field_create_instance($instance);
+    $this->term = entity_create('taxonomy_term', array(
+      'name' => $this->randomName(),
+      'vid' => $vocabulary->id(),
+      'langcode' => LANGUAGE_NOT_SPECIFIED,
+    ));
+    $this->term->save();
   }
 
   /**
-   * Tests using entity fields of the taxonomy term reference field type.
+   * Tests using entity fields of the entity reference field type.
    */
-  public function testEntityReferenceItem() {
-    // Create a node.
-    $node1 = $this->drupalCreateNode();
-    $nid = $node1->id();
-
+  public function testTaxonomyTermReferenceItem() {
+    $tid = $this->term->id();
     // Just being able to create the entity like this verifies a lot of code.
-    $entity = entity_create('entity_test', array('name' => 'foo'));
-    $entity->field_test->target_id = $nid;
+    $entity = entity_create('entity_test', array());
+    $entity->field_test_taxonomy->target_id = $tid;
+    $entity->name->value = $this->randomName();
     $entity->save();
 
-    $this->assertTrue($entity->field_test instanceof FieldInterface, 'Field implements interface.');
-    $this->assertTrue($entity->field_test[0] instanceof FieldItemInterface, 'Field item implements interface.');
-    $this->assertEqual($entity->field_test->target_id, $nid);
-    $this->assertEqual($entity->field_test->entity->title, $node1->label());
-    $this->assertEqual($entity->field_test->entity->id(), $nid);
-    $this->assertEqual($entity->field_test->entity->uuid(), $node1->uuid());
+    $entity = entity_load('entity_test', $entity->id());
+    $this->assertTrue($entity->field_test_taxonomy instanceof FieldInterface, 'Field implements interface.');
+    $this->assertTrue($entity->field_test_taxonomy[0] instanceof FieldItemInterface, 'Field item implements interface.');
+    $this->assertEqual($entity->field_test_taxonomy->target_id, $tid);
+    $this->assertEqual($entity->field_test_taxonomy->entity->name, $this->term->name);
+    $this->assertEqual($entity->field_test_taxonomy->entity->id(), $tid);
+    $this->assertEqual($entity->field_test_taxonomy->entity->uuid(), $this->term->uuid());
 
     // Change the name of the term via the reference.
     $new_name = $this->randomName();
-    $entity->field_test->entity->title = $new_name;
-    $entity->field_test->entity->save();
-
+    $entity->field_test_taxonomy->entity->name = $new_name;
+    $entity->field_test_taxonomy->entity->save();
     // Verify it is the correct name.
-    $node = node_load($nid);
-    $this->assertEqual($node->label(), $new_name);
-
-    // Make sure the computed node reflects updates to the node id.
-    $node2 = $this->drupalCreateNode();
-
-    $entity->field_test->target_id = $node2->nid;
-    $this->assertEqual($entity->field_test->entity->id(), $node2->id());
-    $this->assertEqual($entity->field_test->entity->title, $node2->label());
+    $term = entity_load('taxonomy_term', $tid);
+    $this->assertEqual($term->name, $new_name);
+
+    // Make sure the computed term reflects updates to the term id.
+    $term2 = entity_create('taxonomy_term', array(
+      'name' => $this->randomName(),
+      'vid' => $this->term->vid,
+      'langcode' => LANGUAGE_NOT_SPECIFIED,
+    ));
+    $term2->save();
+
+    $entity->field_test_taxonomy->target_id = $term2->tid;
+    $this->assertEqual($entity->field_test_taxonomy->entity->id(), $term2->tid);
+    $this->assertEqual($entity->field_test_taxonomy->entity->name, $term2->name);
   }
 }
diff --git a/core/modules/field/field.crud.inc b/core/modules/field/field.crud.inc
index f6ee8a2..1f78f6f 100644
--- a/core/modules/field/field.crud.inc
+++ b/core/modules/field/field.crud.inc
@@ -542,7 +542,6 @@ function field_create_instance(&$instance) {
  * @see field_create_instance()
  */
 function field_update_instance($instance) {
-  // Check that the specified field exists.
   $field = field_read_field($instance['field_name']);
   if (empty($field)) {
     throw new FieldException(t('Attempt to update an instance of a nonexistent field @field.', array('@field' => $instance['field_name'])));
@@ -605,6 +604,7 @@ function _field_write_instance(&$instance, $update = FALSE) {
     'type' => $field_type['default_widget'],
     'settings' => array(),
   );
+
   // If no weight specified, make sure the field sinks at the bottom.
   if (!isset($instance['widget']['weight'])) {
     $max_weight = field_info_max_weight($instance['entity_type'], $instance['bundle'], 'form');
diff --git a/core/modules/field/field.install b/core/modules/field/field.install
index 695fd89..11f0ee8 100644
--- a/core/modules/field/field.install
+++ b/core/modules/field/field.install
@@ -170,9 +170,14 @@ function field_schema() {
 /**
  * Creates a field by writing directly to the database.
  *
+ * @param $field
+ *   The field definition array, passed by reference.
+ * @param $update
+ *   Optional; Indicate if we need to create a new field or update an existing one. Defaults to FALSE.
+ *
  * @ingroup update_api
  */
-function _update_7000_field_create_field(&$field) {
+function _update_7000_field_create_field(&$field, $update = FALSE) {
   // Merge in default values.`
   $field += array(
     'entity_types' => array(),
@@ -228,13 +233,34 @@ function _update_7000_field_create_field(&$field) {
     'translatable' => (int) $field['translatable'],
     'deleted' => (int) $field['deleted'],
   );
-  // We don't use drupal_write_record() here because it depends on the schema.
-  $field['id'] = db_insert('field_config')
-    ->fields($record)
-    ->execute();
 
-  // Create storage for the field.
-  field_sql_storage_field_storage_create_field($field);
+  if ($update) {
+    db_update('field_config')
+      ->condition('id', $field['id'])
+      ->fields($record)
+      ->execute();
+  }
+  else {
+    // We don't use drupal_write_record() here because it depends on the schema.
+    $field['id'] = db_insert('field_config')
+      ->fields($record)
+      ->execute();
+
+    // Create storage for the field.
+    field_sql_storage_field_storage_create_field($field);
+  }
+}
+
+/**
+ * Updates a field by writing directly to the database.
+ *
+ * @param $field
+ *   The field definition array.
+ *
+ * @ingroup update_api
+ */
+function _update_7000_field_update_field($field) {
+  _update_7000_field_create_field($field, TRUE);
 }
 
 /**
@@ -347,9 +373,16 @@ function _update_7000_field_read_fields(array $conditions = array(), $key = 'id'
 /**
  * Writes a field instance directly to the database.
  *
+ * @param $field
+ *   The field definition array.
+ * @param $instance
+ *   The instance definition array, passed by reference.
+ * @param $update
+ *   Optional; Indicate if we need to create a new instance or update an existing one. Defaults to FALSE.
+ *
  * @ingroup update_api
  */
-function _update_7000_field_create_instance($field, &$instance) {
+function _update_7000_field_create_instance($field, &$instance, $update = FALSE) {
   // Merge in defaults.
   $instance += array(
     'field_id' => $field['id'],
@@ -371,9 +404,33 @@ function _update_7000_field_create_instance($field, &$instance) {
     'data' => serialize($data),
     'deleted' => (int) $instance['deleted'],
   );
-  $instance['id'] = db_insert('field_config_instance')
-    ->fields($record)
-    ->execute();
+
+  if ($update) {
+    db_update('field_config_instance')
+      ->condition('id', $instance['id'])
+      ->fields($record)
+      ->execute();
+  }
+  else {
+    $instance['id'] = db_insert('field_config_instance')
+      ->fields($record)
+      ->execute();
+
+  }
+}
+
+/**
+ * Updates a field instance directly to the database.
+ *
+ * @param $field
+ *   The field definition array.
+ * @param $instance
+ *   The instance definition array, passed by reference.
+ *
+ * @ingroup update_api
+ */
+function _update_7000_field_update_instance($field, &$instance) {
+  _update_7000_field_create_instance($field, $instance, TRUE);
 }
 
 /**
@@ -487,4 +544,3 @@ function field_update_8002() {
  * @} End of "addtogroup updates-7.x-to-8.x".
  * The next series of updates should start at 9000.
  */
-
diff --git a/core/modules/field_sql_storage/lib/Drupal/field_sql_storage/Entity/Tables.php b/core/modules/field_sql_storage/lib/Drupal/field_sql_storage/Entity/Tables.php
index 09c8fda..b5d092e 100644
--- a/core/modules/field_sql_storage/lib/Drupal/field_sql_storage/Entity/Tables.php
+++ b/core/modules/field_sql_storage/lib/Drupal/field_sql_storage/Entity/Tables.php
@@ -9,6 +9,7 @@
 
 use Drupal\Core\Database\Query\SelectInterface;
 use Drupal\Core\Entity\Query\QueryException;
+use Drupal\Core\Entity\EntityNG;
 
 /**
  * Adds tables and fields to the SQL entity query.
diff --git a/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageFieldsTest.php b/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageFieldsTest.php
index cbc132f..a4d69fa 100644
--- a/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageFieldsTest.php
+++ b/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageFieldsTest.php
@@ -41,7 +41,10 @@ function setUp() {
 
     $field = array(
       'field_name' => 'field_' . $vocabulary->id(),
-      'type' => 'taxonomy_term_reference',
+      'type' => 'entity_reference',
+      'settings' => array(
+        'target_type' => 'taxonomy_term',
+      ),
     );
     field_create_field($field);
 
@@ -397,7 +400,7 @@ function testDuplicateFieldName() {
     $edit = array(
       'fields[_add_new_field][field_name]' => 'tags',
       'fields[_add_new_field][label]' => $this->randomName(),
-      'fields[_add_new_field][type]' => 'taxonomy_term_reference',
+      'fields[_add_new_field][type]' => 'entity_reference',
       'fields[_add_new_field][widget_type]' => 'options_select',
     );
     $url = 'admin/structure/types/manage/' . $this->type . '/fields';
@@ -414,15 +417,15 @@ function testWidgetChange() {
     $url_fields = 'admin/structure/types/manage/article/fields';
     $url_tags_widget = $url_fields . '/field_tags/widget-type';
 
-    // Check that the field_tags field currently uses the 'options_select'
+    // Check that the field_tags field currently uses the 'entity_reference_autocomplete'
     // widget.
     $instance = field_info_instance('node', 'field_tags', 'article');
-    $this->assertEqual($instance['widget']['type'], 'options_select');
+    $this->assertEqual($instance['widget']['type'], 'entity_reference_autocomplete');
 
     // Check that the "Manage fields" page shows the correct widget type.
     $this->drupalGet($url_fields);
     $link = current($this->xpath('//a[contains(@href, :href)]', array(':href' => $url_tags_widget)));
-    $this->assertEqual((string) $link, 'Select list');
+    $this->assertEqual((string) $link, 'Autocomplete');
 
     // Go to the 'Widget type' form and check that the correct widget is
     // selected.
diff --git a/core/modules/forum/forum.install b/core/modules/forum/forum.install
index b1e63de..02836ff 100644
--- a/core/modules/forum/forum.install
+++ b/core/modules/forum/forum.install
@@ -58,14 +58,9 @@ function forum_enable() {
   if (!field_info_field('taxonomy_forums')) {
     $field = array(
       'field_name' => 'taxonomy_forums',
-      'type' => 'taxonomy_term_reference',
+      'type' => 'entity_reference',
       'settings' => array(
-        'allowed_values' => array(
-          array(
-            'vocabulary' => $vocabulary->id(),
-            'parent' => 0,
-          ),
-        ),
+        'target_type' => 'taxonomy_term',
       ),
     );
     field_create_field($field);
@@ -90,19 +85,28 @@ function forum_enable() {
       'widget' => array(
         'type' => 'options_select',
       ),
+      'settings' => array(
+        'handler' => 'default',
+        'handler_settings' => array(
+          'target_bundles' => array(
+            $vocabulary->id(),
+          ),
+          'auto_create' => TRUE,
+        ),
+      ),
     );
     field_create_instance($instance);
 
     // Assign display settings for the 'default' and 'teaser' view modes.
     entity_get_display('node', 'forum', 'default')
       ->setComponent('taxonomy_forums', array(
-        'type' => 'taxonomy_term_reference_link',
+        'type' => 'entity_reference_label',
         'weight' => 10,
       ))
       ->save();
     entity_get_display('node', 'forum', 'teaser')
       ->setComponent('taxonomy_forums', array(
-        'type' => 'taxonomy_term_reference_link',
+        'type' => 'entity_reference_label',
         'weight' => 10,
       ))
       ->save();
diff --git a/core/modules/forum/forum.module b/core/modules/forum/forum.module
index 872eb95..7995695 100644
--- a/core/modules/forum/forum.module
+++ b/core/modules/forum/forum.module
@@ -293,11 +293,11 @@ function forum_node_validate(Node $node, $form) {
       foreach ($node->taxonomy_forums[$langcode] as $delta => $item) {
         // If no term was selected (e.g. when no terms exist yet), remove the
         // item.
-        if (empty($item['tid'])) {
+        if (empty($item['target_id'])) {
           unset($node->taxonomy_forums[$langcode][$delta]);
           continue;
         }
-        $term = taxonomy_term_load($item['tid']);
+        $term = taxonomy_term_load($item['target_id']);
         if (!$term) {
           form_set_error('taxonomy_forums', t('Select a forum.'));
           continue;
@@ -326,11 +326,11 @@ function forum_node_presave(Node $node) {
     reset($node->taxonomy_forums);
     $langcode = key($node->taxonomy_forums);
     if (!empty($node->taxonomy_forums[$langcode])) {
-      $node->forum_tid = $node->taxonomy_forums[$langcode][0]['tid'];
+      $node->forum_tid = $node->taxonomy_forums[$langcode][0]['target_id'];
       $old_tid = db_query_range("SELECT f.tid FROM {forum} f INNER JOIN {node} n ON f.vid = n.vid WHERE n.nid = :nid ORDER BY f.vid DESC", 0, 1, array(':nid' => $node->nid))->fetchField();
       if ($old_tid && isset($node->forum_tid) && ($node->forum_tid != $old_tid) && !empty($node->shadow)) {
         // A shadow copy needs to be created. Retain new term and add old term.
-        $node->taxonomy_forums[$langcode][] = array('tid' => $old_tid);
+        $node->taxonomy_forums[$langcode][] = array('target_id' => $old_tid);
       }
     }
   }
@@ -528,7 +528,7 @@ function forum_field_storage_pre_insert(EntityInterface $entity, &$skip_fields)
         $query->values(array(
           'nid' => $entity->nid,
           'title' => $entity->title,
-          'tid' => $item['tid'],
+          'tid' => $item['target_id'],
           'sticky' => $entity->sticky,
           'created' => $entity->created,
           'comment_count' => 0,
@@ -564,7 +564,7 @@ function forum_field_storage_pre_update(EntityInterface $entity, &$skip_fields)
           $query->values(array(
             'nid' => $entity->nid,
             'title' => $entity->title,
-            'tid' => $item['tid'],
+            'tid' => $item['target_id'],
             'sticky' => $entity->sticky,
             'created' => $entity->created,
             'comment_count' => 0,
diff --git a/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php b/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php
index 5070396..87c91bb 100644
--- a/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php
+++ b/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php
@@ -2,7 +2,7 @@
 
 /**
  * @file
- * Tests for forum.module.
+ * Contains Drupal\forum\Tests\ForumTest
  */
 
 namespace Drupal\forum\Tests;
@@ -525,7 +525,7 @@ function createForumTopic($forum, $container = FALSE) {
     // Retrieve node object, ensure that the topic was created and in the proper forum.
     $node = $this->drupalGetNodeByTitle($title);
     $this->assertTrue($node != NULL, format_string('Node @title was loaded', array('@title' => $title)));
-    $this->assertEqual($node->taxonomy_forums[LANGUAGE_NOT_SPECIFIED][0]['tid'], $tid, 'Saved forum topic was in the expected forum');
+    $this->assertEqual($node->taxonomy_forums[LANGUAGE_NOT_SPECIFIED][0]['target_id'], $tid, 'Saved forum topic was in the expected forum');
 
     // View forum topic.
     $this->drupalGet('node/' . $node->nid);
diff --git a/core/modules/jsonld/lib/Drupal/jsonld/Tests/JsonldTestSetupHelper.php b/core/modules/jsonld/lib/Drupal/jsonld/Tests/JsonldTestSetupHelper.php
index d0eb0c3..1b5c080 100644
--- a/core/modules/jsonld/lib/Drupal/jsonld/Tests/JsonldTestSetupHelper.php
+++ b/core/modules/jsonld/lib/Drupal/jsonld/Tests/JsonldTestSetupHelper.php
@@ -56,7 +56,7 @@ public function __construct() {
     $this->rdfMappingManager = new RdfMappingManager($dispatcher, $this->siteSchemaManager);
     // Construct normalizers.
     $this->normalizers = array(
-      'entityreference' => new JsonldEntityReferenceNormalizer($this->siteSchemaManager, $this->rdfMappingManager),
+      'entity_reference' => new JsonldEntityReferenceNormalizer($this->siteSchemaManager, $this->rdfMappingManager),
       'field_item' => new JsonldFieldItemNormalizer($this->siteSchemaManager, $this->rdfMappingManager),
       'entity' => new JsonldEntityNormalizer($this->siteSchemaManager, $this->rdfMappingManager),
     );
diff --git a/core/modules/jsonld/lib/Drupal/jsonld/Tests/SupportsSerializationTest.php b/core/modules/jsonld/lib/Drupal/jsonld/Tests/SupportsSerializationTest.php
index 38cee8a..b4f498e 100644
--- a/core/modules/jsonld/lib/Drupal/jsonld/Tests/SupportsSerializationTest.php
+++ b/core/modules/jsonld/lib/Drupal/jsonld/Tests/SupportsSerializationTest.php
@@ -58,7 +58,7 @@ public function testSupportsNormalization() {
     $supportedEntity = entity_create('entity_test', array());
     $unsupportedEntity = new ConfigEntityTest();
     $field = $supportedEntity->get('uuid');
-    $entityreferenceField = $supportedEntity->get('user_id');
+    $entityReferenceField = $supportedEntity->get('user_id');
 
     // Supported entity.
     $this->assertTrue($this->normalizers['entity']->supportsNormalization($supportedEntity, static::$format), "Entity normalization is supported for $format on content entities.");
@@ -68,7 +68,7 @@ public function testSupportsNormalization() {
     // Field item.
     $this->assertTrue($this->normalizers['field_item']->supportsNormalization($field->offsetGet(0), static::$format), "Field item normalization is supported for $format.");
     // Entity reference field item.
-    $this->assertTrue($this->normalizers['entityreference']->supportsNormalization($entityreferenceField->offsetGet(0), static::$format), "Entity reference field item normalization is supported for $format.");
+    $this->assertTrue($this->normalizers['entity_reference']->supportsNormalization($entityReferenceField->offsetGet(0), static::$format), "Entity reference field item normalization is supported for $format.");
   }
 
   /**
@@ -80,7 +80,7 @@ public function testSupportsDenormalization() {
     $supportedEntityClass = 'Drupal\Core\Entity\EntityNG';
     $unsupportedEntityClass = 'Drupal\config\Tests\ConfigEntityTest';
     $fieldClass = 'Drupal\Core\Entity\Field\Type\StringItem';
-    $entityreferenceFieldClass = 'Drupal\Core\Entity\Field\Type\EntityReferenceItem';
+    $entityReferenceFieldClass = 'Drupal\Core\Entity\Field\Type\EntityReferenceItem';
 
     // Supported entity.
     $this->assertTrue($this->normalizers['entity']->supportsDenormalization($data, $supportedEntityClass, static::$format), "Entity denormalization is supported for $format on content entities.");
@@ -90,7 +90,7 @@ public function testSupportsDenormalization() {
     // Field item.
     $this->assertTrue($this->normalizers['field_item']->supportsDenormalization($data, $fieldClass, static::$format), "Field item denormalization is supported for $format.");
     // Entity reference field item.
-    $this->assertTrue($this->normalizers['entityreference']->supportsDenormalization($data, $entityreferenceFieldClass, static::$format), "Entity reference field item denormalization is supported for $format.");
+    $this->assertTrue($this->normalizers['entity_reference']->supportsDenormalization($data, $entityReferenceFieldClass, static::$format), "Entity reference field item denormalization is supported for $format.");
   }
 
 }
diff --git a/core/modules/node/lib/Drupal/node/Plugin/views/wizard/Node.php b/core/modules/node/lib/Drupal/node/Plugin/views/wizard/Node.php
index a7f4f88..cc08f5b 100644
--- a/core/modules/node/lib/Drupal/node/Plugin/views/wizard/Node.php
+++ b/core/modules/node/lib/Drupal/node/Plugin/views/wizard/Node.php
@@ -280,12 +280,11 @@ protected function build_filters(&$form, &$form_state) {
       foreach (field_info_instances($this->entity_type, $bundle) as $instance) {
         // We define "tag-like" taxonomy fields as ones that use the
         // "Autocomplete term widget (tagging)" widget.
-        if ($instance['widget']['type'] == 'taxonomy_autocomplete') {
-          $tag_fields[] = $instance['field_name'];
+        if ($instance['widget']['type'] == 'entity_reference_autocomplete_tags') {
+          $tag_fields[$instance['field_name']] = $instance;
         }
       }
     }
-    $tag_fields = array_unique($tag_fields);
     if (!empty($tag_fields)) {
       // If there is more than one "tag-like" taxonomy field available to
       // the view, we can only make our filter apply to one of them (as
@@ -293,20 +292,22 @@ protected function build_filters(&$form, &$form_state) {
       // that is created by the Standard install profile in core and also
       // commonly used by contrib modules; thus, it is most likely to be
       // associated with the "main" free-tagging vocabulary on the site.
-      if (in_array('field_tags', $tag_fields)) {
+      if (array_key_exists('field_tags', $tag_fields)) {
         $tag_field_name = 'field_tags';
       }
       else {
-        $tag_field_name = reset($tag_fields);
+        $tag_field_name = key($tag_fields);
       }
+      $tag_field_instance = $tag_fields[$tag_field_name];
       // Add the autocomplete textfield to the wizard.
       $form['displays']['show']['tagged_with'] = array(
         '#type' => 'textfield',
         '#title' => t('tagged with'),
-        '#autocomplete_path' => 'taxonomy/autocomplete/' . $tag_field_name,
+        '#autocomplete_path' => 'entity_reference/autocomplete/tags' . $tag_field_name . '/' . $tag_field_instance['entity_type'] . '/' . $tag_field_instance['bundle'],
         '#size' => 30,
         '#maxlength' => 1024,
         '#field_name' => $tag_field_name,
+        '#field_instance' => $tag_field_instance,
         '#element_validate' => array('views_ui_taxonomy_autocomplete_validate'),
       );
     }
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeAccessBaseTableTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeAccessBaseTableTest.php
index 6b7d00d..ebb432d 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeAccessBaseTableTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeAccessBaseTableTest.php
@@ -77,11 +77,11 @@ function testNodeAccessBasic() {
         if ($is_private) {
           $edit['private'] = TRUE;
           $edit['body[und][0][value]'] = 'private node';
-          $edit['field_tags[und]'] = 'private';
+          $edit['field_tags[und][target_id]'] = 'private';
         }
         else {
           $edit['body[und][0][value]'] = 'public node';
-          $edit['field_tags[und]'] = 'public';
+          $edit['field_tags[und][target_id]'] = 'public';
         }
 
         $this->drupalPost('node/add/article', $edit, t('Save'));
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeAccessPagerTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeAccessPagerTest.php
index de24f45..b5b4505 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeAccessPagerTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeAccessPagerTest.php
@@ -87,7 +87,7 @@ public function testForumPager() {
         'type' => 'forum',
         'taxonomy_forums' => array(
           LANGUAGE_NOT_SPECIFIED => array(
-            array('tid' => $tid, 'vid' => $vid),
+            array('target_id' => $tid, 'vid' => $vid),
           ),
         ),
       ));
diff --git a/core/modules/rdf/lib/Drupal/rdf/Tests/RdfaMarkupTest.php b/core/modules/rdf/lib/Drupal/rdf/Tests/RdfaMarkupTest.php
index 6f99dae..f7dc955 100644
--- a/core/modules/rdf/lib/Drupal/rdf/Tests/RdfaMarkupTest.php
+++ b/core/modules/rdf/lib/Drupal/rdf/Tests/RdfaMarkupTest.php
@@ -157,7 +157,7 @@ function testAttributesInMarkupFile() {
     $tag1 = $this->randomName(8);
     $tag2 = $this->randomName(8);
     $edit = array();
-    $edit['field_tags[' . LANGUAGE_NOT_SPECIFIED . ']'] = "$tag1, $tag2";
+    $edit['field_tags[' . LANGUAGE_NOT_SPECIFIED . '][target_id]'] = "$tag1, $tag2";
     $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
     $term_1_id = key(taxonomy_term_load_multiple_by_name($tag1));
     $taxonomy_term_1_uri = url('taxonomy/term/' . $term_1_id, array('absolute' => TRUE));
diff --git a/core/modules/rdf/rdf.module b/core/modules/rdf/rdf.module
index 255fc97..d1cd377 100644
--- a/core/modules/rdf/rdf.module
+++ b/core/modules/rdf/rdf.module
@@ -781,22 +781,38 @@ function rdf_field_attach_view_alter(&$output, $context) {
   // Append term mappings on displayed taxonomy links.
   foreach (element_children($output) as $field_name) {
     $element = &$output[$field_name];
-    if ($element['#field_type'] == 'taxonomy_term_reference' && $element['#formatter'] == 'taxonomy_term_reference_link') {
-      foreach ($element['#items'] as $delta => $item) {
-        // This function is invoked during entity preview when taxonomy term
-        // reference items might contain free-tagging terms that do not exist
-        // yet and thus have no $item['taxonomy_term'].
-        if (isset($item['taxonomy_term'])) {
-          $term = $item['taxonomy_term'];
-          if (!empty($term->rdf_mapping['rdftype'])) {
-            $element[$delta]['#options']['attributes']['typeof'] = $term->rdf_mapping['rdftype'];
-          }
-          if (!empty($term->rdf_mapping['name']['predicates'])) {
-            // A property attribute is used with an empty datatype attribute so
-            // the term name is parsed as a plain literal in RDFa 1.0 and 1.1.
-            $element[$delta]['#options']['attributes']['property'] = $term->rdf_mapping['name']['predicates'];
-            $element[$delta]['#options']['attributes']['datatype'] = '';
-          }
+    $field_name = $element['#field_name'];
+    $field = field_info_field($field_name);
+    if ($field['type'] != 'entity_reference' || $field['settings']['target_type'] != 'taxonomy_term') {
+      // Not an entity reference field referencing taxonomy terms.
+      continue;
+    }
+
+    // @todo: We should pass the view-mode, however we get view-mode as "full" which doesn't
+    // exist.
+    $display = entity_get_display($element['#entity_type'], $element['#bundle'], $element['#view_mode'] != 'full' ? $element['#view_mode'] : 'default');
+    $options = $display->getComponent($field_name);
+
+    if ($options['type'] != 'entity_reference_label' || empty($options['settings']['link'])) {
+      // Formatter is not a label with link.
+      continue;
+    }
+
+
+    foreach ($element['#items'] as $delta => $item) {
+      // This function is invoked during entity preview when taxonomy term
+      // reference items might contain free-tagging terms that do not exist
+      // yet and thus have no $item['entity'].
+      if (isset($item['entity'])) {
+        $term = $item['entity'];
+        if (!empty($term->rdf_mapping['rdftype'])) {
+          $element[$delta]['#options']['attributes']['typeof'] = $term->rdf_mapping['rdftype'];
+        }
+        if (!empty($term->rdf_mapping['name']['predicates'])) {
+          // A property attribute is used with an empty datatype attribute so
+          // the term name is parsed as a plain literal in RDFa 1.0 and 1.1.
+          $element[$delta]['#options']['attributes']['property'] = $term->rdf_mapping['name']['predicates'];
+          $element[$delta]['#options']['attributes']['datatype'] = '';
         }
       }
     }
diff --git a/core/modules/rest/lib/Drupal/rest/Tests/ReadTest.php b/core/modules/rest/lib/Drupal/rest/Tests/ReadTest.php
index 0578fc3..0c1619b 100644
--- a/core/modules/rest/lib/Drupal/rest/Tests/ReadTest.php
+++ b/core/modules/rest/lib/Drupal/rest/Tests/ReadTest.php
@@ -2,7 +2,7 @@
 
 /**
  * @file
- * Definition of Drupal\rest\test\ReadTest.
+ * Contains Drupal\rest\Tests\ReadTest.
  */
 
 namespace Drupal\rest\Tests;
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryRelationshipTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryRelationshipTest.php
index 8d5fa81..1151def 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryRelationshipTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryRelationshipTest.php
@@ -2,7 +2,7 @@
 
 /**
  * @file
- * Definition of Drupal\Core\Entity\Tests\EntityQueryRelationshipTest.
+ * Contains Drupal\system\Tests\Entity\EntityQueryRelationshipTest.
  */
 
 namespace Drupal\system\Tests\Entity;
@@ -81,16 +81,29 @@ protected function setUp() {
     $this->fieldName = strtolower($this->randomName());
     $field = array(
       'field_name' => $this->fieldName,
-      'type' => 'taxonomy_term_reference',
+      'type' => 'entity_reference',
+      'settings' => array(
+        'target_type' => 'taxonomy_term',
+      ),
     );
-    $field['settings']['allowed_values']['vocabulary'] = $vocabulary->id();
+
     field_create_field($field);
     // Third, create the instance.
     $instance = array(
       'entity_type' => 'entity_test',
       'field_name' => $this->fieldName,
       'bundle' => 'entity_test',
+      'settings' => array(
+        'handler' => 'default',
+        'handler_settings' => array(
+          'target_bundles' => array(
+            $vocabulary->id(),
+          ),
+          'auto_create' => TRUE,
+        ),
+      ),
     );
+
     field_create_instance($instance);
     // Create two terms and also two accounts.
     for ($i = 0; $i <= 1; $i++) {
@@ -110,7 +123,7 @@ protected function setUp() {
       $entity->name->value = $this->randomName();
       $index = $i ? 1 : 0;
       $entity->user_id->target_id = $this->accounts[$index]->uid;
-      $entity->{$this->fieldName}->tid = $this->terms[$index]->tid;
+      $entity->{$this->fieldName}->target_id = $this->terms[$index]->tid;
       $entity->save();
       $this->entities[] = $entity;
     }
@@ -152,7 +165,7 @@ public function testQuery() {
     // This returns the 0th entity as that's only one pointing to the 0th
     // term (test with specifying the column name).
     $this->queryResults = $this->factory->get('entity_test')
-      ->condition("$this->fieldName.tid.entity.name", $this->terms[0]->name)
+      ->condition("$this->fieldName.target_id.entity.name", $this->terms[0]->name)
       ->execute();
     $this->assertResults(array(0));
     // This returns the 1st and 2nd entity as those point to the 1st term.
diff --git a/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php b/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php
index 147bc4c..75837e6 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php
@@ -306,7 +306,7 @@ function testBreadCrumbs() {
       'Breadcrumbs' => array(),
     );
     $edit = array(
-      "field_tags[$langcode]" => implode(',', array_keys($tags)),
+      "field_tags[$langcode][target_id]" => implode(',', array_keys($tags)),
     );
     $this->drupalPost("node/{$parent->nid}/edit", $edit, t('Save and keep published'));
 
diff --git a/core/modules/system/lib/Drupal/system/Tests/Module/DependencyTest.php b/core/modules/system/lib/Drupal/system/Tests/Module/DependencyTest.php
index 1c5527b..243cde7 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Module/DependencyTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Module/DependencyTest.php
@@ -138,7 +138,7 @@ function testModuleEnableOrder() {
     // - taxonomy depends on options
     // - ban depends on php (via module_test)
     // The correct enable order is:
-    $expected_order = array('php', 'ban', 'comment', 'history', 'options', 'taxonomy', 'forum');
+    $expected_order = array('php', 'ban', 'comment', 'entity_reference', 'history', 'options', 'taxonomy', 'forum');
 
     // Enable the modules through the UI, verifying that the dependency chain
     // is correct.
@@ -146,8 +146,9 @@ function testModuleEnableOrder() {
     $edit['modules[Core][forum][enable]'] = 'forum';
     $this->drupalPost('admin/modules', $edit, t('Save configuration'));
     $this->assertModules(array('forum'), FALSE);
-    $this->assertText(t('You must enable the History, Taxonomy, Options, Comment, Ban, PHP Filter modules to install Forum.'));
+    $this->assertText(t('You must enable the History, Taxonomy, Entity Reference, Options, Comment, Ban, PHP Filter modules to install Forum.'));
     $edit['modules[Core][history][enable]'] = 'history';
+    $edit['modules[Core][entity_reference][enable]'] = 'entity_reference';
     $edit['modules[Core][options][enable]'] = 'options';
     $edit['modules[Core][taxonomy][enable]'] = 'taxonomy';
     $edit['modules[Core][comment][enable]'] = 'comment';
diff --git a/core/modules/system/lib/Drupal/system/Tests/Theme/EntityFilteringThemeTest.php b/core/modules/system/lib/Drupal/system/Tests/Theme/EntityFilteringThemeTest.php
index 27f3e6a..5ba606b 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Theme/EntityFilteringThemeTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Theme/EntityFilteringThemeTest.php
@@ -102,7 +102,7 @@ function setUp() {
       'title' => $this->xss_label,
       'type' => 'article',
       'promote' => NODE_PROMOTED,
-      'field_tags' => array(LANGUAGE_NOT_SPECIFIED => array(array('tid' => $this->term->tid))),
+      'field_tags' => array(LANGUAGE_NOT_SPECIFIED => array(array('target_id' => $this->term->tid))),
     ));
 
     // Create a test comment on the test node.
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/field/widget/TaxonomyAutocompleteWidget.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/field/widget/TaxonomyAutocompleteWidget.php
deleted file mode 100644
index 0d5dfd4..0000000
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/field/widget/TaxonomyAutocompleteWidget.php
+++ /dev/null
@@ -1,107 +0,0 @@
-<?php
-
-/**
- * @file
- * Definition of Drupal\taxonomy\Plugin\field\widget\TaxonomyAutocompleteWidget.
- */
-
-namespace Drupal\taxonomy\Plugin\field\widget;
-
-use Drupal\Core\Annotation\Plugin;
-use Drupal\Core\Annotation\Translation;
-use Drupal\field\Plugin\Type\Widget\WidgetBase;
-
-/**
- * Plugin implementation of the 'taxonomy_autocomplete' widget.
- *
- * @Plugin(
- *   id = "taxonomy_autocomplete",
- *   module = "taxonomy",
- *   label = @Translation("Autocomplete term widget (tagging)"),
- *   field_types = {
- *     "taxonomy_term_reference"
- *   },
- *   settings = {
- *     "size" = "60",
- *     "autocomplete_path" = "taxonomy/autocomplete",
- *     "placeholder" = ""
- *   },
- *   multiple_values = TRUE
- * )
- */
-class TaxonomyAutocompleteWidget extends WidgetBase {
-
-  /**
-   * Implements Drupal\field\Plugin\Type\Widget\WidgetInterface::settingsForm().
-   */
-  public function settingsForm(array $form, array &$form_state) {
-    $element['placeholder'] = array(
-      '#type' => 'textfield',
-      '#title' => t('Placeholder'),
-      '#default_value' => $this->getSetting('placeholder'),
-      '#description' => t('The placeholder is a short hint (a word or short phrase) intended to aid the user with data entry. A hint could be a sample value or a brief description of the expected format.'),
-    );
-    return $element;
-  }
-
-  /**
-   * Implements Drupal\field\Plugin\Type\Widget\WidgetInterface::formElement().
-   */
-  public function formElement(array $items, $delta, array $element, $langcode, array &$form, array &$form_state) {
-    $field = $this->field;
-
-    $tags = array();
-    foreach ($items as $item) {
-      $tags[$item['tid']] = isset($item['taxonomy_term']) ? $item['taxonomy_term'] : taxonomy_term_load($item['tid']);
-    }
-    $element += array(
-      '#type' => 'textfield',
-      '#default_value' => taxonomy_implode_tags($tags),
-      '#autocomplete_path' => $this->getSetting('autocomplete_path') . '/' . $field['field_name'],
-      '#size' => $this->getSetting('size'),
-      '#placeholder' => $this->getSetting('placeholder'),
-      '#maxlength' => 1024,
-      '#element_validate' => array('taxonomy_autocomplete_validate'),
-    );
-
-    return $element;
-  }
-
-  /**
-   * Implements Drupal\field\Plugin\Type\Widget\WidgetInterface::massageFormValues()
-   */
-  public function massageFormValues(array $values, array $form, array &$form_state) {
-    // Autocomplete widgets do not send their tids in the form, so we must detect
-    // them here and process them independently.
-    $terms = array();
-    $field = $this->field;
-
-    // Collect candidate vocabularies.
-    foreach ($field['settings']['allowed_values'] as $tree) {
-      if ($vocabulary = entity_load('taxonomy_vocabulary', $tree['vocabulary'])) {
-        $vocabularies[$vocabulary->id()] = $vocabulary;
-      }
-    }
-
-    // Translate term names into actual terms.
-    foreach($values as $value) {
-      // See if the term exists in the chosen vocabulary and return the tid;
-      // otherwise, create a new 'autocreate' term for insert/update.
-      if ($possibilities = entity_load_multiple_by_properties('taxonomy_term', array('name' => trim($value), 'vid' => array_keys($vocabularies)))) {
-        $term = array_pop($possibilities);
-      }
-      else {
-        $vocabulary = reset($vocabularies);
-        $term = array(
-          'tid' => 'autocreate',
-          'vid' => $vocabulary->id(),
-          'name' => $value,
-        );
-      }
-      $terms[] = (array)$term;
-    }
-
-    return $terms;
-  }
-
-}
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument_default/Tid.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument_default/Tid.php
index de848da..532292a 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument_default/Tid.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument_default/Tid.php
@@ -138,7 +138,7 @@ function get_argument() {
         $fields = field_info_instances('node', $node->type);
         foreach ($fields as $name => $info) {
           $field_info = field_info_field($name);
-          if ($field_info['type'] == 'taxonomy_term_reference') {
+          if ($field_info['type'] == 'entity_reference') {
             $items = field_get_items($node, $name);
             if (is_array($items)) {
               foreach ($items as $item) {
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/LegacyTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/LegacyTest.php
index b9898c6..1c0cf8a 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/LegacyTest.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/LegacyTest.php
@@ -38,7 +38,7 @@ function testTaxonomyLegacyNode() {
     $edit['title'] = $this->randomName();
     $edit['date'] = '1969-01-01 00:00:00 -0500';
     $edit["body[$langcode][0][value]"] = $this->randomName();
-    $edit["field_tags[$langcode]"] = $this->randomName();
+    $edit["field_tags[$langcode][target_id]"] = $this->randomName();
     $this->drupalPost('node/add/article', $edit, t('Save and publish'));
     // Checks that the node has been saved.
     $node = $this->drupalGetNodeByTitle($edit['title']);
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/RssTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/RssTest.php
index 3d28ec0..3eb3dd4 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/RssTest.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/RssTest.php
@@ -36,15 +36,10 @@ function setUp() {
 
     $field = array(
       'field_name' => 'taxonomy_' . $this->vocabulary->id(),
-      'type' => 'taxonomy_term_reference',
+      'type' => 'entity_reference',
       'cardinality' => FIELD_CARDINALITY_UNLIMITED,
       'settings' => array(
-        'allowed_values' => array(
-          array(
-            'vocabulary' => $this->vocabulary->id(),
-            'parent' => 0,
-          ),
-        ),
+        'target_type' => 'taxonomy_term',
       ),
     );
     field_create_field($field);
@@ -56,11 +51,20 @@ function setUp() {
       'widget' => array(
         'type' => 'options_select',
       ),
+      'settings' => array(
+        'handler' => 'default',
+        'handler_settings' => array(
+          'target_bundles' => array(
+            $this->vocabulary->id(),
+          ),
+          'auto_create' => TRUE,
+        ),
+      ),
     );
     field_create_instance($this->instance);
     entity_get_display('node', 'article', 'default')
       ->setComponent('taxonomy_' . $this->vocabulary->id(), array(
-        'type' => 'taxonomy_term_reference_link',
+        'type' => 'entity_reference_label',
       ))
       ->save();
   }
@@ -84,7 +88,7 @@ function testTaxonomyRss() {
     // Change the format to 'RSS category'.
     $this->drupalGet("admin/structure/types/manage/article/display/rss");
     $edit = array(
-      "fields[taxonomy_" . $this->vocabulary->id() . "][type]" => 'taxonomy_term_reference_rss_category',
+      "fields[taxonomy_" . $this->vocabulary->id() . "][type]" => 'entity_reference_rss_category',
     );
     $this->drupalPost(NULL, $edit, t('Save'));
 
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyTermReferenceItemTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyTermReferenceItemTest.php
deleted file mode 100644
index f4b0ec8..0000000
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyTermReferenceItemTest.php
+++ /dev/null
@@ -1,116 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\taxonomy\Tests\TaxonomyTermReferenceItemTest.
- */
-
-namespace Drupal\taxonomy\Tests;
-
-use Drupal\Core\Entity\Field\FieldInterface;
-use Drupal\Core\Entity\Field\FieldItemInterface;
-use Drupal\field\Tests\FieldItemUnitTestBase;
-
-/**
- * Tests the new entity API for the taxonomy term reference field type.
- */
-class TaxonomyTermReferenceItemTest extends FieldItemUnitTestBase {
-
-  /**
-   * Modules to enable.
-   *
-   * @var array
-   */
-  public static $modules = array('taxonomy', 'options');
-
-  public static function getInfo() {
-    return array(
-      'name' => 'Taxonomy reference field item',
-      'description' => 'Tests using entity fields of the taxonomy term reference field type.',
-      'group' => 'Taxonomy',
-    );
-  }
-
-  public function setUp() {
-    parent::setUp();
-    $this->installSchema('taxonomy', 'taxonomy_term_data');
-    $this->installSchema('taxonomy', 'taxonomy_term_hierarchy');
-
-    $vocabulary = entity_create('taxonomy_vocabulary', array(
-      'name' => $this->randomName(),
-      'vid' => drupal_strtolower($this->randomName()),
-      'langcode' => LANGUAGE_NOT_SPECIFIED,
-    ));
-    $vocabulary->save();
-    $field = array(
-      'field_name' => 'field_test_taxonomy',
-      'type' => 'taxonomy_term_reference',
-      'cardinality' => FIELD_CARDINALITY_UNLIMITED,
-      'settings' => array(
-        'allowed_values' => array(
-          array(
-            'vocabulary' => $vocabulary->id(),
-            'parent' => 0,
-          ),
-        ),
-      ),
-    );
-    field_create_field($field);
-    $instance = array(
-      'entity_type' => 'entity_test',
-      'field_name' => 'field_test_taxonomy',
-      'bundle' => 'entity_test',
-      'widget' => array(
-        'type' => 'options_select',
-      ),
-    );
-    field_create_instance($instance);
-    $this->term = entity_create('taxonomy_term', array(
-      'name' => $this->randomName(),
-      'vid' => $vocabulary->id(),
-      'langcode' => LANGUAGE_NOT_SPECIFIED,
-    ));
-    $this->term->save();
-  }
-
-  /**
-   * Tests using entity fields of the taxonomy term reference field type.
-   */
-  public function testTaxonomyTermReferenceItem() {
-    $tid = $this->term->id();
-    // Just being able to create the entity like this verifies a lot of code.
-    $entity = entity_create('entity_test', array());
-    $entity->field_test_taxonomy->tid = $this->term->tid;
-    $entity->name->value = $this->randomName();
-    $entity->save();
-
-    $entity = entity_load('entity_test', $entity->id());
-    $this->assertTrue($entity->field_test_taxonomy instanceof FieldInterface, 'Field implements interface.');
-    $this->assertTrue($entity->field_test_taxonomy[0] instanceof FieldItemInterface, 'Field item implements interface.');
-    $this->assertEqual($entity->field_test_taxonomy->tid, $this->term->tid);
-    $this->assertEqual($entity->field_test_taxonomy->entity->name, $this->term->name);
-    $this->assertEqual($entity->field_test_taxonomy->entity->id(), $tid);
-    $this->assertEqual($entity->field_test_taxonomy->entity->uuid(), $this->term->uuid());
-
-    // Change the name of the term via the reference.
-    $new_name = $this->randomName();
-    $entity->field_test_taxonomy->entity->name = $new_name;
-    $entity->field_test_taxonomy->entity->save();
-    // Verify it is the correct name.
-    $term = entity_load('taxonomy_term', $tid);
-    $this->assertEqual($term->name, $new_name);
-
-    // Make sure the computed term reflects updates to the term id.
-    $term2 = entity_create('taxonomy_term', array(
-      'name' => $this->randomName(),
-      'vid' => $this->term->vid,
-      'langcode' => LANGUAGE_NOT_SPECIFIED,
-    ));
-    $term2->save();
-
-    $entity->field_test_taxonomy->tid = $term2->tid;
-    $this->assertEqual($entity->field_test_taxonomy->entity->id(), $term2->tid);
-    $this->assertEqual($entity->field_test_taxonomy->entity->name, $term2->name);
-  }
-
-}
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldMultipleVocabularyTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldMultipleVocabularyTest.php
index 8c5571c..a8f7d20 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldMultipleVocabularyTest.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldMultipleVocabularyTest.php
@@ -43,20 +43,11 @@ function setUp() {
     $this->field_name = drupal_strtolower($this->randomName());
     $this->field = array(
       'field_name' => $this->field_name,
-      'type' => 'taxonomy_term_reference',
+      'type' => 'entity_reference',
       'cardinality' => FIELD_CARDINALITY_UNLIMITED,
       'settings' => array(
-        'allowed_values' => array(
-          array(
-            'vocabulary' => $this->vocabulary1->id(),
-            'parent' => '0',
-          ),
-          array(
-            'vocabulary' => $this->vocabulary2->id(),
-            'parent' => '0',
-          ),
-        ),
-      )
+        'target_type' => 'taxonomy_term',
+      ),
     );
     field_create_field($this->field);
     $this->instance = array(
@@ -66,11 +57,21 @@ function setUp() {
       'widget' => array(
         'type' => 'options_select',
       ),
+      'settings' => array(
+        'handler' => 'default',
+        'handler_settings' => array(
+          'target_bundles' => array(
+            $this->vocabulary1->id(),
+            $this->vocabulary2->id(),
+          ),
+          'auto_create' => TRUE,
+        ),
+      ),
     );
     field_create_instance($this->instance);
     entity_get_display('test_entity', 'test_bundle', 'full')
       ->setComponent($this->field_name, array(
-        'type' => 'taxonomy_term_reference_link',
+        'type' => 'entity_reference_label',
       ))
       ->save();
   }
@@ -121,10 +122,6 @@ function testTaxonomyTermFieldMultipleVocabularies() {
     $this->assertText($term1->name, 'Term 1 name is displayed.');
     $this->assertNoText($term2->name, 'Term 2 name is not displayed.');
 
-    // Verify that field and instance settings are correct.
-    $field_info = field_info_field($this->field_name);
-    $this->assertEqual(count($field_info['settings']['allowed_values']), 1, 'Only one vocabulary is allowed for the field.');
-
     // The widget should still be displayed.
     $this->drupalGet('test-entity/add/test_bundle');
     $this->assertFieldByName("{$this->field_name}[$langcode][]", '', 'Widget is still displayed');
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldTest.php
deleted file mode 100644
index d5de5fa..0000000
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldTest.php
+++ /dev/null
@@ -1,171 +0,0 @@
-<?php
-
-/**
- * @file
- * Definition of Drupal\taxonomy\Tests\TermFieldTest.
- */
-
-namespace Drupal\taxonomy\Tests;
-
-use Drupal\field\FieldValidationException;
-
-/**
- * Tests for taxonomy term field and formatter.
- */
-class TermFieldTest extends TaxonomyTestBase {
-
-  /**
-   * Modules to enable.
-   *
-   * @var array
-   */
-  public static $modules = array('field_test');
-
-  protected $instance;
-  protected $vocabulary;
-
-  public static function getInfo() {
-    return array(
-      'name' => 'Taxonomy term reference field',
-      'description' => 'Test the creation of term fields.',
-      'group' => 'Taxonomy',
-    );
-  }
-
-  function setUp() {
-    parent::setUp();
-
-    $web_user = $this->drupalCreateUser(array('access field_test content', 'administer field_test content', 'administer taxonomy'));
-    $this->drupalLogin($web_user);
-    $this->vocabulary = $this->createVocabulary();
-
-    // Setup a field and instance.
-    $this->field_name = drupal_strtolower($this->randomName());
-    $this->field = array(
-      'field_name' => $this->field_name,
-      'type' => 'taxonomy_term_reference',
-      'settings' => array(
-        'allowed_values' => array(
-          array(
-            'vocabulary' => $this->vocabulary->id(),
-            'parent' => '0',
-          ),
-        ),
-      )
-    );
-    field_create_field($this->field);
-    $this->instance = array(
-      'field_name' => $this->field_name,
-      'entity_type' => 'test_entity',
-      'bundle' => 'test_bundle',
-      'widget' => array(
-        'type' => 'options_select',
-      ),
-    );
-    field_create_instance($this->instance);
-    entity_get_display('test_entity', 'test_bundle', 'full')
-      ->setComponent($this->field_name, array(
-        'type' => 'taxonomy_term_reference_link',
-      ))
-      ->save();
-  }
-
-  /**
-   * Test term field validation.
-   */
-  function testTaxonomyTermFieldValidation() {
-    // Test valid and invalid values with field_attach_validate().
-    $langcode = LANGUAGE_NOT_SPECIFIED;
-    $entity = field_test_create_entity();
-    $term = $this->createTerm($this->vocabulary);
-    $entity->{$this->field_name}[$langcode][0]['tid'] = $term->tid;
-    try {
-      field_attach_validate($entity);
-      $this->pass('Correct term does not cause validation error.');
-    }
-    catch (FieldValidationException $e) {
-      $this->fail('Correct term does not cause validation error.');
-    }
-
-    $entity = field_test_create_entity();
-    $bad_term = $this->createTerm($this->createVocabulary());
-    $entity->{$this->field_name}[$langcode][0]['tid'] = $bad_term->tid;
-    try {
-      field_attach_validate($entity);
-      $this->fail('Wrong term causes validation error.');
-    }
-    catch (FieldValidationException $e) {
-      $this->pass('Wrong term causes validation error.');
-    }
-  }
-
-  /**
-   * Test widgets.
-   */
-  function testTaxonomyTermFieldWidgets() {
-    // Create a term in the vocabulary.
-    $term = $this->createTerm($this->vocabulary);
-
-    // Display creation form.
-    $langcode = LANGUAGE_NOT_SPECIFIED;
-    $this->drupalGet('test-entity/add/test_bundle');
-    $this->assertFieldByName("{$this->field_name}[$langcode]", '', 'Widget is displayed.');
-
-    // Submit with some value.
-    $edit = array(
-      "{$this->field_name}[$langcode]" => array($term->tid),
-    );
-    $this->drupalPost(NULL, $edit, t('Save'));
-    preg_match('|test-entity/manage/(\d+)/edit|', $this->url, $match);
-    $id = $match[1];
-    $this->assertRaw(t('test_entity @id has been created.', array('@id' => $id)), 'Entity was created.');
-
-    // Display the object.
-    $entity = field_test_entity_test_load($id);
-    $entities = array($id => $entity);
-    $display = entity_get_display($entity->entityType(), $entity->bundle(), 'full');
-    field_attach_prepare_view('test_entity', $entities, array($entity->bundle() => $display));
-    $entity->content = field_attach_view($entity, $display);
-    $this->content = drupal_render($entity->content);
-    $this->assertText($term->label(), 'Term label is displayed.');
-
-    // Delete the vocabulary and verify that the widget is gone.
-    taxonomy_vocabulary_delete($this->vocabulary->id());
-    $this->drupalGet('test-entity/add/test_bundle');
-    $this->assertNoFieldByName("{$this->field_name}[$langcode]", '', 'Widget is not displayed');
-  }
-
-  /**
-   * Tests that vocabulary machine name changes are mirrored in field definitions.
-   */
-  function testTaxonomyTermFieldChangeMachineName() {
-    // Add several entries in the 'allowed_values' setting, to make sure that
-    // they all get updated.
-    $this->field['settings']['allowed_values'] = array(
-      array(
-        'vocabulary' => $this->vocabulary->id(),
-        'parent' => '0',
-      ),
-      array(
-        'vocabulary' => $this->vocabulary->id(),
-        'parent' => '0',
-      ),
-      array(
-        'vocabulary' => 'foo',
-        'parent' => '0',
-      ),
-    );
-    field_update_field($this->field);
-    // Change the machine name.
-    $new_name = drupal_strtolower($this->randomName());
-    $this->vocabulary->vid = $new_name;
-    taxonomy_vocabulary_save($this->vocabulary);
-
-    // Check that the field instance is still attached to the vocabulary.
-    $field = field_info_field($this->field_name);
-    $allowed_values = $field['settings']['allowed_values'];
-    $this->assertEqual($allowed_values[0]['vocabulary'], $new_name, 'Index 0: Machine name was updated correctly.');
-    $this->assertEqual($allowed_values[1]['vocabulary'], $new_name, 'Index 1: Machine name was updated correctly.');
-    $this->assertEqual($allowed_values[2]['vocabulary'], 'foo', 'Index 2: Machine name was left untouched.');
-  }
-}
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermIndexTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermIndexTest.php
index f9cba0d..82716a9 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermIndexTest.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermIndexTest.php
@@ -33,15 +33,10 @@ function setUp() {
     $this->field_name_1 = drupal_strtolower($this->randomName());
     $this->field_1 = array(
       'field_name' => $this->field_name_1,
-      'type' => 'taxonomy_term_reference',
+      'type' => 'entity_reference',
       'cardinality' => FIELD_CARDINALITY_UNLIMITED,
       'settings' => array(
-        'allowed_values' => array(
-          array(
-            'vocabulary' => $this->vocabulary->id(),
-            'parent' => 0,
-          ),
-        ),
+        'target_type' => 'taxonomy_term',
       ),
     );
     field_create_field($this->field_1);
@@ -52,26 +47,30 @@ function setUp() {
       'widget' => array(
         'type' => 'options_select',
       ),
+      'settings' => array(
+        'handler' => 'default',
+        'handler_settings' => array(
+          'target_bundles' => array(
+            $this->vocabulary->id(),
+          ),
+          'auto_create' => TRUE,
+        ),
+      ),
     );
     field_create_instance($this->instance_1);
     entity_get_display('node', 'article', 'default')
       ->setComponent($this->field_name_1, array(
-        'type' => 'taxonomy_term_reference_link',
+        'type' => 'entity_reference_label',
       ))
       ->save();
 
     $this->field_name_2 = drupal_strtolower($this->randomName());
     $this->field_2 = array(
       'field_name' => $this->field_name_2,
-      'type' => 'taxonomy_term_reference',
+      'type' => 'entity_reference',
       'cardinality' => FIELD_CARDINALITY_UNLIMITED,
       'settings' => array(
-        'allowed_values' => array(
-          array(
-            'vocabulary' => $this->vocabulary->id(),
-            'parent' => 0,
-          ),
-        ),
+        'target_type' => 'taxonomy_term',
       ),
     );
     field_create_field($this->field_2);
@@ -82,11 +81,20 @@ function setUp() {
       'widget' => array(
         'type' => 'options_select',
       ),
+      'settings' => array(
+        'handler' => 'default',
+        'handler_settings' => array(
+          'target_bundles' => array(
+            $this->vocabulary->id(),
+          ),
+          'auto_create' => TRUE,
+        ),
+      ),
     );
     field_create_instance($this->instance_2);
     entity_get_display('node', 'article', 'default')
       ->setComponent($this->field_name_2, array(
-        'type' => 'taxonomy_term_reference_link',
+        'type' => 'entity_reference_label',
       ))
       ->save();
   }
@@ -169,7 +177,7 @@ function testTaxonomyIndex() {
     $this->assertEqual(1, $index_count, 'Term 2 is indexed once.');
 
     // Update the article to change one term.
-    $node->{$this->field_name_1}[$langcode] = array(array('tid' => $term_1->tid));
+    $node->{$this->field_name_1}[$langcode] = array(array('target_id' => $term_1->tid));
     $node->save();
 
     // Check that both terms are indexed.
@@ -185,7 +193,7 @@ function testTaxonomyIndex() {
     $this->assertEqual(1, $index_count, 'Term 2 is indexed.');
 
     // Update the article to change another term.
-    $node->{$this->field_name_2}[$langcode] = array(array('tid' => $term_1->tid));
+    $node->{$this->field_name_2}[$langcode] = array(array('target_id' => $term_1->tid));
     $node->save();
 
     // Check that only one term is indexed.
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php
index 93cc8d4..36a0e19 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php
@@ -28,15 +28,10 @@ function setUp() {
 
     $field = array(
       'field_name' => 'taxonomy_' . $this->vocabulary->id(),
-      'type' => 'taxonomy_term_reference',
+      'type' => 'entity_reference',
       'cardinality' => FIELD_CARDINALITY_UNLIMITED,
       'settings' => array(
-        'allowed_values' => array(
-          array(
-            'vocabulary' => $this->vocabulary->id(),
-            'parent' => 0,
-          ),
-        ),
+        'target_type' => 'taxonomy_term',
       ),
     );
     field_create_field($field);
@@ -48,11 +43,20 @@ function setUp() {
       'widget' => array(
         'type' => 'options_select',
       ),
+      'settings' => array(
+        'handler' => 'default',
+        'handler_settings' => array(
+          'target_bundles' => array(
+            $this->vocabulary->id(),
+          ),
+          'auto_create' => TRUE,
+        ),
+      ),
     );
     field_create_instance($this->instance);
     entity_get_display('node', 'article', 'default')
       ->setComponent($this->instance['field_name'], array(
-        'type' => 'taxonomy_term_reference_link',
+        'type' => 'entity_reference_label',
       ))
       ->save();
   }
@@ -143,7 +147,7 @@ function testNodeTermCreationAndDeletion() {
     // Enable tags in the vocabulary.
     $instance = $this->instance;
     $instance['widget'] = array(
-      'type' => 'taxonomy_autocomplete',
+      'type' => 'entity_reference_autocomplete_tags',
       'settings' => array(
         'placeholder' => 'Start typing here.',
       ),
@@ -162,7 +166,7 @@ function testNodeTermCreationAndDeletion() {
     $edit["body[$langcode][0][value]"] = $this->randomName();
     // Insert the terms in a comma separated list. Vocabulary 1 is a
     // free-tagging field created by the default profile.
-    $edit[$instance['field_name'] . "[$langcode]"] = drupal_implode_tags($terms);
+    $edit[$instance['field_name'] . "[$langcode][target_id]"] = drupal_implode_tags($terms);
 
     // Verify the placeholder is there.
     $this->drupalGet('node/add/article');
@@ -210,74 +214,6 @@ function testNodeTermCreationAndDeletion() {
     }
     $this->assertNoText($term_objects['term1']->name, format_string('The deleted term %name does not appear on the node page.', array('%name' => $term_objects['term1']->name)));
     $this->assertNoText($term_objects['term2']->name, format_string('The deleted term %name does not appear on the node page.', array('%name' => $term_objects['term2']->name)));
-
-    // Test autocomplete on term 3, which contains a comma.
-    // The term will be quoted, and the " will be encoded in unicode (\u0022).
-    $input = substr($term_objects['term3']->name, 0, 3);
-    $json = $this->drupalGet('taxonomy/autocomplete/taxonomy_' . $this->vocabulary->id(), array('query' => array('q' => $input)));
-    $this->assertEqual($json, '{"\u0022' . $term_objects['term3']->name . '\u0022":"' . $term_objects['term3']->name . '"}', format_string('Autocomplete returns term %term_name after typing the first 3 letters.', array('%term_name' => $term_objects['term3']->name)));
-
-    // Test autocomplete on term 4 - it is alphanumeric only, so no extra
-    // quoting.
-    $input = substr($term_objects['term4']->name, 0, 3);
-    $this->drupalGet('taxonomy/autocomplete/taxonomy_' . $this->vocabulary->id(), array('query' => array('q' => $input)));
-    $this->assertRaw('{"' . $term_objects['term4']->name . '":"' . $term_objects['term4']->name . '"}', format_string('Autocomplete returns term %term_name after typing the first 3 letters.', array('%term_name' => $term_objects['term4']->name)));
-
-    // Test taxonomy autocomplete with a nonexistent field.
-    $field_name = $this->randomName();
-    $tag = $this->randomName();
-    $message = t("Taxonomy field @field_name not found.", array('@field_name' => $field_name));
-    $this->assertFalse(field_info_field($field_name), format_string('Field %field_name does not exist.', array('%field_name' => $field_name)));
-    $this->drupalGet('taxonomy/autocomplete/' . $field_name, array('query' => array('q' => $tag)));
-    $this->assertRaw($message, 'Autocomplete returns correct error message when the taxonomy field does not exist.');
-  }
-
-  /**
-   * Tests term autocompletion edge cases with slashes in the names.
-   */
-  function testTermAutocompletion() {
-    // Add a term with a slash in the name.
-    $first_term = $this->createTerm($this->vocabulary);
-    $first_term->name = '10/16/2011';
-    taxonomy_term_save($first_term);
-    // Add another term that differs after the slash character.
-    $second_term = $this->createTerm($this->vocabulary);
-    $second_term->name = '10/17/2011';
-    taxonomy_term_save($second_term);
-    // Add another term that has both a comma and a slash character.
-    $third_term = $this->createTerm($this->vocabulary);
-    $third_term->name = 'term with, a comma and / a slash';
-    taxonomy_term_save($third_term);
-
-    // Try to autocomplete a term name that matches both terms.
-    // We should get both term in a json encoded string.
-    $input = '10/';
-    $path = 'taxonomy/autocomplete/taxonomy_' . $this->vocabulary->id();
-    // The result order is not guaranteed, so check each term separately.
-    $result = $this->drupalGet($path, array('query' => array('q' => $input)));
-    $data = drupal_json_decode($result);
-    $this->assertEqual($data[$first_term->name], check_plain($first_term->name), 'Autocomplete returned the first matching term');
-    $this->assertEqual($data[$second_term->name], check_plain($second_term->name), 'Autocomplete returned the second matching term');
-
-    // Try to autocomplete a term name that matches first term.
-    // We should only get the first term in a json encoded string.
-    $input = '10/16';
-    $path = 'taxonomy/autocomplete/taxonomy_' . $this->vocabulary->id();
-    $this->drupalGet($path, array('query' => array('q' => $input)));
-    $target = array($first_term->name => check_plain($first_term->name));
-    $this->assertRaw(drupal_json_encode($target), 'Autocomplete returns only the expected matching term.');
-
-    // Try to autocomplete a term name with both a comma and a slash.
-    $input = '"term with, comma and / a';
-    $path = 'taxonomy/autocomplete/taxonomy_' . $this->vocabulary->id();
-    $this->drupalGet($path, array('query' => array('q' => $input)));
-    $n = $third_term->name;
-    // Term names containing commas or quotes must be wrapped in quotes.
-    if (strpos($third_term->name, ',') !== FALSE || strpos($third_term->name, '"') !== FALSE) {
-      $n = '"' . str_replace('"', '""', $third_term->name) . '"';
-    }
-    $target = array($n => check_plain($third_term->name));
-    $this->assertRaw(drupal_json_encode($target), 'Autocomplete returns a term containing a comma and a slash.');
   }
 
   /**
@@ -506,7 +442,7 @@ function testTaxonomyGetTermByName() {
   function testReSavingTags() {
     // Enable tags in the vocabulary.
     $instance = $this->instance;
-    $instance['widget'] = array('type' => 'taxonomy_autocomplete');
+    $instance['widget'] = array('type' => 'entity_reference_autocomplete_tags');
     field_update_instance($instance);
 
     // Create a term and a node using it.
@@ -515,7 +451,7 @@ function testReSavingTags() {
     $edit = array();
     $edit["title"] = $this->randomName(8);
     $edit["body[$langcode][0][value]"] = $this->randomName(16);
-    $edit[$this->instance['field_name'] . '[' . $langcode . ']'] = $term->label();
+    $edit[$this->instance['field_name'] . '[' . $langcode . '][target_id]'] = $term->label() . '(' . $term->id() . ')';
     $this->drupalPost('node/add/article', $edit, t('Save'));
 
     // Check that the term is displayed when editing and saving the node with no
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TokenReplaceTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TokenReplaceTest.php
index ea73152..6887c62 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TokenReplaceTest.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TokenReplaceTest.php
@@ -29,15 +29,10 @@ function setUp() {
 
     $field = array(
       'field_name' => 'taxonomy_' . $this->vocabulary->id(),
-      'type' => 'taxonomy_term_reference',
+      'type' => 'entity_reference',
       'cardinality' => FIELD_CARDINALITY_UNLIMITED,
       'settings' => array(
-        'allowed_values' => array(
-          array(
-            'vocabulary' => $this->vocabulary->id(),
-            'parent' => 0,
-          ),
-        ),
+        'target_type' => 'taxonomy_term',
       ),
     );
     field_create_field($field);
@@ -49,11 +44,20 @@ function setUp() {
       'widget' => array(
         'type' => 'options_select',
       ),
+      'settings' => array(
+        'handler' => 'default',
+        'handler_settings' => array(
+          'target_bundles' => array(
+            $this->vocabulary->id(),
+          ),
+          'auto_create' => TRUE,
+        ),
+      ),
     );
     field_create_instance($this->instance);
     entity_get_display('node', 'article', 'default')
       ->setComponent('taxonomy_' . $this->vocabulary->id(), array(
-        'type' => 'taxonomy_term_reference_link',
+        'type' => 'entity_reference_label',
       ))
       ->save();
   }
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/Views/TaxonomyTestBase.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/Views/TaxonomyTestBase.php
index ec91070..5e9c850 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/Views/TaxonomyTestBase.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/Views/TaxonomyTestBase.php
@@ -54,8 +54,8 @@ function setUp() {
 
     $node = array();
     $node['type'] = 'article';
-    $node['field_views_testing_tags'][LANGUAGE_NOT_SPECIFIED][]['tid'] = $this->term1->tid;
-    $node['field_views_testing_tags'][LANGUAGE_NOT_SPECIFIED][]['tid'] = $this->term2->tid;
+    $node['field_views_testing_tags'][LANGUAGE_NOT_SPECIFIED][]['target_id'] = $this->term1->tid;
+    $node['field_views_testing_tags'][LANGUAGE_NOT_SPECIFIED][]['target_id'] = $this->term2->tid;
     $this->nodes[] = $this->drupalCreateNode($node);
     $this->nodes[] = $this->drupalCreateNode($node);
   }
@@ -82,16 +82,11 @@ protected function mockStandardInstall() {
     $this->vocabulary->save();
     $field = array(
       'field_name' => 'field_' . $this->vocabulary->id(),
-      'type' => 'taxonomy_term_reference',
+      'type' => 'entity_reference',
       // Set cardinality to unlimited for tagging.
       'cardinality' => FIELD_CARDINALITY_UNLIMITED,
       'settings' => array(
-        'allowed_values' => array(
-          array(
-            'vocabulary' => $this->vocabulary->id(),
-            'parent' => 0,
-          ),
-        ),
+        'target_type' => 'taxonomy_term',
       ),
     );
     field_create_field($field);
@@ -101,21 +96,30 @@ protected function mockStandardInstall() {
       'label' => 'Tags',
       'bundle' => 'article',
       'widget' => array(
-        'type' => 'taxonomy_autocomplete',
+        'type' => 'entity_reference_autocomplete_tags',
         'weight' => -4,
       ),
+      'settings' => array(
+        'handler' => 'default',
+        'handler_settings' => array(
+          'target_bundles' => array(
+            $this->vocabulary->id(),
+          ),
+          'auto_create' => TRUE,
+        ),
+      ),
     );
     field_create_instance($instance);
 
     entity_get_display('node', 'article', 'default')
       ->setComponent($instance['field_name'], array(
-        'type' => 'taxonomy_term_reference_link',
+        'type' => 'entity_reference_label',
         'weight' => 10,
       ))
       ->save();
     entity_get_display('node', 'article', 'teaser')
       ->setComponent($instance['field_name'], array(
-        'type' => 'taxonomy_term_reference_link',
+        'type' => 'entity_reference_label',
         'weight' => 10,
       ))
       ->save();
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Type/TaxonomyTermReferenceItem.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Type/TaxonomyTermReferenceItem.php
index 7f7ab02..d2c404f 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Type/TaxonomyTermReferenceItem.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Type/TaxonomyTermReferenceItem.php
@@ -10,7 +10,7 @@
 use Drupal\Core\Entity\Field\FieldItemBase;
 
 /**
- * Defines the 'taxonomy_term_reference' entity field item.
+ * Defines the 'entity_reference' entity field item.
  */
 class TaxonomyTermReferenceItem extends FieldItemBase {
 
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyStorageController.php b/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyStorageController.php
index b14fc2f..b200876 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyStorageController.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyStorageController.php
@@ -25,18 +25,31 @@ protected function postSave(EntityInterface $entity, $update) {
     elseif ($entity->getOriginalID() != $entity->id()) {
       // Reflect machine name changes in the definitions of existing 'taxonomy'
       // fields.
-      $fields = field_read_fields();
-      foreach ($fields as $field_name => $field) {
-        $update_field = FALSE;
-        if ($field['type'] == 'taxonomy_term_reference') {
-          foreach ($field['settings']['allowed_values'] as $key => &$value) {
-            if ($value['vocabulary'] == $entity->getOriginalID()) {
-              $value['vocabulary'] = $entity->id();
-              $update_field = TRUE;
+      foreach (field_info_instances() as $entity_type => $bundles) {
+        foreach ($bundles as $bundle => $field_names) {
+          foreach ($field_names as $field_name => $instance) {
+            $field = field_info_field($field_name);
+            if ($field['type'] != 'entity_reference' || $field['settings']['target_type'] != 'taxonomy_term') {
+              // Not an entity reference field, referencing taxonomy term.
+              continue;
+            }
+            if (empty($instance['settings']['handler_settings']['target_bundles'])) {
+              // Instance is referencing all bundles.
+              continue;
+            }
+
+
+
+            $update_field = FALSE;
+            foreach ($instance['settings']['handler_settings']['target_bundles'] as $delta=> $bundle) {
+              if ($bundle == $entity->getOriginalID()) {
+                $instance['settings']['handler_settings']['target_bundles'][$delta] = $entity->id();
+                $update_field = TRUE;
+              }
+            }
+            if ($update_field) {
+              field_update_instance($instance);
             }
-          }
-          if ($update_field) {
-            field_update_field($field);
           }
         }
       }
@@ -67,29 +80,42 @@ protected function postDelete($entities) {
     foreach ($entities as $vocabulary) {
       $vocabularies[$vocabulary->id()] = $vocabulary->id();
     }
-    // Load all Taxonomy module fields and delete those which use only this
+    // Iterate over all entity reference fields referencing taxonomy terms and delete those which use only this
     // vocabulary.
-    $taxonomy_fields = field_read_fields(array('module' => 'taxonomy'));
-    foreach ($taxonomy_fields as $field_name => $taxonomy_field) {
-      $modified_field = FALSE;
-      // Term reference fields may reference terms from more than one
-      // vocabulary.
-      foreach ($taxonomy_field['settings']['allowed_values'] as $key => $allowed_value) {
-        if (isset($vocabularies[$allowed_value['vocabulary']])) {
-          unset($taxonomy_field['settings']['allowed_values'][$key]);
-          $modified_field = TRUE;
-        }
-      }
-      if ($modified_field) {
-        if (empty($taxonomy_field['settings']['allowed_values'])) {
-          field_delete_field($field_name);
-        }
-        else {
-          // Update the field definition with the new allowed values.
-          field_update_field($taxonomy_field);
+    foreach (field_info_instances() as $entity_type => $bundles) {
+      foreach ($bundles as $bundle => $field_names) {
+        foreach ($field_names as $field_name => $instance) {
+          $field = field_info_field($field_name);
+          if ($field['type'] != 'entity_reference' || $field['settings']['target_type'] != 'taxonomy_term') {
+            // Not an entity reference field, referencing taxonomy term.
+            continue;
+          }
+          if (empty($instance['settings']['handler_settings']['target_bundles'])) {
+            // Instance is referencing all bundles.
+            continue;
+          }
+
+          $modified_field = FALSE;
+
+          foreach ($instance['settings']['handler_settings']['target_bundles'] as $delta => $bundle) {
+            if (isset($vocabularies[$bundle])) {
+              unset($instance['settings']['handler_settings']['target_bundles'][$delta]);
+              $modified_field = TRUE;
+            }
+          }
+          if ($modified_field) {
+            if (empty($instance['settings']['handler_settings']['target_bundles'])) {
+              field_delete_instance($instance);
+            }
+            else {
+              // Update the instance definition with the new target bundles.
+              field_update_instance($instance);
+            }
+          }
         }
       }
     }
+
     // Reset caches.
     $this->resetCache(array_keys($vocabularies));
   }
diff --git a/core/modules/taxonomy/taxonomy.info b/core/modules/taxonomy/taxonomy.info
index 837b556..e84984b 100644
--- a/core/modules/taxonomy/taxonomy.info
+++ b/core/modules/taxonomy/taxonomy.info
@@ -3,5 +3,6 @@ description = Enables the categorization of content.
 package = Core
 version = VERSION
 core = 8.x
+dependencies[] = entity_reference
 dependencies[] = options
 configure = admin/structure/taxonomy
diff --git a/core/modules/taxonomy/taxonomy.install b/core/modules/taxonomy/taxonomy.install
index 7b1d331..a539222 100644
--- a/core/modules/taxonomy/taxonomy.install
+++ b/core/modules/taxonomy/taxonomy.install
@@ -5,6 +5,7 @@
  * Install, update and uninstall functions for the taxonomy module.
  */
 
+use Drupal\Component\Utility\NestedArray;
 use Drupal\Component\Uuid\Uuid;
 
 /**
@@ -337,3 +338,127 @@ function taxonomy_update_8006() {
       ->execute();
   }
 }
+
+/**
+ * Convert taxonomy term fields to entity reference field types.
+ */
+function taxonomy_update_8007() {
+  if (!$fields = field_read_fields(array('type' => 'taxonomy_term_reference'), array('include_inactive' => 1))) {
+    return;
+  }
+  update_module_enable(array('entity_reference'));
+
+  // Make sure that field.module is registered to the container so we can use
+  // it's services.
+  $module_handler = drupal_container()->get('module_handler');
+  $module_filenames = $module_handler->getModuleList();
+  $module_filenames['field'] = 'core/modules/field/field.module';
+  $module_handler->setModuleList($module_filenames);
+  $module_handler->reload();
+  drupal_container()->get('kernel')->updateModules($module_filenames, $module_filenames);
+
+  module_load_install('entity_reference');
+
+  // Clear the fields cache, so we can get the widget definition.
+  field_cache_clear();
+  $widget_info = field_info_widget_types('entity_reference_autocomplete_tags');
+
+  foreach ($fields as $field_name => $field) {
+    if ($field['storage']['type'] != 'field_sql_storage') {
+      // Field doesn't use SQL storage, we cannot modify the schema.
+      continue;
+    }
+
+    $instances = field_read_instances(array('field_id' => $field['id']), array('include_inactive' => 1));
+
+    $tables = array(
+      _field_sql_storage_tablename($field),
+      _field_sql_storage_revision_tablename($field),
+    );
+
+    foreach ($tables as $table_name) {
+      db_change_field($table_name, $field_name . '_tid', $field_name . '_target_id', array(
+        'description' => 'The ID of the target entity.',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+      ));
+
+      // Add the revision ID column.
+      $column = array(
+        'description' => 'The revision ID of the target entity.',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => FALSE,
+      );
+      db_add_field($table_name, $field_name . '_revision_id', $column);
+
+      // Change the index.
+      db_drop_index($table_name, $field_name . '_tid');
+      db_add_index($table_name, $field_name . '_target_id', array($field_name . '_target_id'));
+    }
+
+    // Update the field settings.
+    $field['settings']['target_type'] = 'taxonomy_term';
+    $schema = entity_reference_field_schema($field);
+    unset($field['columns'], $field['indexes'], $field['foreign keys']);
+    $field = NestedArray::mergeDeep($field, $schema);
+
+    // @todo: Deal with ['allowed_values'][0]['parent'].
+    $vocabulary_name = $field['settings']['allowed_values'][0]['vocabulary'];
+    unset($field['settings']['allowed_values']);
+
+    $field['module'] = $field['type'] = 'entity_reference';
+
+    _update_7000_field_update_field($field);
+
+    // Update the instance settings.
+    if (!$instances) {
+      continue;
+    }
+
+    $field = field_info_field($field_name);
+
+    foreach ($instances as $instance) {
+      if ($instance['widget']['type'] == 'taxonomy_autocomplete') {
+        // Update the widget.
+        $instance['widget'] = $widget_info;
+        $instance['widget']['type'] = 'entity_reference_autocomplete_tags';
+      }
+
+      $instance['settings']['handler'] = 'default';
+      $instance['settings']['handler_settings'] = array(
+        'target_bundles' => array($vocabulary_name),
+        // Enable auto-create.
+        'auto_create' => TRUE,
+      );
+
+      _update_7000_field_update_instance($field, $instance);
+
+      if (empty($field['bundles'])) {
+        continue;
+      }
+
+      // Update the formatter.
+      foreach ($field['bundles'] as $entity_type => $bundles) {
+        $entity_info = entity_get_info($entity_type);
+        foreach ($bundles as $bundle) {
+          // Add the 'default' view mode.
+          $entity_info['view_modes'][] = 'default';
+          foreach (array_keys($entity_info['view_modes']) as $view_mode) {
+            $display = _update_8000_entity_get_display($entity_type, $bundle, $view_mode);
+            $original_display = $display->get('content.' . $field_name);
+            $display->set('content.' . $field_name, array(
+                'label' => $original_display['label'],
+                'weight' => $original_display['weight'],
+                'type' => 'entity_reference_label',
+                'settings' => array('link' => TRUE),
+              ))
+              ->save();
+            update_config_manifest_add('entity.display', array($display->get('id')));
+          }
+        }
+      }
+    }
+  }
+}
diff --git a/core/modules/taxonomy/taxonomy.module b/core/modules/taxonomy/taxonomy.module
index 4b1a2b1..46452f9 100644
--- a/core/modules/taxonomy/taxonomy.module
+++ b/core/modules/taxonomy/taxonomy.module
@@ -26,14 +26,6 @@
 const TAXONOMY_HIERARCHY_MULTIPLE = 2;
 
 /**
- * Users can create new terms in a free-tagging vocabulary when
- * submitting a taxonomy_autocomplete_widget. We store a term object
- * whose tid is 'autocreate' as a field data item during widget
- * validation and then actually create the term if/when that field
- * data item makes it to taxonomy_field_insert/update().
- */
-
-/**
  * Implements hook_help().
  */
 function taxonomy_help($path, $arg) {
@@ -324,14 +316,6 @@ function taxonomy_menu() {
     'type' => MENU_CALLBACK,
     'file' => 'taxonomy.pages.inc',
   );
-  $items['taxonomy/autocomplete/%'] = array(
-    'title' => 'Autocomplete taxonomy',
-    'page callback' => 'taxonomy_autocomplete',
-    'page arguments' => array(2),
-    'access arguments' => array('access content'),
-    'type' => MENU_CALLBACK,
-    'file' => 'taxonomy.pages.inc',
-  );
 
   $items['admin/structure/taxonomy/%taxonomy_vocabulary'] = array(
     'title callback' => 'entity_page_label',
@@ -964,273 +948,13 @@ function taxonomy_implode_tags($tags, $vid = NULL) {
 /**
  * Implements hook_field_info().
  *
- * Field settings:
- * - allowed_values: a list array of one or more vocabulary trees:
- *   - vocabulary: a vocabulary machine name.
+ * @todo: How do we maintain this in entity reference?
  *   - parent: a term ID of a term whose children are allowed. This should be
  *     '0' if all terms in a vocabulary are allowed. The allowed values do not
  *     include the parent term.
  *
  */
 function taxonomy_field_info() {
-  return array(
-    'taxonomy_term_reference' => array(
-      'label' => t('Term reference'),
-      'description' => t('This field stores a reference to a taxonomy term.'),
-      'default_widget' => 'options_select',
-      'default_formatter' => 'taxonomy_term_reference_link',
-      'field item class' => 'Drupal\taxonomy\Type\TaxonomyTermReferenceItem',
-      'settings' => array(
-        'allowed_values' => array(
-          array(
-            'vocabulary' => '',
-            'parent' => '0',
-          ),
-        ),
-      ),
-    ),
-  );
-}
-
-/**
- * Implements hook_field_widget_info_alter().
- */
-function taxonomy_field_widget_info_alter(&$info) {
-  $info['options_select']['field_types'][] = 'taxonomy_term_reference';
-  $info['options_buttons']['field_types'][] = 'taxonomy_term_reference';
-}
-
-/**
- * Implements hook_options_list().
- */
-function taxonomy_options_list($field, $instance, $entity) {
-  $function = !empty($field['settings']['options_list_callback']) ? $field['settings']['options_list_callback'] : 'taxonomy_allowed_values';
-  return $function($field, $instance, $entity);
-}
-
-/**
- * Implements hook_field_validate().
- *
- * Taxonomy field settings allow for either a single vocabulary ID, multiple
- * vocabulary IDs, or sub-trees of a vocabulary to be specified as allowed
- * values, although only the first of these is supported via the field UI.
- * Confirm that terms entered as values meet at least one of these conditions.
- *
- * Possible error codes:
- * - 'taxonomy_term_illegal_value': The value is not part of the list of allowed values.
- */
-function taxonomy_field_validate(EntityInterface $entity = NULL, $field, $instance, $langcode, $items, &$errors) {
-  // Build an array of existing term IDs so they can be loaded with
-  // taxonomy_term_load_multiple();
-  foreach ($items as $delta => $item) {
-    if (!empty($item['tid']) && $item['tid'] != 'autocreate') {
-      $tids[] = $item['tid'];
-    }
-  }
-  if (!empty($tids)) {
-    $terms = taxonomy_term_load_multiple($tids);
-
-    // Check each existing item to ensure it can be found in the
-    // allowed values for this field.
-    foreach ($items as $delta => $item) {
-      $validate = TRUE;
-      if (!empty($item['tid']) && $item['tid'] != 'autocreate') {
-        $validate = FALSE;
-        foreach ($field['settings']['allowed_values'] as $settings) {
-          // If no parent is specified, check if the term is in the vocabulary.
-          if (isset($settings['vocabulary']) && empty($settings['parent'])) {
-            if ($settings['vocabulary'] == $terms[$item['tid']]->bundle()) {
-              $validate = TRUE;
-              break;
-            }
-          }
-          // If a parent is specified, then to validate it must appear in the
-          // array returned by taxonomy_term_load_parents_all().
-          elseif (!empty($settings['parent'])) {
-            $ancestors = taxonomy_term_load_parents_all($item['tid']);
-            foreach ($ancestors as $ancestor) {
-              if ($ancestor->tid == $settings['parent']) {
-                $validate = TRUE;
-                break 2;
-              }
-            }
-          }
-        }
-      }
-      if (!$validate) {
-        $errors[$field['field_name']][$langcode][$delta][] = array(
-          'error' => 'taxonomy_term_reference_illegal_value',
-          'message' => t('%name: illegal value.', array('%name' => $instance['label'])),
-        );
-      }
-    }
-  }
-}
-
-/**
- * Implements hook_field_is_empty().
- */
-function taxonomy_field_is_empty($item, $field) {
-  if (!is_array($item) || (empty($item['tid']) && (string) $item['tid'] !== '0')) {
-    return TRUE;
-  }
-  return FALSE;
-}
-
-/**
- * Implements hook_field_formatter_info().
- */
-function taxonomy_field_formatter_info() {
-  return array(
-    'taxonomy_term_reference_link' => array(
-      'label' => t('Link'),
-      'field types' => array('taxonomy_term_reference'),
-    ),
-    'taxonomy_term_reference_plain' => array(
-      'label' => t('Plain text'),
-      'field types' => array('taxonomy_term_reference'),
-    ),
-    'taxonomy_term_reference_rss_category' => array(
-      'label' => t('RSS category'),
-      'field types' => array('taxonomy_term_reference'),
-    ),
-  );
-}
-
-/**
- * Implements hook_field_formatter_view().
- */
-function taxonomy_field_formatter_view(EntityInterface $entity, $field, $instance, $langcode, $items, $display) {
-  $element = array();
-
-  // Terms whose tid is 'autocreate' do not exist
-  // yet and $item['taxonomy_term'] is not set. Theme such terms as
-  // just their name.
-
-  switch ($display['type']) {
-    case 'taxonomy_term_reference_link':
-      foreach ($items as $delta => $item) {
-        if ($item['tid'] == 'autocreate') {
-          $element[$delta] = array(
-            '#markup' => check_plain($item['name']),
-          );
-        }
-        else {
-          $term = $item['taxonomy_term'];
-          $uri = $term->uri();
-          $element[$delta] = array(
-            '#type' => 'link',
-            '#title' => $term->label(),
-            '#href' => $uri['path'],
-            '#options' => $uri['options'],
-          );
-        }
-      }
-      break;
-
-    case 'taxonomy_term_reference_plain':
-      foreach ($items as $delta => $item) {
-        $name = ($item['tid'] != 'autocreate' ? $item['taxonomy_term']->label() : $item['name']);
-        $element[$delta] = array(
-          '#markup' => check_plain($name),
-        );
-      }
-      break;
-
-    case 'taxonomy_term_reference_rss_category':
-      foreach ($items as $delta => $item) {
-        $entity->rss_elements[] = array(
-          'key' => 'category',
-          'value' => $item['tid'] != 'autocreate' ? $item['taxonomy_term']->label() : $item['name'],
-          'attributes' => array(
-            'domain' => $item['tid'] != 'autocreate' ? url('taxonomy/term/' . $item['tid'], array('absolute' => TRUE)) : '',
-          ),
-        );
-      }
-      break;
-  }
-
-  return $element;
-}
-
-/**
- * Returns the set of valid terms for a taxonomy field.
- *
- * @param $field
- *   The field definition.
- * @param $instance
- *   The instance definition. It is recommended to only use instance level
- *   properties to filter out values from a list defined by field level
- *   properties.
- * @param \Drupal\Core\Entity\EntityInterface $entity
- *   The entity object the field is attached to, or NULL if no entity
- *   exists (e.g. in field settings page).
- *
- * @return
- *   The array of valid terms for this field, keyed by term id.
- */
-function taxonomy_allowed_values($field, $instance, EntityInterface $entity) {
-  $options = array();
-  foreach ($field['settings']['allowed_values'] as $tree) {
-    if ($vocabulary = taxonomy_vocabulary_load($tree['vocabulary'])) {
-      if ($terms = taxonomy_get_tree($vocabulary->id(), $tree['parent'], NULL, TRUE)) {
-        foreach ($terms as $term) {
-          $options[$term->tid] = str_repeat('-', $term->depth) . $term->label();
-        }
-      }
-    }
-  }
-  return $options;
-}
-
-/**
- * Implements hook_field_formatter_prepare_view().
- *
- * This preloads all taxonomy terms for multiple loaded objects at once and
- * unsets values for invalid terms that do not exist.
- */
-function taxonomy_field_formatter_prepare_view($entity_type, $entities, $field, $instances, $langcode, &$items, $displays) {
-  $tids = array();
-
-  // Collect every possible term attached to any of the fieldable entities.
-  foreach ($entities as $id => $entity) {
-    foreach ($items[$id] as $delta => $item) {
-      // Force the array key to prevent duplicates.
-      if ($item['tid'] != 'autocreate') {
-        $tids[$item['tid']] = $item['tid'];
-      }
-    }
-  }
-  if ($tids) {
-    $terms = taxonomy_term_load_multiple($tids);
-
-    // Iterate through the fieldable entities again to attach the loaded term data.
-    foreach ($entities as $id => $entity) {
-      $rekey = FALSE;
-
-      foreach ($items[$id] as $delta => $item) {
-        // Check whether the taxonomy term field instance value could be loaded.
-        if (isset($terms[$item['tid']])) {
-          // Replace the instance value with the term data.
-          $items[$id][$delta]['taxonomy_term'] = $terms[$item['tid']];
-        }
-        // Terms to be created are not in $terms, but are still legitimate.
-        elseif ($item['tid'] == 'autocreate') {
-          // Leave the item in place.
-        }
-        // Otherwise, unset the instance value, since the term does not exist.
-        else {
-          unset($items[$id][$delta]);
-          $rekey = TRUE;
-        }
-      }
-
-      if ($rekey) {
-        // Rekey the items array.
-        $items[$id] = array_values($items[$id]);
-      }
-    }
-  }
 }
 
 /**
@@ -1247,52 +971,6 @@ function taxonomy_term_title(Term $term) {
 }
 
 /**
- * Form element validate handler for taxonomy term autocomplete element.
- */
-function taxonomy_autocomplete_validate($element, &$form_state) {
-  // Split the values into an array.
-  // @see Drupal\taxonomy\Plugin\field\widget\TaxonomyAutocompleteWidget:massageFormValues()
-  $typed_terms = array();
-  if ($tags = $element['#value']) {
-    $typed_terms = drupal_explode_tags($tags);
-  }
-  form_set_value($element, $typed_terms, $form_state);
-}
-
-/**
- * Implements hook_field_settings_form().
- */
-function taxonomy_field_settings_form($field, $instance, $has_data) {
-  // Get proper values for 'allowed_values_function', which is a core setting.
-  $vocabularies = taxonomy_vocabulary_load_multiple();
-  $options = array();
-  foreach ($vocabularies as $vocabulary) {
-    $options[$vocabulary->id()] = $vocabulary->name;
-  }
-  $form['allowed_values'] = array(
-    '#tree' => TRUE,
-  );
-
-  foreach ($field['settings']['allowed_values'] as $delta => $tree) {
-    $form['allowed_values'][$delta]['vocabulary'] = array(
-      '#type' => 'select',
-      '#title' => t('Vocabulary'),
-      '#default_value' => $tree['vocabulary'],
-      '#options' => $options,
-      '#required' => TRUE,
-      '#description' => t('The vocabulary which supplies the options for this field.'),
-      '#disabled' => $has_data,
-    );
-    $form['allowed_values'][$delta]['parent'] = array(
-      '#type' => 'value',
-      '#value' => $tree['parent'],
-    );
-  }
-
-  return $form;
-}
-
-/**
  * Implements hook_rdf_mapping().
  *
  * @return array
@@ -1356,23 +1034,6 @@ function taxonomy_rdf_mapping() {
  */
 
 /**
- * Implements hook_field_presave().
- *
- * Create any new terms defined in a freetagging vocabulary.
- */
-function taxonomy_field_presave(EntityInterface $entity, $field, $instance, $langcode, &$items) {
-  foreach ($items as $delta => $item) {
-    if ($item['tid'] == 'autocreate') {
-      unset($item['tid']);
-      $term = entity_create('taxonomy_term', $item);
-      $term->langcode = $langcode;
-      taxonomy_term_save($term);
-      $items[$delta]['tid'] = $term->tid;
-    }
-  }
-}
-
-/**
  * Implements hook_node_insert().
  */
 function taxonomy_node_insert(Node $node) {
@@ -1412,7 +1073,7 @@ function taxonomy_build_node_index($node) {
     foreach (field_info_instances('node', $node->type) as $instance) {
       $field_name = $instance['field_name'];
       $field = field_info_field($field_name);
-      if ($field['module'] == 'taxonomy' && $field['storage']['type'] == 'field_sql_storage') {
+      if ($field['module'] == 'entity_reference' && $field['settings']['target_type'] == 'taxonomy_term' && $field['storage']['type'] == 'field_sql_storage') {
         // If a field value is not set in the node object when node_save() is
         // called, the old value from $node->original is used.
         if (isset($node->{$field_name})) {
@@ -1427,7 +1088,7 @@ function taxonomy_build_node_index($node) {
         foreach (field_available_languages('node', $field) as $langcode) {
           if (!empty($items[$langcode])) {
             foreach ($items[$langcode] as $item) {
-              $tid_all[$item['tid']] = $item['tid'];
+              $tid_all[$item['target_id']] = $item['target_id'];
             }
           }
         }
diff --git a/core/modules/taxonomy/taxonomy.pages.inc b/core/modules/taxonomy/taxonomy.pages.inc
index fbd29f1..cf77a20 100644
--- a/core/modules/taxonomy/taxonomy.pages.inc
+++ b/core/modules/taxonomy/taxonomy.pages.inc
@@ -78,86 +78,3 @@ function taxonomy_term_feed(Term $term) {
   return node_feed($nids, $channel);
 }
 
-/**
- * Page callback: Outputs JSON for taxonomy autocomplete suggestions.
- *
- * This callback outputs term name suggestions in response to Ajax requests
- * made by the taxonomy autocomplete widget for taxonomy term reference
- * fields. The output is a JSON object of plain-text term suggestions, keyed by
- * the user-entered value with the completed term name appended.  Term names
- * containing commas are wrapped in quotes.
- *
- * For example, suppose the user has entered the string 'red fish, blue' in the
- * field, and there are two taxonomy terms, 'blue fish' and 'blue moon'. The
- * JSON output would have the following structure:
- * @code
- *   {
- *     "red fish, blue fish": "blue fish",
- *     "red fish, blue moon": "blue moon",
- *   };
- * @endcode
- *
- * @param $field_name
- *   The name of the term reference field.
- *
- * @see taxonomy_menu()
- * @see taxonomy_field_widget_info()
- */
-function taxonomy_autocomplete($field_name) {
-  // A comma-separated list of term names entered in the autocomplete form
-  // element. Only the last term is used for autocompletion.
-  $tags_typed = drupal_container()->get('request')->query->get('q');
-
-  // Make sure the field exists and is a taxonomy field.
-  if (!($field = field_info_field($field_name)) || $field['type'] !== 'taxonomy_term_reference') {
-    // Error string. The JavaScript handler will realize this is not JSON and
-    // will display it as debugging information.
-    print t('Taxonomy field @field_name not found.', array('@field_name' => $field_name));
-    exit;
-  }
-
-  // The user enters a comma-separated list of tags. We only autocomplete the last tag.
-  $tags_typed = drupal_explode_tags($tags_typed);
-  $tag_last = drupal_strtolower(array_pop($tags_typed));
-
-  $matches = array();
-  if ($tag_last != '') {
-
-    // Part of the criteria for the query come from the field's own settings.
-    $vids = array();
-    foreach ($field['settings']['allowed_values'] as $tree) {
-      $vids[] = $tree['vocabulary'];
-    }
-
-    $query = db_select('taxonomy_term_data', 't');
-    $query->addTag('translatable');
-    $query->addTag('term_access');
-
-    // Do not select already entered terms.
-    if (!empty($tags_typed)) {
-      $query->condition('t.name', $tags_typed, 'NOT IN');
-    }
-    // Select rows that match by term name.
-    $tags_return = $query
-      ->fields('t', array('tid', 'name'))
-      ->condition('t.vid', $vids)
-      ->condition('t.name', '%' . db_like($tag_last) . '%', 'LIKE')
-      ->range(0, 10)
-      ->execute()
-      ->fetchAllKeyed();
-
-    $prefix = count($tags_typed) ? drupal_implode_tags($tags_typed) . ', ' : '';
-
-    $term_matches = array();
-    foreach ($tags_return as $tid => $name) {
-      $n = $name;
-      // Term names containing commas or quotes must be wrapped in quotes.
-      if (strpos($name, ',') !== FALSE || strpos($name, '"') !== FALSE) {
-        $n = '"' . str_replace('"', '""', $name) . '"';
-      }
-      $term_matches[$prefix . $n] = check_plain($name);
-    }
-  }
-
-  return new JsonResponse($term_matches);
-}
diff --git a/core/modules/taxonomy/taxonomy.views.inc b/core/modules/taxonomy/taxonomy.views.inc
index 0644f82..b4cb880 100644
--- a/core/modules/taxonomy/taxonomy.views.inc
+++ b/core/modules/taxonomy/taxonomy.views.inc
@@ -330,7 +330,7 @@ function taxonomy_views_data_alter(&$data) {
 /**
  * Implements hook_field_views_data().
  *
- * Views integration for taxonomy_term_reference fields. Adds a term relationship to the default
+ * Views integration for entity_reference fields. Adds a term relationship to the default
  * field data.
  *
  * @see field_views_field_default_views_data()
diff --git a/core/modules/views/includes/ajax.inc b/core/modules/views/includes/ajax.inc
index 73c3d02..fb3bed3 100644
--- a/core/modules/views/includes/ajax.inc
+++ b/core/modules/views/includes/ajax.inc
@@ -284,7 +284,7 @@ function views_ajax_form_wrapper($form_id, &$form_state) {
  * @param $vid
  *   The vocabulary id of the tags which should be returned.
  *
- * @see taxonomy_autocomplete()
+ * @see entity_reference_autocomplete_tags()
  */
 function views_ajax_autocomplete_taxonomy($vid) {
   // The user enters a comma-separated list of tags. We only autocomplete the last tag.
diff --git a/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php b/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php
index 7e8fc93..212fe78 100644
--- a/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php
@@ -59,15 +59,10 @@ protected function setUp() {
     $this->field_name = drupal_strtolower($this->randomName());
     $this->field = array(
       'field_name' => $this->field_name,
-      'type' => 'taxonomy_term_reference',
+      'type' => 'entity_reference',
       'settings' => array(
-        'allowed_values' => array(
-          array(
-            'vocabulary' => $this->vocabulary->id(),
-            'parent' => '0',
-          ),
-        ),
-      )
+        'target_type' => 'taxonomy_term',
+      ),
     );
     field_create_field($this->field);
     $this->instance = array(
@@ -77,11 +72,20 @@ protected function setUp() {
       'widget' => array(
         'type' => 'options_select',
       ),
+      'settings' => array(
+        'handler' => 'default',
+        'handler_settings' => array(
+          'target_bundles' => array(
+            $this->vocabulary->id(),
+          ),
+          'auto_create' => TRUE,
+        ),
+      ),
     );
     field_create_instance($this->instance);
     entity_get_display('node', 'page', 'full')
       ->setComponent($this->field_name, array(
-        'type' => 'taxonomy_term_reference_link',
+        'type' => 'entity_reference_label',
       ))
       ->save();
 
@@ -93,7 +97,7 @@ protected function setUp() {
       $term = $this->createTerm($this->vocabulary);
 
       $values = array('created' => $time, 'type' => 'page');
-      $values[$this->field_name][LANGUAGE_NOT_SPECIFIED][]['tid'] = $term->tid;
+      $values[$this->field_name][LANGUAGE_NOT_SPECIFIED][]['target_id'] = $term->tid;
 
       // Make every other node promoted.
       if ($i % 2) {
diff --git a/core/modules/views/lib/Drupal/views/Tests/Wizard/TaggedWithTest.php b/core/modules/views/lib/Drupal/views/Tests/Wizard/TaggedWithTest.php
index 6416193..1dfda5d 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Wizard/TaggedWithTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Wizard/TaggedWithTest.php
@@ -55,15 +55,10 @@ function setUp() {
     // Create the tag field itself.
     $this->tag_field = array(
       'field_name' => 'field_views_testing_tags',
-      'type' => 'taxonomy_term_reference',
+      'type' => 'entity_reference',
       'cardinality' => FIELD_CARDINALITY_UNLIMITED,
       'settings' => array(
-        'allowed_values' => array(
-          array(
-            'vocabulary' => $this->tag_vocabulary->id(),
-            'parent' => 0,
-          ),
-        ),
+        'target_type' => 'taxonomy_term',
       ),
     );
     field_create_field($this->tag_field);
@@ -75,20 +70,29 @@ function setUp() {
       'entity_type' => 'node',
       'bundle' => $this->node_type_with_tags->type,
       'widget' => array(
-        'type' => 'taxonomy_autocomplete',
+        'type' => 'entity_reference_autocomplete_tags',
+      ),
+      'settings' => array(
+        'handler' => 'default',
+        'handler_settings' => array(
+          'target_bundles' => array(
+            $this->tag_vocabulary->id(),
+          ),
+          'auto_create' => TRUE,
+        ),
       ),
     );
     field_create_instance($this->tag_instance);
 
     entity_get_display('node', $this->node_type_with_tags->type, 'default')
       ->setComponent('field_views_testing_tags', array(
-        'type' => 'taxonomy_term_reference_link',
+        'type' => 'entity_reference_label',
         'weight' => 10,
       ))
       ->save();
     entity_get_display('node', $this->node_type_with_tags->type, 'teaser')
       ->setComponent('field_views_testing_tags', array(
-        'type' => 'taxonomy_term_reference_link',
+        'type' => 'entity_reference_label',
         'weight' => 10,
       ))
       ->save();
@@ -103,7 +107,7 @@ function testTaggedWith() {
     $node_add_path = 'node/add/' . $this->node_type_with_tags->type;
 
     // Create three nodes, with different tags.
-    $tag_field = $this->tag_field['field_name'] . '[' . LANGUAGE_NOT_SPECIFIED . ']';
+    $tag_field = $this->tag_field['field_name'] . '[' . LANGUAGE_NOT_SPECIFIED . '][target_id]';
     $edit = array();
     $edit['title'] = $node_tag1_title = $this->randomName();
     $edit[$tag_field] = 'tag1';
diff --git a/core/modules/views/views_ui/admin.inc b/core/modules/views/views_ui/admin.inc
index d769edc..36283f0 100644
--- a/core/modules/views/views_ui/admin.inc
+++ b/core/modules/views/views_ui/admin.inc
@@ -246,23 +246,15 @@ function views_ui_nojs_submit($form, &$form_state) {
 function views_ui_taxonomy_autocomplete_validate($element, &$form_state) {
   $value = array();
   if ($tags = $element['#value']) {
-    // Get the machine names of the vocabularies we will search, keyed by the
-    // vocabulary IDs.
     $field = field_info_field($element['#field_name']);
-    $vocabularies = array();
-    if (!empty($field['settings']['allowed_values'])) {
-      foreach ($field['settings']['allowed_values'] as $tree) {
-        if ($vocabulary = entity_load('taxonomy_vocabulary', $tree['vocabulary'])) {
-          $vocabularies[$vocabulary->id()] = $tree['vocabulary'];
-        }
-      }
-    }
+    $instance = $element['#field_instance'];
+    $handler = entity_reference_get_selection_handler($field, $instance);
+
     // Store the term ID of each (valid) tag that the user typed.
     $typed_terms = drupal_explode_tags($tags);
     foreach ($typed_terms as $typed_term) {
-      if ($terms = entity_load_multiple_by_properties('taxonomy_term', array('name' => trim($typed_term), 'vid' => array_keys($vocabularies)))) {
-        $term = array_pop($terms);
-        $value['tids'][] = $term->tid;
+      if ($entity_id = $handler->validateAutocompleteInput($typed_term, $element, $form_state, NULL, FALSE)) {
+        $value['tids'][] = $entity_id;
       }
     }
     // Store the term IDs along with the name of the vocabulary. Currently
@@ -271,7 +263,7 @@ function views_ui_taxonomy_autocomplete_validate($element, &$form_state) {
     // one.
     if (!empty($value['tids'])) {
       $value['tids'] = array_unique($value['tids']);
-      $value['vocabulary'] = array_pop($vocabularies);
+      $value['vocabulary'] = array_pop($instance['settings']['handler_settings']['target_bundles']);
     }
   }
   form_set_value($element, $value, $form_state);
diff --git a/core/profiles/standard/standard.info b/core/profiles/standard/standard.info
index 2773abe..05db08e 100644
--- a/core/profiles/standard/standard.info
+++ b/core/profiles/standard/standard.info
@@ -13,6 +13,7 @@ dependencies[] = contextual
 dependencies[] = contact
 dependencies[] = custom_block
 dependencies[] = edit
+dependencies[] = entity_reference
 dependencies[] = help
 dependencies[] = image
 dependencies[] = menu
diff --git a/core/profiles/standard/standard.install b/core/profiles/standard/standard.install
index 8802bbc..f58f578 100644
--- a/core/profiles/standard/standard.install
+++ b/core/profiles/standard/standard.install
@@ -105,16 +105,11 @@ function standard_install() {
 
   $field = array(
     'field_name' => 'field_' . $vocabulary->id(),
-    'type' => 'taxonomy_term_reference',
+    'type' => 'entity_reference',
     // Set cardinality to unlimited for tagging.
     'cardinality' => FIELD_CARDINALITY_UNLIMITED,
     'settings' => array(
-      'allowed_values' => array(
-        array(
-          'vocabulary' => $vocabulary->id(),
-          'parent' => 0,
-        ),
-      ),
+      'target_type' => 'taxonomy_term',
     ),
   );
   field_create_field($field);
@@ -126,22 +121,33 @@ function standard_install() {
     'bundle' => 'article',
     'description' => $vocabulary->help,
     'widget' => array(
-      'type' => 'taxonomy_autocomplete',
+      'type' => 'entity_reference_autocomplete_tags',
       'weight' => -4,
     ),
+    'settings' => array(
+      'handler' => 'default',
+      'handler_settings' => array(
+        'target_bundles' => array(
+          $vocabulary->id(),
+        ),
+        'auto_create' => TRUE,
+      ),
+    ),
   );
   field_create_instance($instance);
 
   // Assign display settings for the 'default' and 'teaser' view modes.
   entity_get_display('node', 'article', 'default')
     ->setComponent($instance['field_name'], array(
-      'type' => 'taxonomy_term_reference_link',
+      'type' => 'entity_reference_label',
+      'settings' => array('link' => TRUE),
       'weight' => 10,
     ))
     ->save();
   entity_get_display('node', 'article', 'teaser')
     ->setComponent($instance['field_name'], array(
-      'type' => 'taxonomy_term_reference_link',
+      'type' => 'entity_reference_label',
+      'settings' => array('link' => TRUE),
       'weight' => 10,
     ))
     ->save();
diff --git a/core/themes/bartik/css/style-rtl.css b/core/themes/bartik/css/style-rtl.css
index dc7c2a4..22994c2 100644
--- a/core/themes/bartik/css/style-rtl.css
+++ b/core/themes/bartik/css/style-rtl.css
@@ -88,11 +88,11 @@ ul.tips {
   margin-left: 20px;
   margin-right: 0;
 }
-.field-type-taxonomy-term-reference .field-label {
+.field-type-entity-reference .field-label {
   padding-left: 5px;
   padding-right: 0;
 }
-.field-type-taxonomy-term-reference ul.links li {
+.field-type-entity-reference ul.links li {
   padding: 0 0 0 1em;
   float: right;
 }
diff --git a/core/themes/bartik/css/style.css b/core/themes/bartik/css/style.css
index 44deab1..3de06e0 100644
--- a/core/themes/bartik/css/style.css
+++ b/core/themes/bartik/css/style.css
@@ -117,7 +117,7 @@ ul.contextual-links,
 ul.links,
 ul.primary,
 .item-list .pager,
-div.field-type-taxonomy-term-reference,
+div.field-type-entity-reference,
 div.messages,
 div.meta,
 p.comment-time,
@@ -626,28 +626,28 @@ h1#page-title {
   float: left; /* LTR */
   margin: 1px 20px 0 0; /* LTR */
 }
-.field-type-taxonomy-term-reference {
+.field-type-entity-reference {
   margin: 0 0 1.2em;
 }
-.field-type-taxonomy-term-reference .field-label {
+.field-type-entity-reference .field-label {
   font-weight: normal;
   margin: 0;
   padding-right: 5px; /* LTR */
 }
-.field-type-taxonomy-term-reference .field-label,
-.field-type-taxonomy-term-reference ul.links {
+.field-type-entity-reference .field-label,
+.field-type-entity-reference ul.links {
   font-size: 0.8em;
 }
-.view-mode-teaser .field-type-taxonomy-term-reference .field-label,
-.view-mode-teaser .field-type-taxonomy-term-reference ul.links {
+.view-mode-teaser .field-type-entity-reference .field-label,
+.view-mode-teaser .field-type-entity-reference ul.links {
   font-size: 0.821em;
 }
-.field-type-taxonomy-term-reference ul.links {
+.field-type-entity-reference ul.links {
   padding: 0;
   margin: 0;
   list-style: none;
 }
-.field-type-taxonomy-term-reference ul.links li {
+.field-type-entity-reference ul.links li {
   float: left; /* LTR */
   padding: 0 1em 0 0; /* LTR */
   white-space: nowrap;
diff --git a/core/themes/bartik/template.php b/core/themes/bartik/template.php
index 9a6c8a9..39e06aa 100644
--- a/core/themes/bartik/template.php
+++ b/core/themes/bartik/template.php
@@ -130,7 +130,7 @@ function bartik_menu_tree($variables) {
 /**
  * Implements theme_field__field_type().
  */
-function bartik_field__taxonomy_term_reference($variables) {
+function bartik_field__entity_reference($variables) {
   $output = '';
 
   // Render the label, if it's not hidden.
