diff --git a/core/assets/vendor/domready/ready.min.js b/core/assets/vendor/domready/ready.min.js
index 0d681c7..bbfc255 100644
--- a/core/assets/vendor/domready/ready.min.js
+++ b/core/assets/vendor/domready/ready.min.js
@@ -1,4 +1,4 @@
 /*!
- * domready (c) Dustin Diaz 2012 - License MIT
- */
-!function(e,t){typeof module!="undefined"?module.exports=t():typeof define=="function"&&typeof define.amd=="object"?define(t):this[e]=t()}("domready",function(e){function p(e){h=1;while(e=t.shift())e()}var t=[],n,r=!1,i=document,s=i.documentElement,o=s.doScroll,u="DOMContentLoaded",a="addEventListener",f="onreadystatechange",l="readyState",c=o?/^loaded|^c/:/^loaded|c/,h=c.test(i[l]);return i[a]&&i[a](u,n=function(){i.removeEventListener(u,n,r),p()},r),o&&i.attachEvent(f,n=function(){/^c/.test(i[l])&&(i.detachEvent(f,n),p())}),e=o?function(n){self!=top?h?n():t.push(n):function(){try{s.doScroll("left")}catch(t){return setTimeout(function(){e(n)},50)}n()}()}:function(e){h?e():t.push(e)}})
+  * domready (c) Dustin Diaz 2012 - License MIT
+  */
+!function(a,ctx,b){typeof module!="undefined"?module.exports=b():typeof define=="function"&&typeof define.amd=="object"?define(b):ctx[a]=b()}("domready",this,function(a){function m(a){l=1;while(a=b.shift())a()}var b=[],c,d=!1,e=document,f=e.documentElement,g=f.doScroll,h="DOMContentLoaded",i="addEventListener",j="onreadystatechange",k="readyState",l=/^loade|c/.test(e[k]);return e[i]&&e[i](h,c=function(){e.removeEventListener(h,c,d),m()},d),g&&e.attachEvent(j,c=function(){/^c/.test(e[k])&&(e.detachEvent(j,c),m())}),a=g?function(c){self!=top?l?c():b.push(c):function(){try{f.doScroll("left")}catch(b){return setTimeout(function(){a(c)},50)}c()}()}:function(a){l?a():b.push(a)}})
diff --git a/core/core.services.yml b/core/core.services.yml
index 640440b..d915e10 100644
--- a/core/core.services.yml
+++ b/core/core.services.yml
@@ -65,8 +65,6 @@ services:
   config.storage:
     class: Drupal\Core\Config\CachedStorage
     arguments: ['@config.cachedstorage.storage', '@cache.config']
-    tags:
-      - { name: persist }
   config.context.factory:
     class: Drupal\Core\Config\Context\ConfigContextFactory
     arguments: ['@event_dispatcher']
@@ -169,12 +167,6 @@ services:
   plugin.manager.action:
     class: Drupal\Core\Action\ActionManager
     arguments: ['@container.namespaces']
-  plugin.manager.menu.local_action:
-    class: Drupal\Core\Menu\LocalActionManager
-    arguments: ['@container.namespaces', '@controller_resolver', '@request', '@module_handler']
-  plugin.manager.menu.local_task:
-    class: Drupal\Core\Menu\LocalTaskManager
-    arguments: ['@container.namespaces', '@controller_resolver', '@request', '@router.route_provider', '@module_handler']
   request:
     class: Symfony\Component\HttpFoundation\Request
     # @TODO the synthetic setting must be uncommented whenever drupal_session_initialize()
@@ -496,7 +488,7 @@ services:
     arguments: ['@module_handler']
   date:
     class: Drupal\Core\Datetime\Date
-    arguments: ['@plugin.manager.entity', '@language_manager']
+    arguments: ['@config.factory', '@language_manager']
   feed.bridge.reader:
     class: Drupal\Component\Bridge\ZfExtensionManagerSfContainer
     calls:
@@ -567,25 +559,3 @@ services:
     tags:
       - { name: event_subscriber }
     arguments: ['@authentication']
-  asset.css.collection_renderer:
-    class: Drupal\Core\Asset\CssCollectionRenderer
-  asset.css.collection_optimizer:
-    class: Drupal\Core\Asset\CssCollectionOptimizer
-    arguments: [ '@asset.css.collection_grouper', '@asset.css.optimizer', '@asset.css.dumper', '@state' ]
-  asset.css.optimizer:
-    class: Drupal\Core\Asset\CssOptimizer
-  asset.css.collection_grouper:
-    class: Drupal\Core\Asset\CssCollectionGrouper
-  asset.css.dumper:
-    class: Drupal\Core\Asset\AssetDumper
-  asset.js.collection_renderer:
-    class: Drupal\Core\Asset\JsCollectionRenderer
-  asset.js.collection_optimizer:
-    class: Drupal\Core\Asset\JsCollectionOptimizer
-    arguments: [ '@asset.js.collection_grouper', '@asset.js.optimizer', '@asset.js.dumper', '@state' ]
-  asset.js.optimizer:
-    class: Drupal\Core\Asset\JsOptimizer
-  asset.js.collection_grouper:
-    class: Drupal\Core\Asset\JsCollectionGrouper
-  asset.js.dumper:
-    class: Drupal\Core\Asset\AssetDumper
diff --git a/core/includes/batch.inc b/core/includes/batch.inc
index 569ce58..27fb632 100644
--- a/core/includes/batch.inc
+++ b/core/includes/batch.inc
@@ -86,9 +86,9 @@ function _batch_page() {
  */
 function _batch_do() {
   // Perform actual processing.
-  list($percentage, $message, $label) = _batch_process();
+  list($percentage, $message) = _batch_process();
 
-  return new JsonResponse(array('status' => TRUE, 'percentage' => $percentage, 'message' => $message, 'label' => $label));
+  return new JsonResponse(array('status' => TRUE, 'percentage' => $percentage, 'message' => $message));
 }
 
 /**
@@ -108,7 +108,6 @@ function _batch_progress_page() {
     // This is the first page so we return some output immediately.
     $percentage       = 0;
     $message          = $current_set['init_message'];
-    $label            = '';
     $batch['running'] = TRUE;
   }
   else {
@@ -129,7 +128,7 @@ function _batch_progress_page() {
     print $fallback;
 
     // Perform actual processing.
-    list($percentage, $message, $label) = _batch_process($batch);
+    list($percentage, $message) = _batch_process($batch);
     if ($percentage == 100) {
       $new_op = 'finished';
     }
@@ -167,7 +166,7 @@ function _batch_progress_page() {
   drupal_add_js($js_setting, 'setting');
   drupal_add_library('system', 'drupal.batch');
 
-  return theme('progress_bar', array('percent' => $percentage, 'message' => $message, 'label' => $label));
+  return theme('progress_bar', array('percent' => $percentage, 'message' => $message));
 }
 
 /**
@@ -209,7 +208,7 @@ function _batch_process() {
       include_once DRUPAL_ROOT . '/' . $current_set['file'];
     }
 
-    $task_message = $label = '';
+    $task_message = '';
     // Assume a single pass operation and set the completion level to 1 by
     // default.
     $finished = 1;
@@ -297,11 +296,14 @@ function _batch_process() {
       '@estimate'   => ($current > 0) ? format_interval(($elapsed * ($total - $current) / $current) / 1000) : '-',
     );
     $message = strtr($progress_message, $values);
+    if (!empty($message)) {
+      $message .= '<br />';
+    }
     if (!empty($task_message)) {
-      $label = $task_message;
+      $message .= $task_message;
     }
 
-    return array($percentage, $message, $label);
+    return array($percentage, $message);
   }
   else {
     // If we are not in progressive mode, the entire batch has been processed.
diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc
index 9daa71a..5b8553d 100644
--- a/core/includes/bootstrap.inc
+++ b/core/includes/bootstrap.inc
@@ -713,7 +713,7 @@ function drupal_settings_initialize() {
  *
  * This function plays a key role in allowing Drupal's resources (modules
  * and themes) to be located in different places depending on a site's
- * configuration. For example, a module 'foo' may legally be located
+ * configuration. For example, a module 'foo' may legally be be located
  * in any of these three places:
  *
  * core/modules/foo/foo.module
@@ -724,7 +724,7 @@ function drupal_settings_initialize() {
  * the above, depending on where the module is located.
  *
  * @param $type
- *   The type of the item (theme, theme_engine, module, profile).
+ *   The type of the item (i.e. theme, theme_engine, module, profile).
  * @param $name
  *   The name of the item for which the filename is requested.
  * @param $filename
@@ -1550,7 +1550,7 @@ function watchdog($type, $message, array $variables = NULL, $severity = WATCHDOG
     $in_error_state = TRUE;
 
     // The user object may not exist in all conditions, so 0 is substituted if needed.
-    $user_uid = isset($user) ? $user->id() : 0;
+    $user_uid = isset($user->uid) ? $user->uid : 0;
 
     // Prepare the fields to be logged
     $log_entry = array(
@@ -1898,7 +1898,7 @@ function drupal_get_user_timezone() {
   global $user;
   $config = config('system.timezone');
 
-  if ($user && $config->get('user.configurable') && $user->id() && $user->timezone) {
+  if ($user && $config->get('user.configurable') && $user->uid && $user->timezone) {
     return $user->timezone;
   }
   else {
@@ -2024,7 +2024,12 @@ function _drupal_bootstrap_kernel() {
 function _drupal_bootstrap_page_cache() {
   global $user;
 
+  // Allow specifying special cache handlers in settings.php, like
+  // using memcached or files for storing cache information.
   require_once __DIR__ . '/cache.inc';
+  foreach (variable_get('cache_backends', array()) as $include) {
+    require_once DRUPAL_ROOT . '/' . $include;
+  }
   // Check for a cache mode force from settings.php.
   if (settings()->get('page_cache_without_database')) {
     $cache_enabled = TRUE;
@@ -2404,10 +2409,8 @@ function language($type) {
  *   name and its value is its configurability (TRUE/FALSE).
  */
 function language_types_get_all() {
-  $types = \Drupal::config('system.language.types')->get('all');
-  return $types ? $types : array_keys(language_types_get_default());
+  return array_keys(variable_get('language_types', language_types_get_default()));
 }
-
 /**
  * Returns a list of the built-in language types.
  *
diff --git a/core/includes/common.inc b/core/includes/common.inc
index a4805c0..e768bf4 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -8,17 +8,23 @@
 use Drupal\Component\Utility\Xss;
 use Drupal\Core\Cache\Cache;
 use Drupal\Core\Language\Language;
+use Symfony\Component\DependencyInjection\Container;
+use Symfony\Component\HttpFoundation\RedirectResponse;
 use Symfony\Component\Yaml\Parser;
 use Symfony\Component\HttpFoundation\Response;
 use Symfony\Component\HttpFoundation\Request;
 use Drupal\Component\PhpStorage\PhpStorageFactory;
 use Drupal\Component\Utility\MapArray;
 use Drupal\Component\Utility\NestedArray;
+use Drupal\Component\Utility\Unicode;
 use Drupal\Core\Cache\CacheBackendInterface;
 use Drupal\Core\Datetime\DrupalDateTime;
+use Drupal\Core\Database\Database;
 use Drupal\Core\Routing\GeneratorNotInitializedException;
 use Drupal\Core\SystemListingInfo;
 use Drupal\Core\Template\Attribute;
+use Zend\Feed\Writer\Writer;
+use Zend\Feed\Reader\Reader;
 
 /**
  * @file
@@ -1794,6 +1800,154 @@ function drupal_sort_css_js($a, $b) {
 }
 
 /**
+ * Grouping callback: Groups CSS items by their types, media, and browsers.
+ *
+ * This function arranges the CSS items that are in the #items property of the
+ * styles element into groups. Arranging the CSS items into groups serves two
+ * purposes. When aggregation is enabled, files within a group are aggregated
+ * into a single file, significantly improving page loading performance by
+ * minimizing network traffic overhead. When aggregation is disabled, grouping
+ * allows multiple files to be loaded from a single STYLE tag, enabling sites
+ * with many modules enabled or a complex theme being used to stay within IE's
+ * 31 CSS inclusion tag limit: http://drupal.org/node/228818.
+ *
+ * This function puts multiple items into the same group if they are groupable
+ * and if they are for the same 'media' and 'browsers'. Items of the 'file' type
+ * are groupable if their 'preprocess' flag is TRUE, items of the 'inline' type
+ * are always groupable, and items of the 'external' type are never groupable.
+ * This function also ensures that the process of grouping items does not change
+ * their relative order. This requirement may result in multiple groups for the
+ * same type, media, and browsers, if needed to accommodate other items in
+ * between.
+ *
+ * @param $css
+ *   An array of CSS items, as returned by drupal_add_css(), but after
+ *   alteration performed by drupal_get_css().
+ *
+ * @return
+ *   An array of CSS groups. Each group contains the same keys (e.g., 'media',
+ *   'data', etc.) as a CSS item from the $css parameter, with the value of
+ *   each key applying to the group as a whole. Each group also contains an
+ *   'items' key, which is the subset of items from $css that are in the group.
+ *
+ * @see drupal_pre_render_styles()
+ * @see system_element_info()
+ */
+function drupal_group_css($css) {
+  $groups = array();
+  // If a group can contain multiple items, we track the information that must
+  // be the same for each item in the group, so that when we iterate the next
+  // item, we can determine if it can be put into the current group, or if a
+  // new group needs to be made for it.
+  $current_group_keys = NULL;
+  // When creating a new group, we pre-increment $i, so by initializing it to
+  // -1, the first group will have index 0.
+  $i = -1;
+  foreach ($css as $item) {
+    // The browsers for which the CSS item needs to be loaded is part of the
+    // information that determines when a new group is needed, but the order of
+    // keys in the array doesn't matter, and we don't want a new group if all
+    // that's different is that order.
+    ksort($item['browsers']);
+
+    // If the item can be grouped with other items, set $group_keys to an array
+    // of information that must be the same for all items in its group. If the
+    // item can't be grouped with other items, set $group_keys to FALSE. We
+    // put items into a group that can be aggregated together: whether they will
+    // be aggregated is up to the _drupal_css_aggregate() function or an
+    // override of that function specified in hook_css_alter(), but regardless
+    // of the details of that function, a group represents items that can be
+    // aggregated. Since a group may be rendered with a single HTML tag, all
+    // items in the group must share the same information that would need to be
+    // part of that HTML tag.
+    switch ($item['type']) {
+      case 'file':
+        // Group file items if their 'preprocess' flag is TRUE.
+        // Help ensure maximum reuse of aggregate files by only grouping
+        // together items that share the same 'group' value and 'every_page'
+        // flag. See drupal_add_css() for details about that.
+        $group_keys = $item['preprocess'] ? array($item['type'], $item['group'], $item['every_page'], $item['media'], $item['browsers']) : FALSE;
+        break;
+      case 'inline':
+        // Always group inline items.
+        $group_keys = array($item['type'], $item['media'], $item['browsers']);
+        break;
+      case 'external':
+        // Do not group external items.
+        $group_keys = FALSE;
+        break;
+    }
+
+    // If the group keys don't match the most recent group we're working with,
+    // then a new group must be made.
+    if ($group_keys !== $current_group_keys) {
+      $i++;
+      // Initialize the new group with the same properties as the first item
+      // being placed into it. The item's 'data' and 'weight' properties are
+      // unique to the item and should not be carried over to the group.
+      $groups[$i] = $item;
+      unset($groups[$i]['data'], $groups[$i]['weight']);
+      $groups[$i]['items'] = array();
+      $current_group_keys = $group_keys ? $group_keys : NULL;
+    }
+
+    // Add the item to the current group.
+    $groups[$i]['items'][] = $item;
+  }
+  return $groups;
+}
+
+/**
+ * Aggregation callback: Aggregates CSS files and inline content.
+ *
+ * Having the browser load fewer CSS files results in much faster page loads
+ * than when it loads many small files. This function aggregates files within
+ * the same group into a single file unless the site-wide setting to do so is
+ * disabled (commonly the case during site development). To optimize download,
+ * it also compresses the aggregate files by removing comments, whitespace, and
+ * other unnecessary content. Additionally, this functions aggregates inline
+ * content together, regardless of the site-wide aggregation setting.
+ *
+ * @param $css_groups
+ *   An array of CSS groups as returned by drupal_group_css(). This function
+ *   modifies the group's 'data' property for each group that is aggregated.
+ *
+ * @see drupal_group_css()
+ * @see drupal_pre_render_styles()
+ * @see system_element_info()
+ */
+function drupal_aggregate_css(&$css_groups) {
+  // Only aggregate during normal site operation.
+  if (defined('MAINTENANCE_MODE')) {
+    $preprocess_css = FALSE;
+  }
+  else {
+    $config = config('system.performance');
+    $preprocess_css = $config->get('css.preprocess');
+  }
+
+  // For each group that needs aggregation, aggregate its items.
+  foreach ($css_groups as $key => $group) {
+    switch ($group['type']) {
+      // If a file group can be aggregated into a single file, do so, and set
+      // the group's data property to the file path of the aggregate file.
+      case 'file':
+        if ($group['preprocess'] && $preprocess_css) {
+          $css_groups[$key]['data'] = drupal_build_css_cache($group['items']);
+        }
+        break;
+      // Aggregate all inline CSS content into the group's data property.
+      case 'inline':
+        $css_groups[$key]['data'] = '';
+        foreach ($group['items'] as $item) {
+          $css_groups[$key]['data'] .= drupal_load_stylesheet_content($item['data'], $item['preprocess']);
+        }
+        break;
+    }
+  }
+}
+
+/**
  * Pre-render callback: Adds the elements needed for CSS tags to be rendered.
  *
  * For production websites, LINK tags are preferable to STYLE tags with @import
@@ -1843,6 +1997,11 @@ function drupal_sort_css_js($a, $b) {
  *   A render array containing:
  *   - '#items': The CSS items as returned by drupal_add_css() and altered by
  *     drupal_get_css().
+ *   - '#group_callback': A function to call to group #items to enable the use
+ *     of fewer tags by aggregating files and/or using multiple @import
+ *     statements within a single tag.
+ *   - '#aggregate_callback': A function to call to aggregate the items within
+ *     the groups arranged by the #group_callback function.
  *
  * @return
  *   A render array that will render to a string of XHTML CSS tags.
@@ -1850,13 +2009,393 @@ function drupal_sort_css_js($a, $b) {
  * @see drupal_get_css()
  */
 function drupal_pre_render_styles($elements) {
-  $css_assets = $elements['#items'];
+  // Group and aggregate the items.
+  if (isset($elements['#group_callback'])) {
+    $elements['#groups'] = $elements['#group_callback']($elements['#items']);
+  }
+  if (isset($elements['#aggregate_callback'])) {
+    $elements['#aggregate_callback']($elements['#groups']);
+  }
 
-  // Aggregate the CSS if necessary, but only during normal site operation.
-  if (!defined('MAINTENANCE_MODE') && config('system.performance')->get('css.preprocess')) {
-    $css_assets = \Drupal::service('asset.css.collection_optimizer')->optimize($css_assets);
+  // A dummy query-string is added to filenames, to gain control over
+  // browser-caching. The string changes on every update or full cache
+  // flush, forcing browsers to load a new copy of the files, as the
+  // URL changed.
+  $query_string = variable_get('css_js_query_string', '0');
+
+  // For inline CSS to validate as XHTML, all CSS containing XHTML needs to be
+  // wrapped in CDATA. To make that backwards compatible with HTML 4, we need to
+  // comment out the CDATA-tag.
+  $embed_prefix = "\n/* <![CDATA[ */\n";
+  $embed_suffix = "\n/* ]]> */\n";
+
+  // Defaults for LINK and STYLE elements.
+  $link_element_defaults = array(
+    '#type' => 'html_tag',
+    '#tag' => 'link',
+    '#attributes' => array(
+      'rel' => 'stylesheet',
+    ),
+  );
+  $style_element_defaults = array(
+    '#type' => 'html_tag',
+    '#tag' => 'style',
+  );
+
+  // Loop through each group.
+  foreach ($elements['#groups'] as $group) {
+    switch ($group['type']) {
+      // For file items, there are three possibilites.
+      // - The group has been aggregated: in this case, output a LINK tag for
+      //   the aggregate file.
+      // - The group can be aggregated but has not been (most likely because
+      //   the site administrator disabled the site-wide setting): in this case,
+      //   output as few STYLE tags for the group as possible, using @import
+      //   statement for each file in the group. This enables us to stay within
+      //   IE's limit of 31 total CSS inclusion tags.
+      // - The group contains items not eligible for aggregation (their
+      //   'preprocess' flag has been set to FALSE): in this case, output a LINK
+      //   tag for each file.
+      case 'file':
+        // The group has been aggregated into a single file: output a LINK tag
+        // for the aggregate file.
+        if (isset($group['data'])) {
+          $element = $link_element_defaults;
+          $element['#attributes']['href'] = file_create_url($group['data']);
+          $element['#attributes']['media'] = $group['media'];
+          $element['#browsers'] = $group['browsers'];
+          $elements[] = $element;
+        }
+        // The group can be aggregated, but hasn't been: combine multiple items
+        // into as few STYLE tags as possible.
+        elseif ($group['preprocess']) {
+          $import = array();
+          foreach ($group['items'] as $item) {
+            // The dummy query string needs to be added to the URL to control
+            // browser-caching. IE7 does not support a media type on the
+            // @import statement, so we instead specify the media for the
+            // group on the STYLE tag.
+            $import[] = '@import url("' . check_plain(file_create_url($item['data']) . '?' . $query_string) . '");';
+          }
+          // In addition to IE's limit of 31 total CSS inclusion tags, it also
+          // has a limit of 31 @import statements per STYLE tag.
+          while (!empty($import)) {
+            $import_batch = array_slice($import, 0, 31);
+            $import = array_slice($import, 31);
+            $element = $style_element_defaults;
+            // This simplifies the JavaScript regex, allowing each line
+            // (separated by \n) to be treated as a completely different string.
+            // This means that we can use ^ and $ on one line at a time, and not
+            // worry about style tags since they'll never match the regex.
+            $element['#value'] = "\n" . implode("\n", $import_batch) . "\n";
+            $element['#attributes']['media'] = $group['media'];
+            $element['#browsers'] = $group['browsers'];
+            $elements[] = $element;
+          }
+        }
+        // The group contains items ineligible for aggregation: output a LINK
+        // tag for each file.
+        else {
+          foreach ($group['items'] as $item) {
+            $element = $link_element_defaults;
+            // The dummy query string needs to be added to the URL to control
+            // browser-caching.
+            $query_string_separator = (strpos($item['data'], '?') !== FALSE) ? '&' : '?';
+            $element['#attributes']['href'] = file_create_url($item['data']) . $query_string_separator . $query_string;
+            $element['#attributes']['media'] = $item['media'];
+            $element['#browsers'] = $group['browsers'];
+            $elements[] = $element;
+          }
+        }
+        break;
+      // For inline content, the 'data' property contains the CSS content. If
+      // the group's 'data' property is set, then output it in a single STYLE
+      // tag. Otherwise, output a separate STYLE tag for each item.
+      case 'inline':
+        if (isset($group['data'])) {
+          $element = $style_element_defaults;
+          $element['#value'] = $group['data'];
+          $element['#value_prefix'] = $embed_prefix;
+          $element['#value_suffix'] = $embed_suffix;
+          $element['#attributes']['media'] = $group['media'];
+          $element['#browsers'] = $group['browsers'];
+          $elements[] = $element;
+        }
+        else {
+          foreach ($group['items'] as $item) {
+            $element = $style_element_defaults;
+            $element['#value'] = $item['data'];
+            $element['#value_prefix'] = $embed_prefix;
+            $element['#value_suffix'] = $embed_suffix;
+            $element['#attributes']['media'] = $item['media'];
+            $element['#browsers'] = $group['browsers'];
+            $elements[] = $element;
+          }
+        }
+        break;
+      // Output a LINK tag for each external item. The item's 'data' property
+      // contains the full URL.
+      case 'external':
+        foreach ($group['items'] as $item) {
+          $element = $link_element_defaults;
+          $element['#attributes']['href'] = $item['data'];
+          $element['#attributes']['media'] = $item['media'];
+          $element['#browsers'] = $group['browsers'];
+          $elements[] = $element;
+        }
+        break;
+    }
   }
-  return \Drupal::service('asset.css.collection_renderer')->render($css_assets);
+
+  return $elements;
+}
+
+/**
+ * Aggregates and optimizes CSS files into a cache file in the files directory.
+ *
+ * The file name for the CSS cache file is generated from the hash of the
+ * aggregated contents of the files in $css. This forces proxies and browsers
+ * to download new CSS when the CSS changes.
+ *
+ * The cache file name is retrieved on a page load via a lookup variable that
+ * contains an associative array. The array key is the hash of the file names
+ * in $css while the value is the cache file name. The cache file is generated
+ * in two cases. First, if there is no file name value for the key, which will
+ * happen if a new file name has been added to $css or after the lookup
+ * variable is emptied to force a rebuild of the cache. Second, the cache file
+ * is generated if it is missing on disk. Old cache files are not deleted
+ * immediately when the lookup variable is emptied, but are deleted after a set
+ * period by drupal_delete_file_if_stale(). This ensures that files referenced
+ * by a cached page will still be available.
+ *
+ * @param $css
+ *   An array of CSS files to aggregate and compress into one file.
+ *
+ * @return
+ *   The URI of the CSS cache file, or FALSE if the file could not be saved.
+ */
+function drupal_build_css_cache($css) {
+  $data = '';
+  $uri = '';
+  $map = Drupal::state()->get('drupal_css_cache_files') ?: array();
+  // Create a new array so that only the file names are used to create the hash.
+  // This prevents new aggregates from being created unnecessarily.
+  $css_data = array();
+  foreach ($css as $css_file) {
+    $css_data[] = $css_file['data'];
+  }
+  $key = hash('sha256', serialize($css_data));
+  if (isset($map[$key])) {
+    $uri = $map[$key];
+  }
+
+  if (empty($uri) || !file_exists($uri)) {
+    // Build aggregate CSS file.
+    foreach ($css as $stylesheet) {
+      // Only 'file' stylesheets can be aggregated.
+      if ($stylesheet['type'] == 'file') {
+        $contents = drupal_load_stylesheet($stylesheet['data'], TRUE);
+
+        // Get the parent directory of this file, relative to the Drupal root.
+        $css_base_url = substr($stylesheet['data'], 0, strrpos($stylesheet['data'], '/'));
+        _drupal_build_css_path(NULL, $css_base_url . '/');
+        // Anchor all paths in the CSS with its base URL, ignoring external and absolute paths.
+        $data .= preg_replace_callback('/url\(\s*[\'"]?(?![a-z]+:|\/+)([^\'")]+)[\'"]?\s*\)/i', '_drupal_build_css_path', $contents);
+      }
+    }
+
+    // Per the W3C specification at http://www.w3.org/TR/REC-CSS2/cascade.html#at-import,
+    // @import rules must proceed any other style, so we move those to the top.
+    $regexp = '/@import[^;]+;/i';
+    preg_match_all($regexp, $data, $matches);
+    $data = preg_replace($regexp, '', $data);
+    $data = implode('', $matches[0]) . $data;
+
+    // Prefix filename to prevent blocking by firewalls which reject files
+    // starting with "ad*".
+    $filename = 'css_' . Crypt::hashBase64($data) . '.css';
+    // Create the css/ within the files folder.
+    $csspath = 'public://css';
+    $uri = $csspath . '/' . $filename;
+    // Create the CSS file.
+    file_prepare_directory($csspath, FILE_CREATE_DIRECTORY);
+    if (!file_exists($uri) && !file_unmanaged_save_data($data, $uri, FILE_EXISTS_REPLACE)) {
+      return FALSE;
+    }
+    // If CSS gzip compression is enabled and the zlib extension is available
+    // then create a gzipped version of this file. This file is served
+    // conditionally to browsers that accept gzip using .htaccess rules.
+    // It's possible that the rewrite rules in .htaccess aren't working on this
+    // server, but there's no harm (other than the time spent generating the
+    // file) in generating the file anyway. Sites on servers where rewrite rules
+    // aren't working can set css.gzip to FALSE in order to skip
+    // generating a file that won't be used.
+    if (config('system.performance')->get('css.gzip') && extension_loaded('zlib')) {
+      if (!file_exists($uri . '.gz') && !file_unmanaged_save_data(gzencode($data, 9, FORCE_GZIP), $uri . '.gz', FILE_EXISTS_REPLACE)) {
+        return FALSE;
+      }
+    }
+    // Save the updated map.
+    $map[$key] = $uri;
+    Drupal::state()->set('drupal_css_cache_files', $map);
+  }
+  return $uri;
+}
+
+/**
+ * Prefixes all paths within a CSS file for drupal_build_css_cache().
+ */
+function _drupal_build_css_path($matches, $base = NULL) {
+  $_base = &drupal_static(__FUNCTION__);
+  // Store base path for preg_replace_callback.
+  if (isset($base)) {
+    $_base = $base;
+  }
+
+  // Prefix with base and remove '../' segments where possible.
+  $path = $_base . $matches[1];
+  $last = '';
+  while ($path != $last) {
+    $last = $path;
+    $path = preg_replace('`(^|/)(?!\.\./)([^/]+)/\.\./`', '$1', $path);
+  }
+  return 'url(' . file_create_url($path) . ')';
+}
+
+/**
+ * Loads the stylesheet and resolves all @import commands.
+ *
+ * Loads a stylesheet and replaces @import commands with the contents of the
+ * imported file. Use this instead of file_get_contents when processing
+ * stylesheets.
+ *
+ * The returned contents are compressed removing white space and comments only
+ * when CSS aggregation is enabled. This optimization will not apply for
+ * color.module enabled themes with CSS aggregation turned off.
+ *
+ * @param $file
+ *   Name of the stylesheet to be processed.
+ * @param $optimize
+ *   Defines if CSS contents should be compressed or not.
+ * @param $reset_basepath
+ *   Used internally to facilitate recursive resolution of @import commands.
+ *
+ * @return
+ *   Contents of the stylesheet, including any resolved @import commands.
+ */
+function drupal_load_stylesheet($file, $optimize = NULL, $reset_basepath = TRUE) {
+  // These statics are not cache variables, so we don't use drupal_static().
+  static $_optimize, $basepath;
+  if ($reset_basepath) {
+    $basepath = '';
+  }
+  // Store the value of $optimize for preg_replace_callback with nested
+  // @import loops.
+  if (isset($optimize)) {
+    $_optimize = $optimize;
+  }
+
+  // Stylesheets are relative one to each other. Start by adding a base path
+  // prefix provided by the parent stylesheet (if necessary).
+  if ($basepath && !file_uri_scheme($file)) {
+    $file = $basepath . '/' . $file;
+  }
+  $basepath = dirname($file);
+
+  // Load the CSS stylesheet. We suppress errors because themes may specify
+  // stylesheets in their .info.yml file that don't exist in the theme's path,
+  // but are merely there to disable certain module CSS files.
+  if ($contents = @file_get_contents($file)) {
+    // Return the processed stylesheet.
+    return drupal_load_stylesheet_content($contents, $_optimize);
+  }
+
+  return '';
+}
+
+/**
+ * Processes the contents of a stylesheet for aggregation.
+ *
+ * @param $contents
+ *   The contents of the stylesheet.
+ * @param $optimize
+ *   (optional) Boolean whether CSS contents should be minified. Defaults to
+ *   FALSE.
+ *
+ * @return
+ *   Contents of the stylesheet including the imported stylesheets.
+ */
+function drupal_load_stylesheet_content($contents, $optimize = FALSE) {
+  // Remove multiple charset declarations for standards compliance (and fixing Safari problems).
+  $contents = preg_replace('/^@charset\s+[\'"](\S*)\b[\'"];/i', '', $contents);
+
+  if ($optimize) {
+    // Perform some safe CSS optimizations.
+    // Regexp to match comment blocks.
+    $comment     = '/\*[^*]*\*+(?:[^/*][^*]*\*+)*/';
+    // Regexp to match double quoted strings.
+    $double_quot = '"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"';
+    // Regexp to match single quoted strings.
+    $single_quot = "'[^'\\\\]*(?:\\\\.[^'\\\\]*)*'";
+    // Strip all comment blocks, but keep double/single quoted strings.
+    $contents = preg_replace(
+      "<($double_quot|$single_quot)|$comment>Ss",
+      "$1",
+      $contents
+    );
+    // Remove certain whitespace.
+    // There are different conditions for removing leading and trailing
+    // whitespace.
+    // @see http://php.net/manual/regexp.reference.subpatterns.php
+    $contents = preg_replace('<
+      # Strip leading and trailing whitespace.
+        \s*([@{};,])\s*
+      # Strip only leading whitespace from:
+      # - Closing parenthesis: Retain "@media (bar) and foo".
+      | \s+([\)])
+      # Strip only trailing whitespace from:
+      # - Opening parenthesis: Retain "@media (bar) and foo".
+      # - Colon: Retain :pseudo-selectors.
+      | ([\(:])\s+
+    >xS',
+      // Only one of the three capturing groups will match, so its reference
+      // will contain the wanted value and the references for the
+      // two non-matching groups will be replaced with empty strings.
+      '$1$2$3',
+      $contents
+    );
+    // End the file with a new line.
+    $contents = trim($contents);
+    $contents .= "\n";
+  }
+
+  // Replaces @import commands with the actual stylesheet content.
+  // This happens recursively but omits external files.
+  $contents = preg_replace_callback('/@import\s*(?:url\(\s*)?[\'"]?(?![a-z]+:)([^\'"\()]+)[\'"]?\s*\)?\s*;/', '_drupal_load_stylesheet', $contents);
+  return $contents;
+}
+
+/**
+ * Loads stylesheets recursively and returns contents with corrected paths.
+ *
+ * This function is used for recursive loading of stylesheets and
+ * returns the stylesheet content with all url() paths corrected.
+ */
+function _drupal_load_stylesheet($matches) {
+  $filename = $matches[1];
+  // Load the imported stylesheet and replace @import commands in there as well.
+  $file = drupal_load_stylesheet($filename, NULL, FALSE);
+
+  // Determine the file's directory.
+  $directory = dirname($filename);
+  // If the file is in the current directory, make sure '.' doesn't appear in
+  // the url() path.
+  $directory = $directory == '.' ? '' : $directory .'/';
+
+  // Alter all internal url() paths. Leave external paths alone. We don't need
+  // to normalize absolute paths here (i.e. remove folder/... segments) because
+  // that will be done later.
+  return preg_replace('/url\(\s*([\'"]?)(?![a-z]+:|\/+)/i', 'url(\1'. $directory, $file);
 }
 
 /**
@@ -2478,14 +3017,214 @@ function drupal_merge_js_settings($settings_items) {
  * @see drupal_get_js()
  */
 function drupal_pre_render_scripts($elements) {
-  $js_assets = $elements['#items'];
+  // Group and aggregate the items.
+  if (isset($elements['#group_callback'])) {
+    $elements['#groups'] = $elements['#group_callback']($elements['#items']);
+  }
+  if (isset($elements['#aggregate_callback'])) {
+    $elements['#aggregate_callback']($elements['#groups']);
+  }
+
+  // A dummy query-string is added to filenames, to gain control over
+  // browser-caching. The string changes on every update or full cache
+  // flush, forcing browsers to load a new copy of the files, as the
+  // URL changed. Files that should not be cached (see drupal_add_js())
+  // get REQUEST_TIME as query-string instead, to enforce reload on every
+  // page request.
+  $default_query_string = variable_get('css_js_query_string', '0');
+
+  // For inline JavaScript to validate as XHTML, all JavaScript containing
+  // XHTML needs to be wrapped in CDATA. To make that backwards compatible
+  // with HTML 4, we need to comment out the CDATA-tag.
+  $embed_prefix = "\n<!--//--><![CDATA[//><!--\n";
+  $embed_suffix = "\n//--><!]]>\n";
+
+  // Since JavaScript may look for arguments in the URL and act on them, some
+  // third-party code might require the use of a different query string.
+  $js_version_string = variable_get('drupal_js_version_query_string', 'v=');
+
+  // Defaults for each SCRIPT element.
+  $element_defaults = array(
+    '#type' => 'html_tag',
+    '#tag' => 'script',
+    '#value' => '',
+  );
+
+  // Loop through each group.
+  foreach ($elements['#groups'] as $group) {
+    // If a group of files has been aggregated into a single file,
+    // $group['data'] contains the URI of the aggregate file. Add a single
+    // script element for this file.
+    if ($group['type'] == 'file' && isset($group['data'])) {
+      $element = $element_defaults;
+      $element['#attributes']['src'] = file_create_url($group['data']);
+      $element['#browsers'] = $group['browsers'];
+      $elements[] = $element;
+    }
+    // For non-file types, and non-aggregated files, add a script element per
+    // item.
+    else {
+      foreach ($group['items'] as $item) {
+        // Element properties that do not depend on item type.
+        $element = $element_defaults;
+        $element['#browsers'] = $item['browsers'];
+
+        // Element properties that depend on item type.
+        switch ($item['type']) {
+          case 'setting':
+            $element['#value_prefix'] = $embed_prefix;
+            $element['#value'] = 'var drupalSettings = ' . drupal_json_encode(drupal_merge_js_settings($item['data'])) . ";";
+            $element['#value_suffix'] = $embed_suffix;
+            break;
+
+          case 'inline':
+            $element['#value_prefix'] = $embed_prefix;
+            $element['#value'] = $item['data'];
+            $element['#value_suffix'] = $embed_suffix;
+            break;
+
+          case 'file':
+            $query_string = empty($item['version']) ? $default_query_string : $js_version_string . $item['version'];
+            $query_string_separator = (strpos($item['data'], '?') !== FALSE) ? '&' : '?';
+            $element['#attributes']['src'] = file_create_url($item['data']) . $query_string_separator . ($item['cache'] ? $query_string : REQUEST_TIME);
+            break;
+
+          case 'external':
+            $element['#attributes']['src'] = $item['data'];
+            break;
+        }
+
+        // Attributes may only be set if this script is output independently.
+        if (!empty($element['#attributes']['src']) && !empty($item['attributes'])) {
+          $element['#attributes'] += $item['attributes'];
+        }
+
+        $elements[] = $element;
+      }
+    }
+  }
+
+  return $elements;
+}
+
+/**
+ * Default callback to group JavaScript items.
+ *
+ * This function arranges the JavaScript items that are in the #items property
+ * of the scripts element into groups. When aggregation is enabled, files within
+ * a group are aggregated into a single file, significantly improving page
+ * loading performance by minimizing network traffic overhead.
+ *
+ * This function puts multiple items into the same group if they are groupable
+ * and if they are for the same browsers. Items of the 'file' type are groupable
+ * if their 'preprocess' flag is TRUE. Items of the 'inline', 'settings', or
+ * 'external' type are not groupable.
+ *
+ * This function also ensures that the process of grouping items does not change
+ * their relative order. This requirement may result in multiple groups for the
+ * same type and browsers, if needed to accommodate other items in
+ * between.
+ *
+ * @param $javascript
+ *   An array of JavaScript items, as returned by drupal_add_js(), but after
+ *   alteration performed by drupal_get_js().
+ *
+ * @return
+ *   An array of JavaScript groups. Each group contains the same keys (e.g.,
+ *   'data', etc.) as a JavaScript item from the $javascript parameter, with the
+ *   value of each key applying to the group as a whole. Each group also
+ *   contains an 'items' key, which is the subset of items from $javascript that
+ *   are in the group.
+ *
+ * @see drupal_pre_render_scripts()
+ */
+function drupal_group_js($javascript) {
+  $groups = array();
+  // If a group can contain multiple items, we track the information that must
+  // be the same for each item in the group, so that when we iterate the next
+  // item, we can determine if it can be put into the current group, or if a
+  // new group needs to be made for it.
+  $current_group_keys = NULL;
+  $index = -1;
+  foreach ($javascript as $item) {
+    // The browsers for which the JavaScript item needs to be loaded is part of
+    // the information that determines when a new group is needed, but the order
+    // of keys in the array doesn't matter, and we don't want a new group if all
+    // that's different is that order.
+    ksort($item['browsers']);
+
+    switch ($item['type']) {
+      case 'file':
+        // Group file items if their 'preprocess' flag is TRUE.
+        // Help ensure maximum reuse of aggregate files by only grouping
+        // together items that share the same 'group' value and 'every_page'
+        // flag. See drupal_add_js() for details about that.
+        $group_keys = $item['preprocess'] ? array($item['type'], $item['group'], $item['every_page'], $item['browsers']) : FALSE;
+        break;
 
-  // Aggregate the JavaScript if necessary, but only during normal site
-  // operation.
-  if (!defined('MAINTENANCE_MODE') && config('system.performance')->get('js.preprocess')) {
-    $js_assets = \Drupal::service('asset.js.collection_optimizer')->optimize($js_assets);
+      case 'external':
+      case 'setting':
+      case 'inline':
+        // Do not group external, settings, and inline items.
+        $group_keys = FALSE;
+        break;
+    }
+
+    // If the group keys don't match the most recent group we're working with,
+    // then a new group must be made.
+    if ($group_keys !== $current_group_keys) {
+      $index++;
+      // Initialize the new group with the same properties as the first item
+      // being placed into it. The item's 'data' and 'weight' properties are
+      // unique to the item and should not be carried over to the group.
+      $groups[$index] = $item;
+      unset($groups[$index]['data'], $groups[$index]['weight']);
+      $groups[$index]['items'] = array();
+      $current_group_keys = $group_keys ? $group_keys : NULL;
+    }
+
+    // Add the item to the current group.
+    $groups[$index]['items'][] = $item;
+  }
+
+  return $groups;
+}
+
+/**
+ * Default callback to aggregate JavaScript files.
+ *
+ * Having the browser load fewer JavaScript files results in much faster page
+ * loads than when it loads many small files. This function aggregates files
+ * within the same group into a single file unless the site-wide setting to do
+ * so is disabled (commonly the case during site development). To optimize
+ * download, it also compresses the aggregate files by removing comments,
+ * whitespace, and other unnecessary content.
+ *
+ * @param $js_groups
+ *   An array of JavaScript groups as returned by drupal_group_js(). For each
+ *   group that is aggregated, this function sets the value of the group's
+ *   'data' key to the URI of the aggregate file.
+ *
+ * @see drupal_group_js()
+ * @see drupal_pre_render_scripts()
+ */
+function drupal_aggregate_js(&$js_groups) {
+  // Only aggregate during normal site operation.
+  if (defined('MAINTENANCE_MODE')) {
+    $preprocess_js = FALSE;
+  }
+  else {
+    $config = config('system.performance');
+    $preprocess_js = $config->get('js.preprocess');
+  }
+
+  if ($preprocess_js) {
+    foreach ($js_groups as $key => $group) {
+      if ($group['type'] == 'file' && $group['preprocess']) {
+        $js_groups[$key]['data'] = drupal_build_js_cache($group['items']);
+      }
+    }
   }
-  return \Drupal::service('asset.js.collection_renderer')->render($js_assets);
 }
 
 /**
@@ -2988,6 +3727,83 @@ function drupal_add_tabledrag($table_id, $action, $relationship, $group, $subgro
 }
 
 /**
+ * Aggregates JavaScript files into a cache file in the files directory.
+ *
+ * The file name for the JavaScript cache file is generated from the hash of
+ * the aggregated contents of the files in $files. This forces proxies and
+ * browsers to download new JavaScript when the JavaScript changes.
+ *
+ * The cache file name is retrieved on a page load via a lookup variable that
+ * contains an associative array. The array key is the hash of the names in
+ * $files while the value is the cache file name. The cache file is generated
+ * in two cases. First, if there is no file name value for the key, which will
+ * happen if a new file name has been added to $files or after the lookup
+ * variable is emptied to force a rebuild of the cache. Second, the cache file
+ * is generated if it is missing on disk. Old cache files are not deleted
+ * immediately when the lookup variable is emptied, but are deleted after a set
+ * period by drupal_delete_file_if_stale(). This ensures that files referenced
+ * by a cached page will still be available.
+ *
+ * @param $files
+ *   An array of JavaScript files to aggregate and compress into one file.
+ *
+ * @return
+ *   The URI of the cache file, or FALSE if the file could not be saved.
+ */
+function drupal_build_js_cache($files) {
+  $contents = '';
+  $uri = '';
+  $map = Drupal::state()->get('system.js_cache_files') ?: array();
+  // Create a new array so that only the file names are used to create the hash.
+  // This prevents new aggregates from being created unnecessarily.
+  $js_data = array();
+  foreach ($files as $file) {
+    $js_data[] = $file['data'];
+  }
+  $key = hash('sha256', serialize($js_data));
+  if (isset($map[$key])) {
+    $uri = $map[$key];
+  }
+
+  if (empty($uri) || !file_exists($uri)) {
+    // Build aggregate JS file.
+    foreach ($files as $info) {
+      if ($info['preprocess']) {
+        // Append a ';' and a newline after each JS file to prevent them from running together.
+        $contents .= file_get_contents($info['data']) . ";\n";
+      }
+    }
+    // Prefix filename to prevent blocking by firewalls which reject files
+    // starting with "ad*".
+    $filename = 'js_' . Crypt::hashBase64($contents) . '.js';
+    // Create the js/ within the files folder.
+    $jspath = 'public://js';
+    $uri = $jspath . '/' . $filename;
+    // Create the JS file.
+    file_prepare_directory($jspath, FILE_CREATE_DIRECTORY);
+    if (!file_exists($uri) && !file_unmanaged_save_data($contents, $uri, FILE_EXISTS_REPLACE)) {
+      return FALSE;
+    }
+    // If JS gzip compression is enabled and the zlib extension is available
+    // then create a gzipped version of this file. This file is served
+    // conditionally to browsers that accept gzip using .htaccess rules.
+    // It's possible that the rewrite rules in .htaccess aren't working on this
+    // server, but there's no harm (other than the time spent generating the
+    // file) in generating the file anyway. Sites on servers where rewrite rules
+    // aren't working can set js.gzip to FALSE in order to skip
+    // generating a file that won't be used.
+    if (config('system.performance')->get('js.gzip') && extension_loaded('zlib')) {
+      if (!file_exists($uri . '.gz') && !file_unmanaged_save_data(gzencode($contents, 9, FORCE_GZIP), $uri . '.gz', FILE_EXISTS_REPLACE)) {
+        return FALSE;
+      }
+    }
+    $map[$key] = $uri;
+    Drupal::state()->set('system.js_cache_files', $map);
+  }
+  return $uri;
+}
+
+/**
  * Deletes old cached JavaScript files and variables.
  */
 function drupal_clear_js_cache() {
@@ -3069,7 +3885,7 @@ function drupal_get_token($value = '') {
  */
 function drupal_valid_token($token, $value = '', $skip_anonymous = FALSE) {
   global $user;
-  return (($skip_anonymous && $user->id() == 0) || ($token == drupal_get_token($value)));
+  return (($skip_anonymous && $user->uid == 0) || ($token == drupal_get_token($value)));
 }
 
 /**
@@ -3094,6 +3910,10 @@ function _drupal_bootstrap_code() {
   // Load all enabled modules
   Drupal::moduleHandler()->loadAll();
 
+  // Set our bridge extension manager to Zend Feed.
+  Reader::setExtensionManager(Drupal::service('feed.bridge.reader'));
+  Writer::setExtensionManager(Drupal::service('feed.bridge.writer'));
+
   // Make sure all stream wrappers are registered.
   file_get_stream_wrappers();
 
@@ -3550,7 +4370,7 @@ function drupal_pre_render_link($element) {
  * For example, adding this code to node.html.twig will result in the comment
  * links being rendered as a single list:
  * @code
- * {{ content.links.comment }}
+ * print render($content['links']['comment']);
  * @endcode
  *
  * (where $node->content has been transformed into $content before handing
@@ -3560,7 +4380,7 @@ function drupal_pre_render_link($element) {
  * allows the following code to be used to render all remaining links into a
  * single list, regardless of their group:
  * @code
- * {{ content.links }}
+ * print render($content['links']);
  * @endcode
  *
  * In the above example, this will result in the statistics and translation
@@ -3658,100 +4478,79 @@ function drupal_render_page($page) {
 /**
  * Renders HTML given a structured array tree.
  *
- * Renderable arrays have two kinds of key/value pairs: properties and children.
- * Properties have keys starting with '#' and their values influence how the
- * array will be rendered. Children are all elements whose keys do not start
- * with a '#'. Their values should be renderable arrays themselves, which will
- * be rendered during the rendering of the parent array. The markup provided by
- * the children is typically inserted into the markup generated by the parent
- * array.
- *
- * The process of rendering an element is recursive unless the element defines
- * an implemented theme hook in #theme. During each call to drupal_render(), the
- * outermost renderable array (also known as an "element") is processed using
- * the following steps:
- *   - If this element has already been printed (#printed = TRUE) or the user
- *     does not have access to it (#access = FALSE), then an empty string is
- *     returned.
- *   - If this element has #cache defined then the cached markup for this
- *     element will be returned if it exists in drupal_render()'s cache. To use
- *     drupal_render() caching, set the element's #cache property to an
- *     associative array with one or several of the following keys:
- *     - 'keys': An array of one or more keys that identify the element. If
- *       'keys' is set, the cache ID is created automatically from these keys.
- *       See drupal_render_cid_create().
- *     - 'granularity' (optional): Define the cache granularity using binary
- *       combinations of the cache granularity constants, e.g.
- *       DRUPAL_CACHE_PER_USER to cache for each user separately or
- *       DRUPAL_CACHE_PER_PAGE | DRUPAL_CACHE_PER_ROLE to cache separately for
- *       each page and role. If not specified the element is cached globally for
- *       each theme and language.
- *     - 'cid': Specify the cache ID directly. Either 'keys' or 'cid' is
- *       required. If 'cid' is set, 'keys' and 'granularity' are ignored. Use
- *       only if you have special requirements.
- *     - 'expire': Set to one of the cache lifetime constants.
- *     - 'bin': Specify a cache bin to cache the element in. Default is 'cache'.
- *   - If this element has #type defined and the default attributes for this
- *     element have not already been merged in (#defaults_loaded = TRUE) then
- *     the defaults for this type of element, defined in hook_element_info(),
- *     are merged into the array. #defaults_loaded is set by functions that
- *     process render arrays and call element_info() before passing the array to
- *     drupal_render(), such as form_builder() in the Form API.
- *   - If this element has an array of #pre_render functions defined, they are
- *     called sequentially to modify the element before rendering. After all the
- *     #pre_render functions have been called, #printed is checked a second time
- *     in case a #pre_render function flags the element as printed.
- *   - The child elements of this element are sorted by weight using uasort() in
- *     element_children(). Since this is expensive, when passing already sorted
- *     elements to drupal_render(), for example from a database query, set
- *     $elements['#sorted'] = TRUE to avoid sorting them a second time.
- *   - The main render phase to produce #children for this element takes place:
- *     - If this element has #theme defined and #theme is an implemented theme
- *       hook/suggestion then theme() is called and must render both the element
- *       and its children. If #render_children is set, theme() will not be
- *       called. #render_children is usually only set internally by theme() so
- *       that we can avoid the situation where drupal_render() called from
- *       within a theme preprocess function creates an infinite loop.
- *     - If this element does not have a defined #theme, or the defined #theme
- *       hook is not implemented, or #render_children is set, then
- *       drupal_render() is called recursively on each of the child elements of
- *       this element, and the result of each is concatenated onto #children.
- *       This is skipped if #children is not empty at this point.
- *     - Once #children has been rendered for this element, if #theme is not
- *       implemented and #markup is set for this element, #markup will be
- *       prepended to #children.
- *   - If this element has #states defined then JavaScript state information is
- *     added to this element's #attached attribute by drupal_process_states().
- *   - If this element has #attached defined then any required libraries,
- *     JavaScript, CSS, or other custom data are added to the current page by
- *     drupal_process_attached().
- *   - If this element has an array of #theme_wrappers defined and
- *     #render_children is not set, #children is then re-rendered by passing the
- *     element in its current state to theme() successively for each item in
- *     #theme_wrappers.
- *   - If this element has an array of #post_render functions defined, they are
- *     called sequentially to modify the rendered #children. Unlike #pre_render
- *     functions, #post_render functions are passed both the rendered #children
- *     attribute as a string and the element itself.
- *   - If this element has #prefix and/or #suffix defined, they are concatenated
- *     to #children.
- *   - If this element has #cache defined, the rendered output of this element
- *     is saved to drupal_render()'s internal cache.
- *   - #printed is set to TRUE for this element to ensure that it is only
- *     rendered once.
- *   - The final value of #children for this element is returned as the rendered
- *     output.
+ * Recursively iterates over each of the array elements, generating HTML code.
+ *
+ * Renderable arrays have two kinds of key/value pairs: properties and
+ * children. Properties have keys starting with '#' and their values influence
+ * how the array will be rendered. Children are all elements whose keys do not
+ * start with a '#'. Their values should be renderable arrays themselves,
+ * which will be rendered during the rendering of the parent array. The markup
+ * provided by the children is typically inserted into the markup generated by
+ * the parent array.
+ *
+ * HTML generation for a renderable array, and the treatment of any children,
+ * is controlled by two properties containing theme functions, #theme and
+ * #theme_wrappers.
+ *
+ * #theme is the theme function called first. If it is set and the element has
+ * any children, it is the responsibility of the theme function to render
+ * these children. For elements that are not allowed to have any children,
+ * e.g. buttons or textfields, the theme function can be used to render the
+ * element itself. If #theme is not present and the element has children, each
+ * child is itself rendered by a call to drupal_render(), and the results are
+ * concatenated.
+ *
+ * The #theme_wrappers property contains an array of theme functions which will
+ * be called, in order, after #theme has run. These can be used to add further
+ * markup around the rendered children; e.g., details add the required markup
+ * for a details element around their rendered child elements. All wrapper theme
+ * functions have to include the element's #children property in their output,
+ * as it contains the output of the previous theme functions and the rendered
+ * children.
+ *
+ * For example, for the form element type, by default only the #theme_wrappers
+ * property is set, which adds the form markup around the rendered child
+ * elements of the form. This allows you to set the #theme property on a
+ * specific form to a custom theme function, giving you complete control over
+ * the placement of the form's children while not at all having to deal with
+ * the form markup itself.
+ *
+ * drupal_render() can optionally cache the rendered output of elements to
+ * improve performance. To use drupal_render() caching, set the element's #cache
+ * property to an associative array with one or several of the following keys:
+ * - 'keys': An array of one or more keys that identify the element. If 'keys'
+ *   is set, the cache ID is created automatically from these keys. See
+ *   drupal_render_cid_create().
+ * - 'granularity' (optional): Define the cache granularity using binary
+ *   combinations of the cache granularity constants, e.g.
+ *   DRUPAL_CACHE_PER_USER to cache for each user separately or
+ *   DRUPAL_CACHE_PER_PAGE | DRUPAL_CACHE_PER_ROLE to cache separately for each
+ *   page and role. If not specified the element is cached globally for each
+ *   theme and language.
+ * - 'cid': Specify the cache ID directly. Either 'keys' or 'cid' is required.
+ *   If 'cid' is set, 'keys' and 'granularity' are ignored. Use only if you
+ *   have special requirements.
+ * - 'expire': Set to one of the cache lifetime constants.
+ * - 'bin': Specify a cache bin to cache the element in. Defaults to 'cache'.
+ *
+ * This function is usually called from within another function, like
+ * drupal_get_form() or a theme function. Elements are sorted internally
+ * using uasort(). Since this is expensive, when passing already sorted
+ * elements to drupal_render(), for example from a database query, set
+ * $elements['#sorted'] = TRUE to avoid sorting them a second time.
+ *
+ * drupal_render() flags each element with a '#printed' status to indicate that
+ * the element has been rendered, which allows individual elements of a given
+ * array to be rendered independently and prevents them from being rendered
+ * more than once on subsequent calls to drupal_render() (e.g., as part of a
+ * larger array). If the same array or array element is passed more than once
+ * to drupal_render(), it simply returns an empty string.
  *
  * @param array $elements
  *   The structured array describing the data to be rendered.
  *
  * @return string
  *   The rendered HTML.
- *
- * @see element_info()
- * @see theme()
- * @see drupal_process_states()
- * @see drupal_process_attached()
  */
 function drupal_render(&$elements) {
   // Early-return nothing if user does not have access.
@@ -4184,7 +4983,7 @@ function drupal_render_cid_parts($granularity = NULL) {
       $cid_parts[] = 'r.' . implode(',', $user->roles);
     }
     elseif ($granularity & DRUPAL_CACHE_PER_USER) {
-      $cid_parts[] = 'u.' . $user->id();
+      $cid_parts[] = "u.$user->uid";
     }
 
     if ($granularity & DRUPAL_CACHE_PER_PAGE) {
diff --git a/core/includes/entity.inc b/core/includes/entity.inc
index 2b3885e..fe30114 100644
--- a/core/includes/entity.inc
+++ b/core/includes/entity.inc
@@ -865,11 +865,21 @@ function entity_page_access(EntityInterface $entity, $operation = 'view') {
  *   The entity type.
  * @param string $bundle
  *   (optional) The bundle of the entity. Required if the entity supports
- *   bundles, defaults to NULL otherwise.
+ *   bundles, defaults to the entity type otherwise.
  *
  * @return bool
  *   TRUE if the access is granted. FALSE if access is denied.
  */
 function entity_page_create_access($entity_type, $bundle = NULL) {
-  return Drupal::entityManager()->getAccessController($entity_type)->createAccess($bundle);
+  $definition = Drupal::entityManager()->getDefinition($entity_type);
+
+  // Pass in the entity bundle if given and required.
+  $values = array();
+  if ($bundle && isset($definition['entity_keys']['bundle'])) {
+    $values[$definition['entity_keys']['bundle']] = $bundle;
+  }
+  $entity = Drupal::entityManager()
+    ->getStorageController($entity_type)
+    ->create($values);
+  return $entity->access('create');
 }
diff --git a/core/includes/file.inc b/core/includes/file.inc
index 1af50cc..58644ff 100644
--- a/core/includes/file.inc
+++ b/core/includes/file.inc
@@ -1123,7 +1123,7 @@ function file_save_upload($form_field_name, $validators = array(), $destination
     }
     // Begin building file entity.
     $values = array(
-      'uid' => $user->id(),
+      'uid' => $user->uid,
       'status' => 0,
       'filename' => trim(drupal_basename($name, '.')),
       'uri' => $uploaded_files['files']['tmp_name'][$form_field_name][$i],
diff --git a/core/includes/form.inc b/core/includes/form.inc
index d602d54..7d1a253 100644
--- a/core/includes/form.inc
+++ b/core/includes/form.inc
@@ -546,7 +546,7 @@ function drupal_rebuild_form($form_id, &$form_state, $old_form = NULL) {
 function form_get_cache($form_build_id, &$form_state) {
   if ($form = Drupal::keyValueExpirable('form')->get($form_build_id)) {
     global $user;
-    if ((isset($form['#cache_token']) && drupal_valid_token($form['#cache_token'])) || (!isset($form['#cache_token']) && $user->isAnonymous())) {
+    if ((isset($form['#cache_token']) && drupal_valid_token($form['#cache_token'])) || (!isset($form['#cache_token']) && !$user->uid)) {
       if ($stored_form_state = Drupal::keyValueExpirable('form_state')->get($form_build_id)) {
         // Re-populate $form_state for subsequent rebuilds.
         $form_state = $stored_form_state + $form_state;
@@ -578,7 +578,7 @@ function form_set_cache($form_build_id, $form, $form_state) {
 
   // Cache form structure.
   if (isset($form)) {
-    if ($GLOBALS['user']->isAuthenticated()) {
+    if ($GLOBALS['user']->uid) {
       $form['#cache_token'] = drupal_get_token();
     }
     Drupal::keyValueExpirable('form')->setWithExpire($form_build_id, $form, $expire);
@@ -1069,7 +1069,7 @@ function drupal_prepare_form($form_id, &$form, &$form_state) {
   // tokens are session-bound and forms displayed to anonymous users are very
   // likely cached, we cannot assign a token for them.
   // During installation, there is no $user yet.
-  if ($user && $user->isAuthenticated() && !$form_state['programmed']) {
+  if (!empty($user->uid) && !$form_state['programmed']) {
     // Form constructors may explicitly set #token to FALSE when cross site
     // request forgery is irrelevant to the form, such as search forms.
     if (isset($form['#token']) && $form['#token'] === FALSE) {
@@ -4888,7 +4888,7 @@ function _drupal_form_send_response(Response $response) {
  * $batch = array(
  *   'title' => t('Exporting'),
  *   'operations' => array(
- *     array('my_function_1', array($account->id(), 'story')),
+ *     array('my_function_1', array($account->uid, 'story')),
  *     array('my_function_2', array()),
  *   ),
  *   'finished' => 'my_finished_callback',
diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc
index eefe926..ee5c0a4 100644
--- a/core/includes/install.core.inc
+++ b/core/includes/install.core.inc
@@ -366,6 +366,9 @@ function install_begin_request(&$install_state) {
     // Add the file translation service to the container.
     $container->set('string_translator.file_translation', install_file_translation_service());
     $container->get('string_translation')->addTranslator($container->get('string_translator.file_translation'));
+    // Set the request in the kernel to the new created Request above
+    // so it is available to the rest of the installation process.
+    $container->set('request', $request);
   }
   else {
     // @todo Move into a proper Drupal\Core\DependencyInjection\InstallContainerBuilder.
@@ -433,16 +436,8 @@ function install_begin_request(&$install_state) {
 
     $container->register('url_generator', 'Drupal\Core\Routing\NullGenerator');
 
-    // Register the CSS and JavaScript asset collection renderers.
-    $container->register('asset.css.collection_renderer', 'Drupal\Core\Asset\CssCollectionRenderer');
-    $container->register('asset.js.collection_renderer', 'Drupal\Core\Asset\JsCollectionRenderer');
-
+    Drupal::setContainer($container);
   }
-  // Set the request in the kernel to the new created Request above
-  // so it is available to the rest of the installation process.
-  $container->set('request', $request);
-
-  Drupal::setContainer($container);
 
   // Set up $language, so t() caller functions will still work.
   drupal_language_initialize();
diff --git a/core/includes/language.inc b/core/includes/language.inc
index e63acaa..976dd75 100644
--- a/core/includes/language.inc
+++ b/core/includes/language.inc
@@ -15,11 +15,6 @@
 const LANGUAGE_NEGOTIATION_SELECTED = 'language-selected';
 
 /**
- * The language is determined using the current interface language.
- */
-const LANGUAGE_NEGOTIATION_INTERFACE = 'language-interface';
-
-/**
  * @defgroup language_negotiation Language Negotiation API functionality
  * @{
  * Functions to customize the language types and the negotiation process.
@@ -57,10 +52,6 @@
  * }
  * @endcode
  *
- * The locked configuration property prevents one language type from being
- * switched from customized to not customized, and vice versa.
- * @see language_types_set()
- *
  * Every language type can have a different set of language negotiation methods
  * assigned to it. Different language types often share the same language
  * negotiation settings, but they can have independent settings if needed. If
@@ -176,12 +167,35 @@ function language_types_info() {
  * whose language negotiation methods are module-defined and not altered through
  * the user interface.
  *
+ * @param $stored
+ *   (optional) By default, retrieves values from the 'language_types' variable
+ *   to avoid unnecessary hook invocations. If set to FALSE, retrieves values
+ *   from the actual language type definitions. This allows reaction to
+ *   alterations performed on the definitions by modules installed after the
+ *   'language_types' variable is set.
+ *
  * @return
  *   An array of language type names.
  */
-function language_types_get_configurable() {
-  $configurable = Drupal::config('system.language.types')->get('configurable');
-  return $configurable ? $configurable : array();
+function language_types_get_configurable($stored = TRUE) {
+  $configurable = &drupal_static(__FUNCTION__);
+
+  if ($stored && !isset($configurable)) {
+    $types = variable_get('language_types', language_types_get_default());
+    $configurable = array_keys(array_filter($types));
+  }
+
+  if (!$stored) {
+    $result = array();
+    foreach (language_types_info() as $type => $info) {
+      if (!isset($info['fixed'])) {
+        $result[] = $type;
+      }
+    }
+    return $result;
+  }
+
+  return $configurable;
 }
 
 /**
@@ -191,70 +205,48 @@ function language_types_get_configurable() {
  *   An array of language types.
  */
 function language_types_disable($types) {
-  $configurable = language_types_get_configurable();
-  config('system.language.types')->set('configurable', array_diff($configurable, $types))->save();
+  $enabled_types = variable_get('language_types', language_types_get_default());
+
+  foreach ($types as $type) {
+    unset($enabled_types[$type]);
+  }
+
+  variable_set('language_types', $enabled_types);
 }
 
 /**
  * Updates the language type configuration.
- *
- * @param array $configurable_language_types
- *   An array of configurable language types.
  */
-function language_types_set(array $configurable_language_types) {
+function language_types_set() {
   // Ensure that we are getting the defined language negotiation information. An
   // invocation of module_enable() or module_disable() could outdate the cached
   // information.
   drupal_static_reset('language_types_info');
   drupal_static_reset('language_negotiation_info');
 
+  // Determine which language types are configurable and which not by checking
+  // whether the 'fixed' key is defined. Non-configurable (fixed) language types
+  // have their language negotiation settings stored there.
   $language_types = array();
   $negotiation_info = language_negotiation_info();
-  $language_types_info = language_types_info();
-
-  foreach ($language_types_info as $type => $info) {
-    $configurable = in_array($type, $configurable_language_types);
-
-    // Check whether the language type is unlocked. Only the status of unlocked
-    // language types can be toggled between configurable and non-configurable.
-    // The default language negotiation settings, if available, are stored in
-    // $info['fixed'].
-    if (empty($info['locked'])) {
-      // If we have a non-locked non-configurable language type without default
-      // language negotiation settings, we use the values negotiated for the
-      // interface language which should always be available.
-      if (!$configurable && !empty($info['fixed'])) {
-        $method_weights = array(LANGUAGE_NEGOTIATION_INTERFACE);
-        $method_weights = array_flip($method_weights);
-        language_negotiation_set($type, $method_weights);
+  foreach (language_types_info() as $type => $info) {
+    if (isset($info['fixed'])) {
+      $language_types[$type] = FALSE;
+      $method_weights = array();
+      foreach ($info['fixed'] as $weight => $method_id) {
+        if (isset($negotiation_info[$method_id])) {
+          $method_weights[$method_id] = $weight;
+        }
       }
+      language_negotiation_set($type, $method_weights);
     }
     else {
-      // Locked language types with default settings are always considered
-      // non-configurable. In turn if default settings are missing, the language
-      // type is always considered configurable.
-      $configurable = empty($info['fixed']);
-
-      // If the language is non-configurable we need to store its language
-      // negotiation settings.
-      if (!$configurable) {
-        $method_weights = array();
-        foreach ($info['fixed'] as $weight => $method_id) {
-          if (isset($negotiation_info[$method_id])) {
-            $method_weights[$method_id] = $weight;
-          }
-        }
-        language_negotiation_set($type, $method_weights);
-      }
+      $language_types[$type] = TRUE;
     }
-
-    $language_types[$type] = $configurable;
   }
 
-  // Store the language type configuration.
-  $config = config('system.language.types');
-  $config->set('configurable', array_keys(array_filter($language_types)))->save();
-  $config->set('all', array_keys($language_types))->save();
+  // Save enabled language types.
+  variable_set('language_types', $language_types);
 
   // Ensure that subsequent calls of language_types_get_configurable() return
   // the updated language type information.
@@ -375,7 +367,7 @@ function language_negotiation_set($type, $method_weights) {
 
   $negotiation = array();
   $negotiation_info = language_negotiation_info();
-  $default_types = language_types_get_configurable();
+  $default_types = language_types_get_configurable(FALSE);
 
   // Order the language negotiation method list by weight.
   asort($method_weights);
@@ -470,7 +462,7 @@ function language_negotiation_method_invoke($method_id, $method = NULL, $request
     }
     // If the language negotiation method has no cache preference or this is
     // satisfied we can execute the callback.
-    $cache = !isset($method['cache']) || $user->isAuthenticated() || $method['cache'] == variable_get('cache', 0);
+    $cache = !isset($method['cache']) || $user->uid || $method['cache'] == variable_get('cache', 0);
     $callback = isset($method['callbacks']['negotiation']) ? $method['callbacks']['negotiation'] : FALSE;
     $langcode = $cache && function_exists($callback) ? $callback($languages, $request) : FALSE;
     $results[$method_id] = isset($languages[$langcode]) ? $languages[$langcode] : FALSE;
diff --git a/core/includes/menu.inc b/core/includes/menu.inc
index 626b634..94d0e57 100644
--- a/core/includes/menu.inc
+++ b/core/includes/menu.inc
@@ -1948,10 +1948,6 @@ function menu_local_tasks($level = 0) {
     if (!$router_item || !$router_item['access']) {
       return $empty;
     }
-    // @todo remove all code using {menu_router} and anything using MENU_*
-    // constants when all local actions and local tasks are converted to
-    // plugins. The remaining code should just invoke those managers plus do the
-    // invocations of hook_menu_local_tasks() and hook_menu_local_tasks_alter().
 
     // Get all tabs (also known as local tasks) and the root page.
     $result = db_select('menu_router', NULL, array('fetch' => PDO::FETCH_ASSOC))
@@ -2121,15 +2117,6 @@ function menu_local_tasks($level = 0) {
     // Remove the depth, we are interested only in their relative placement.
     $tabs = array_values($tabs);
     $data['tabs'] = $tabs;
-    // Look for route-based tabs.
-    $route_name = Drupal::request()->attributes->get('_route');
-    if (!empty($route_name)) {
-      $manager = Drupal::service('plugin.manager.menu.local_task');
-      $local_tasks = $manager->getTasksBuild($route_name);
-      foreach ($local_tasks as $level => $items) {
-        $data['tabs'][$level] = empty($data['tabs'][$level]) ? $items : array_merge($data['tabs'][$level], $items);
-      }
-    }
 
     // Allow modules to dynamically add further tasks.
     $module_handler = Drupal::moduleHandler();
@@ -2286,19 +2273,20 @@ function menu_secondary_local_tasks() {
 function menu_get_local_actions() {
   $links = menu_local_tasks();
   $router_item = menu_get_item();
-  $manager = Drupal::service('plugin.manager.menu.local_action');
-  $local_actions = $manager->getActionsForRoute($router_item['route_name']);
-  foreach ($local_actions as $plugin) {
-    $route_path = $manager->getPath($plugin);
-    $action_router_item = menu_get_item($route_path);
-    $links['actions'][$route_path] = array(
-      '#theme' => 'menu_local_action',
-      '#link' => array(
-        'title' => $manager->getTitle($plugin),
-        'href' => $route_path,
-      ),
-      '#access' => $action_router_item['access'],
-    );
+  // @todo Consider storing the results of hook_local_actions() in a static.
+  foreach (Drupal::moduleHandler()->invokeAll('local_actions') as $route_info) {
+    if (in_array($router_item['route_name'], $route_info['appears_on'])) {
+      $route_path = _menu_router_translate_route($route_info['route_name']);
+      $action_router_item = menu_get_item($route_path);
+      $links['actions'][$route_path] = array(
+        '#theme' => 'menu_local_action',
+        '#link' => array(
+          'title' => $route_info['title'],
+          'href' => $route_path,
+        ),
+        '#access' => $action_router_item['access'],
+      );
+    }
   }
   return $links['actions'];
 }
@@ -2629,7 +2617,7 @@ function menu_get_active_breadcrumb() {
 
     // Don't show a link to the current page in the breadcrumb trail.
     $end = end($active_trail);
-    if (Drupal::request()->attributes->get('system_path') == $end['href']) {
+    if ($item['href'] == $end['href']) {
       array_pop($active_trail);
     }
 
diff --git a/core/includes/session.inc b/core/includes/session.inc
index 572ac21..40e495f 100644
--- a/core/includes/session.inc
+++ b/core/includes/session.inc
@@ -115,7 +115,7 @@ function _drupal_session_read($sid) {
   if ($values && $values['uid'] > 0 && $values['status'] == 1) {
     $user = new UserSession($values);
     // Add roles element to $user.
-    $rids = db_query("SELECT ur.rid FROM {users_roles} ur WHERE ur.uid = :uid", array(':uid' => $user->id()))->fetchCol();
+    $rids = db_query("SELECT ur.rid FROM {users_roles} ur WHERE ur.uid = :uid", array(':uid' => $user->uid))->fetchCol();
     $user->roles = array_merge(array(DRUPAL_AUTHENTICATED_RID), $rids);
   }
   elseif ($user) {
@@ -180,7 +180,7 @@ function _drupal_session_write($sid, $value) {
     if ($is_changed || !isset($user->timestamp) || REQUEST_TIME - $user->timestamp > settings()->get('session_write_interval', 180)) {
       // Either ssid or sid or both will be added from $key below.
       $fields = array(
-        'uid' => $user->id(),
+        'uid' => $user->uid,
         'hostname' => Drupal::request()->getClientIP(),
         'session' => $value,
         'timestamp' => REQUEST_TIME,
@@ -214,12 +214,12 @@ function _drupal_session_write($sid, $value) {
     }
 
     // Likewise, do not update access time more than once per 180 seconds.
-    if ($user->isAuthenticated() && REQUEST_TIME - $user->access > settings()->get('session_write_interval', 180)) {
+    if ($user->uid && REQUEST_TIME - $user->access > settings()->get('session_write_interval', 180)) {
       db_update('users')
         ->fields(array(
           'access' => REQUEST_TIME
         ))
-        ->condition('uid', $user->id())
+        ->condition('uid', $user->uid)
         ->execute();
     }
 
@@ -254,7 +254,7 @@ function drupal_session_initialize() {
     // anonymous users not use a session cookie unless something is stored in
     // $_SESSION. This allows HTTP proxies to cache anonymous pageviews.
     drupal_session_start();
-    if ($user->isAuthenticated() || !empty($_SESSION)) {
+    if (!empty($user->uid) || !empty($_SESSION)) {
       drupal_page_is_cacheable(FALSE);
     }
   }
@@ -312,7 +312,7 @@ function drupal_session_commit() {
     return;
   }
 
-  if ($user->isAnonymous() && empty($_SESSION)) {
+  if (empty($user->uid) && empty($_SESSION)) {
     // There is no session data to store, destroy the session if it was
     // previously started.
     if (drupal_session_started()) {
diff --git a/core/includes/theme.inc b/core/includes/theme.inc
index caea1f4..337f383 100644
--- a/core/includes/theme.inc
+++ b/core/includes/theme.inc
@@ -1132,7 +1132,7 @@ function theme($hook, $variables = array()) {
     // new variable to track that.
     if (!isset($variables['directory'])) {
       $default_template_variables = array();
-      template_preprocess($default_template_variables, $hook, $info);
+      template_preprocess($default_template_variables, $hook);
       $variables += $default_template_variables;
     }
     if (!isset($default_attributes)) {
@@ -2230,7 +2230,7 @@ function template_preprocess_tablesort_indicator(&$variables) {
 function theme_mark($variables) {
   $type = $variables['status'];
   global $user;
-  if ($user->isAuthenticated()) {
+  if ($user->uid) {
     if ($type == MARK_NEW) {
       return ' <span class="marker">' . t('new') . '</span>';
     }
@@ -2346,6 +2346,17 @@ function theme_item_list($variables) {
 }
 
 /**
+ * Returns HTML for a "more help" link.
+ *
+ * @param $variables
+ *   An associative array containing:
+ *   - url: The URL for the link.
+ */
+function theme_more_help_link($variables) {
+  return '<div class="more-help-link">' . l(t('More help'), $variables['url']) . '</div>';
+}
+
+/**
  * Returns HTML for a feed icon.
  *
  * @param $variables
@@ -2385,10 +2396,9 @@ function theme_more_link($variables) {
  */
 function theme_progress_bar($variables) {
   $output = '<div id="progress" class="progress">';
-  $output .= '<div class="progress__label">' . $variables['label'] . '</div>';
-  $output .= '<div class="progress__track"><div class="progress__bar" style="width: ' . $variables['percent'] . '%"></div></div>';
-  $output .= '<div class="progress__percentage">' . $variables['percent'] . '%</div>';
-  $output .= '<div class="progress__description">' . $variables['message'] . '</div>';
+  $output .= '<div class="bar"><div class="filled" style="width: ' . $variables['percent'] . '%"></div></div>';
+  $output .= '<div class="percentage">' . $variables['percent'] . '%</div>';
+  $output .= '<div class="message">' . $variables['message'] . '</div>';
   $output .= '</div>';
 
   return $output;
@@ -2683,17 +2693,10 @@ function template_preprocess_html(&$variables) {
   }
 
   drupal_add_library('system', 'html5shiv', TRUE);
-
   // Render page_top and page_bottom into top level variables.
-  $variables['page_top'] = array();
-  if (isset($variables['page']['page_top'])) {
-    $variables['page_top'] = drupal_render($variables['page']['page_top']);
-  }
+  $variables['page_top'] = isset($variables['page']['page_top']) ? drupal_render($variables['page']['page_top']) : '';
   $variables['page_bottom'] = array();
-  if (isset($variables['page']['page_bottom'])) {
-    $variables['page_bottom'] = drupal_render($variables['page']['page_bottom']);
-  }
-
+  $variables['page_bottom'][] = isset($variables['page']['page_bottom']) ? drupal_render($variables['page']['page_bottom']) : array();
   // Add footer scripts as '#markup' so they can be rendered with other
   // elements in page_bottom.
   $footer_scripts = new RenderWrapper('drupal_get_js', array('footer'));
@@ -2703,6 +2706,9 @@ function template_preprocess_html(&$variables) {
   $variables['head'] = new RenderWrapper('drupal_get_html_head');
   $variables['styles'] = new RenderWrapper('drupal_get_css');
   $variables['scripts'] = new RenderWrapper('drupal_get_js');
+
+  // Place the rendered HTML for the page body into a top level variable.
+  $variables['page'] = drupal_render($variables['page']);
 }
 
 /**
@@ -2796,22 +2802,6 @@ function template_preprocess_page(&$variables) {
   if ($suggestions = theme_get_suggestions(arg(), 'page')) {
     $variables['theme_hook_suggestions'] = $suggestions;
   }
-
-  // Prepare render array for messages. drupal_get_messages() is called later,
-  // when this variable is rendered in a theme function or template file.
-  $variables['messages'] = array(
-    '#theme' => 'status_messages',
-    '#access' => $variables['show_messages'],
-  );
-
-  // Set the breadcrumb last, so as to increase the chance of being able to
-  // re-use the cache of an already retrieved menu containing the active link
-  // for the current page.
-  // @see menu_tree_page_data()
-  $variables['breadcrumb'] = array(
-    '#theme' => 'breadcrumb',
-    '#breadcrumb' => \Drupal::service('breadcrumb')->build(\Drupal::request()->attributes->all()),
-  );
 }
 
 /**
@@ -2823,10 +2813,25 @@ function template_preprocess_page(&$variables) {
  * @see template_preprocess_page()
  */
 function template_process_page(&$variables) {
+  if (!isset($variables['breadcrumb'])) {
+    // Build the breadcrumb last, so as to increase the chance of being able to
+    // re-use the cache of an already rendered menu containing the active link
+    // for the current page.
+    // @see menu_tree_page_data()
+    $variables['breadcrumb'] = array(
+      '#theme' => 'breadcrumb',
+      '#breadcrumb' => \Drupal::service('breadcrumb')->build(\Drupal::service('request')->attributes->all()),
+    );
+  }
   if (!isset($variables['title'])) {
     $variables['title'] = drupal_get_title();
   }
 
+  // Generate messages last in order to capture as many as possible for the
+  // current page.
+  if (!isset($variables['messages'])) {
+    $variables['messages'] = $variables['show_messages'] ? array('#theme' => 'status_messages') : '';
+  }
 }
 
 /**
@@ -2961,21 +2966,6 @@ function template_preprocess_maintenance_page(&$variables) {
       $head_title['slogan'] = strip_tags(filter_xss_admin($site_slogan));
     }
   }
-  $path = drupal_get_path('module', 'system');
-
-  // These are usually added from system_page_build() except maintenance.css.
-  // When the database is inactive it's not called so we add it here.
-  $default_css = array(
-    '#attached' => array(
-      'css' => array(
-        $path . '/css/system.module.css',
-        $path . '/css/system.theme.css',
-        $path . '/css/system.admin.css',
-        $path . '/css/system.maintenance.css',
-      ),
-    ),
-  );
-  drupal_render($default_css);
 
   $variables['head_title_array']  = $head_title;
   $variables['head_title']        = implode(' | ', $head_title);
@@ -3136,6 +3126,9 @@ function drupal_common_theme() {
     'item_list' => array(
       'variables' => array('items' => array(), 'title' => '', 'list_type' => 'ul', 'attributes' => array()),
     ),
+    'more_help_link' => array(
+      'variables' => array('url' => NULL),
+    ),
     'feed_icon' => array(
       'variables' => array('url' => NULL, 'title' => NULL),
     ),
diff --git a/core/includes/theme.maintenance.inc b/core/includes/theme.maintenance.inc
index 5c35ac3..de519a2 100644
--- a/core/includes/theme.maintenance.inc
+++ b/core/includes/theme.maintenance.inc
@@ -92,10 +92,13 @@ function _drupal_maintenance_theme() {
   }
   _drupal_theme_initialize($themes[$theme], array_reverse($base_theme), '_theme_load_offline_registry');
 
-  // These CSS files are normally added by system_page_build(), except
-  // system.maintenance.css. When the database is inactive, it's not called so
-  // we add them here.
-  drupal_add_library('system', 'drupal.base');
+  // These CSS files are normally added by system_page_build() -except maintenance.css.
+  // When the database is inactive it's not called so we add them here.
+  $path = drupal_get_path('module', 'system');
+  drupal_add_css($path . '/css/system.module.css');
+  drupal_add_css($path . '/css/system.theme.css');
+  drupal_add_css($path . '/css/system.admin.css');
+  drupal_add_css($path . '/css/system.maintenance.css');
 }
 
 /**
diff --git a/core/includes/update.inc b/core/includes/update.inc
index cf25b03..c11476b 100644
--- a/core/includes/update.inc
+++ b/core/includes/update.inc
@@ -448,20 +448,15 @@ function update_prepare_d8_bootstrap() {
  * Fixes stored include paths to match the "/core" migration.
  */
 function update_prepare_stored_includes() {
-  // Retrieve the currently stored language types. Default to the hardcoded D7
-  // values.
-  $default_language_types = array('language' => TRUE, 'language_content' => FALSE, 'language_url' => FALSE);
-  $language_types = array_keys(update_variable_get('language_types', $default_language_types));
-
   // Update language negotiation settings.
-  foreach ($language_types as $language_type) {
-    $negotiation = update_variable_get("language_negotiation_$language_type", array());
+  foreach (language_types_get_all() as $language_type) {
+    $negotiation = variable_get("language_negotiation_$language_type", array());
     foreach ($negotiation as &$method) {
       if (isset($method['file']) && $method['file'] == 'includes/locale.inc') {
         $method['file'] = 'core/modules/language/language.negotiation.inc';
       }
     }
-    update_variable_set("language_negotiation_$language_type", $negotiation);
+    variable_set("language_negotiation_$language_type", $negotiation);
   }
 }
 
diff --git a/core/includes/utility.inc b/core/includes/utility.inc
index cea75d2..f651fd6 100644
--- a/core/includes/utility.inc
+++ b/core/includes/utility.inc
@@ -8,12 +8,12 @@
 /**
  * Drupal-friendly var_export().
  *
- * @param mixed $var
+ * @param $var
  *   The variable to export.
- * @param string $prefix
+ * @param $prefix
  *   A prefix that will be added at the beginning of every lines of the output.
  *
- * @return string
+ * @return
  *   The variable exported in a way compatible to Drupal's coding standards.
  */
 function drupal_var_export($var, $prefix = '') {
@@ -35,6 +35,7 @@ function drupal_var_export($var, $prefix = '') {
     $output = $var ? 'TRUE' : 'FALSE';
   }
   elseif (is_string($var)) {
+    $line_safe_var = str_replace("\n", '\n', $var);
     if (strpos($var, "\n") !== FALSE || strpos($var, "'") !== FALSE) {
       // If the string contains a line break or a single quote, use the
       // double quote export mode. Encode backslash and double quotes and
diff --git a/core/lib/Drupal/Component/Plugin/Discovery/AnnotatedClassDiscovery.php b/core/lib/Drupal/Component/Plugin/Discovery/AnnotatedClassDiscovery.php
index 13f853d..377bf4a 100644
--- a/core/lib/Drupal/Component/Plugin/Discovery/AnnotatedClassDiscovery.php
+++ b/core/lib/Drupal/Component/Plugin/Discovery/AnnotatedClassDiscovery.php
@@ -78,7 +78,6 @@ public function getDefinitions() {
     $reader = new AnnotationReader();
     // Prevent @endlink from being parsed as an annotation.
     $reader->addGlobalIgnoredName('endlink');
-    $reader->addGlobalIgnoredName('file');
 
     // Register the namespaces of classes that can be used for annotations.
     AnnotationRegistry::registerAutoloadNamespaces($this->getAnnotationNamespaces());
diff --git a/core/lib/Drupal/Core/Access/AccessCheckInterface.php b/core/lib/Drupal/Core/Access/AccessCheckInterface.php
index 3efc77f..172e095 100644
--- a/core/lib/Drupal/Core/Access/AccessCheckInterface.php
+++ b/core/lib/Drupal/Core/Access/AccessCheckInterface.php
@@ -8,11 +8,37 @@
 namespace Drupal\Core\Access;
 
 use Symfony\Component\Routing\Route;
+use Symfony\Component\HttpFoundation\Request;
 
 /**
  * An access check service determines access rules for particular routes.
  */
-interface AccessCheckInterface extends AccessInterface {
+interface AccessCheckInterface {
+
+  /**
+   * Grant access.
+   *
+   * A checker should return this value to indicate that it grants access to a
+   * route.
+   */
+  const ALLOW = TRUE;
+
+  /**
+   * Deny access.
+   *
+   * A checker should return this value to indicate it does not grant access to
+   * a route.
+   */
+  const DENY = NULL;
+
+  /**
+   * Block access.
+   *
+   * A checker should return this value to indicate that it wants to completely
+   * block access to this route, regardless of any other access checkers. Most
+   * checkers should prefer DENY.
+   */
+  const KILL = FALSE;
 
   /**
    * Declares whether the access check applies to a specific route or not.
@@ -20,9 +46,23 @@
    * @param \Symfony\Component\Routing\Route $route
    *   The route to consider attaching to.
    *
-   * @return array
-   *   An array of route requirement keys this access checker applies to.
+   * @return bool
+   *   TRUE if the check applies to the passed route, FALSE otherwise.
    */
   public function applies(Route $route);
 
+  /**
+   * Checks for access to route.
+   *
+   * @param \Symfony\Component\Routing\Route $route
+   *   The route to check against.
+   * @param \Symfony\Component\HttpFoundation\Request $request
+   *   The request object.
+   *
+   * @return mixed
+   *   TRUE if access is allowed.
+   *   FALSE if not.
+   *   NULL if no opinion.
+   */
+  public function access(Route $route, Request $request);
 }
diff --git a/core/lib/Drupal/Core/Access/AccessInterface.php b/core/lib/Drupal/Core/Access/AccessInterface.php
deleted file mode 100644
index f555ecb..0000000
--- a/core/lib/Drupal/Core/Access/AccessInterface.php
+++ /dev/null
@@ -1,58 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\Core\Access\AccessInterface.
- */
-
-namespace Drupal\Core\Access;
-
-use Symfony\Component\HttpFoundation\Request;
-use Symfony\Component\Routing\Route;
-
-/**
- * An access check service determines access rules for particular routes.
- */
-interface AccessInterface {
-
-  /**
-   * Grant access.
-   *
-   * A checker should return this value to indicate that it grants access to a
-   * route.
-   */
-  const ALLOW = TRUE;
-
-  /**
-   * Deny access.
-   *
-   * A checker should return this value to indicate it does not grant access to
-   * a route.
-   */
-  const DENY = NULL;
-
-  /**
-   * Block access.
-   *
-   * A checker should return this value to indicate that it wants to completely
-   * block access to this route, regardless of any other access checkers. Most
-   * checkers should prefer DENY.
-   */
-  const KILL = FALSE;
-
-  /**
-   * Checks for access to a route.
-   *
-   * @param \Symfony\Component\Routing\Route $route
-   *   The route to check against.
-   * @param \Symfony\Component\HttpFoundation\Request $request
-   *   The request object.
-   *
-   * @return mixed
-   *   TRUE if access is allowed.
-   *   FALSE if not.
-   *   NULL if no opinion.
-   */
-  public function access(Route $route, Request $request);
-
-}
diff --git a/core/lib/Drupal/Core/Access/AccessManager.php b/core/lib/Drupal/Core/Access/AccessManager.php
index 14729a5..d5fd047 100644
--- a/core/lib/Drupal/Core/Access/AccessManager.php
+++ b/core/lib/Drupal/Core/Access/AccessManager.php
@@ -1,5 +1,4 @@
 <?php
-
 /**
  * @file
  * Contains Drupal\Core\Access\AccessManager.
@@ -35,20 +34,6 @@ class AccessManager extends ContainerAware {
   protected $checks;
 
   /**
-   * An array to map static requirement keys to service IDs.
-   *
-   * @var array
-   */
-  protected $staticRequirementMap;
-
-  /**
-   * An array to map dynamic requirement keys to service IDs.
-   *
-   * @var array
-   */
-  protected $dynamicRequirementMap;
-
-  /**
    * Registers a new AccessCheck by service ID.
    *
    * @param string $service_id
@@ -65,9 +50,9 @@ public function addCheckService($service_id) {
    *   A collection of routes to apply checks to.
    */
   public function setChecks(RouteCollection $routes) {
-    $this->loadAccessRequirementMap();
     foreach ($routes as $route) {
-      if ($checks = $this->applies($route)) {
+      $checks = $this->applies($route);
+      if (!empty($checks)) {
         $route->setOption('_access_checks', $checks);
       }
     }
@@ -86,21 +71,13 @@ public function setChecks(RouteCollection $routes) {
   protected function applies(Route $route) {
     $checks = array();
 
-    // Iterate through map requirements from appliesTo() on access checkers.
-    // Only iterate through all checkIds if this is not used.
-    foreach ($route->getRequirements() as $key => $value) {
-      if (isset($this->staticRequirementMap[$key])) {
-        foreach ($this->staticRequirementMap[$key] as $service_id) {
-          $checks[] = $service_id;
-        }
+    foreach ($this->checkIds as $service_id) {
+      if (empty($this->checks[$service_id])) {
+        $this->loadCheck($service_id);
       }
-      // This means appliesTo() method was empty. Iterate through all checkers.
-      else {
-        foreach ($this->dynamicRequirementMap as $service_id) {
-          if ($this->checks[$service_id]->applies($route)) {
-            $checks[] = $service_id;
-          }
-        }
+
+      if ($this->checks[$service_id]->applies($route)) {
+        $checks[] = $service_id;
       }
     }
 
@@ -158,7 +135,7 @@ protected function checkAll(array $checks, Route $route, Request $request) {
       }
 
       $service_access = $this->checks[$service_id]->access($route, $request);
-      if ($service_access === AccessInterface::ALLOW) {
+      if ($service_access === AccessCheckInterface::ALLOW) {
         $access = TRUE;
       }
       else {
@@ -194,10 +171,10 @@ protected function checkAny(array $checks, $route, $request) {
       }
 
       $service_access = $this->checks[$service_id]->access($route, $request);
-      if ($service_access === AccessInterface::ALLOW) {
+      if ($service_access === AccessCheckinterface::ALLOW) {
         $access = TRUE;
       }
-      if ($service_access === AccessInterface::KILL) {
+      if ($service_access === AccessCheckInterface::KILL) {
         return FALSE;
       }
     }
@@ -219,34 +196,4 @@ protected function loadCheck($service_id) {
     $this->checks[$service_id] = $this->container->get($service_id);
   }
 
-  /**
-   * Compiles a mapping of requirement keys to access checker service IDs.
-   */
-  public function loadAccessRequirementMap() {
-    if (isset($this->staticRequirementMap, $this->dynamicRequirementMap)) {
-      return;
-    }
-
-    // Set them here, so we can use the isset() check above.
-    $this->staticRequirementMap = array();
-    $this->dynamicRequirementMap = array();
-
-    foreach ($this->checkIds as $service_id) {
-      if (empty($this->checks[$service_id])) {
-        $this->loadCheck($service_id);
-      }
-
-      // Empty arrays will not register anything.
-      if (is_subclass_of($this->checks[$service_id], 'Drupal\Core\Access\StaticAccessCheckInterface')) {
-        foreach ((array) $this->checks[$service_id]->appliesTo() as $key) {
-          $this->staticRequirementMap[$key][] = $service_id;
-        }
-      }
-      // Add the service ID to a the regular that will be iterated over.
-      else {
-        $this->dynamicRequirementMap[] = $service_id;
-      }
-    }
-  }
-
 }
diff --git a/core/lib/Drupal/Core/Access/DefaultAccessCheck.php b/core/lib/Drupal/Core/Access/DefaultAccessCheck.php
index 46f8a63..647bae5 100644
--- a/core/lib/Drupal/Core/Access/DefaultAccessCheck.php
+++ b/core/lib/Drupal/Core/Access/DefaultAccessCheck.php
@@ -13,13 +13,13 @@
 /**
  * Allows access to routes to be controlled by an '_access' boolean parameter.
  */
-class DefaultAccessCheck implements StaticAccessCheckInterface {
+class DefaultAccessCheck implements AccessCheckInterface {
 
   /**
-   * {@inheritdoc}
+   * Implements AccessCheckInterface::applies().
    */
-  public function appliesTo() {
-    return array('_access');
+  public function applies(Route $route) {
+    return array_key_exists('_access', $route->getRequirements());
   }
 
   /**
diff --git a/core/lib/Drupal/Core/Access/StaticAccessCheckInterface.php b/core/lib/Drupal/Core/Access/StaticAccessCheckInterface.php
deleted file mode 100644
index 9a7bb5d..0000000
--- a/core/lib/Drupal/Core/Access/StaticAccessCheckInterface.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\Core\Access\StaticAccessCheckInterface.
- */
-
-namespace Drupal\Core\Access;
-
-use Symfony\Component\Routing\Route;
-use Symfony\Component\HttpFoundation\Request;
-
-/**
- * An access check service determines access rules for particular routes.
- *
- * This interface is specifically for routes that know exactly which requirement
- * keys they should react to for a route.
- */
-interface StaticAccessCheckInterface extends AccessInterface {
-
-  /**
-   * Declares the route requirement keys this access checker applies to.
-   *
-   * This should be used when the requirement matching for a route is static,
-   * and does not require any further information. For example, '_access' will
-   * provide TRUE, or FALSE. We do not need any more information other than the
-   * route provides this requirement key.
-   *
-   * @return array
-   *   An array of route requirement keys this access checker applies to. An
-   *   empty array will check all routes using the apply method.
-   */
-  public function appliesTo();
-
-}
diff --git a/core/lib/Drupal/Core/Action/ActionBase.php b/core/lib/Drupal/Core/Action/ActionBase.php
index 11f2042..8b6c571 100644
--- a/core/lib/Drupal/Core/Action/ActionBase.php
+++ b/core/lib/Drupal/Core/Action/ActionBase.php
@@ -7,13 +7,13 @@
 
 namespace Drupal\Core\Action;
 
-use Drupal\Component\Plugin\PluginBase;
 use Drupal\Core\Action\ActionInterface;
+use Drupal\Core\Plugin\ContainerFactoryPluginBase;
 
 /**
  * Provides a base implementation for an Action plugin.
  */
-abstract class ActionBase extends PluginBase implements ActionInterface {
+abstract class ActionBase extends ContainerFactoryPluginBase implements ActionInterface {
 
   /**
    * {@inheritdoc}
diff --git a/core/lib/Drupal/Core/Annotation/Menu/LocalAction.php b/core/lib/Drupal/Core/Annotation/Menu/LocalAction.php
deleted file mode 100644
index 3c4cdb3..0000000
--- a/core/lib/Drupal/Core/Annotation/Menu/LocalAction.php
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\Core\Annotation\LocalAction.
- */
-
-namespace Drupal\Core\Annotation\Menu;
-
-use Drupal\Component\Annotation\Plugin;
-
-/**
- * Defines a LocalAction type Plugin annotation object.
- *
- * @Annotation
- */
-class LocalAction extends Plugin {
-
-  /**
-   * The ID.
-   *
-   * @var string
-   */
-  public $id;
-
-  /**
-   * A static title for the local action.
-   *
-   * @ingroup plugin_translatable
-   *
-   * @var \Drupal\Core\Annotation\Translation
-   */
-  public $title;
-
-  /**
-   * The route name.
-   *
-   * @var string
-   */
-  public $route_name;
-
-  /**
-   * An array of route names where this action appears.
-   *
-   * @var array (optional)
-   */
-  public $appears_on = array();
-
-}
diff --git a/core/lib/Drupal/Core/Annotation/Menu/LocalTask.php b/core/lib/Drupal/Core/Annotation/Menu/LocalTask.php
deleted file mode 100644
index 52ef6a1..0000000
--- a/core/lib/Drupal/Core/Annotation/Menu/LocalTask.php
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\Core\Annotation\Menu\LocalTask.
- */
-
-namespace Drupal\Core\Annotation\Menu;
-
-use Drupal\Component\Annotation\Plugin;
-
-/**
- * Defines a local task plugin annotation object.
- *
- * @Annotation
- */
-class LocalTask extends Plugin {
-
-  /**
-   * The ID.
-   *
-   * @var string
-   */
-  public $id;
-
-  /**
-   * The static title for the local task.
-   *
-   * @ingroup plugin_translatable
-   *
-   * @var \Drupal\Core\Annotation\Translation
-   */
-  public $title;
-
-  /**
-   * The route name.
-   *
-   * @var string
-   */
-  public $route_name;
-
-  /**
-   * The plugin ID of the root tab.
-   *
-   * @var array
-   */
-  public $tab_root_id;
-
-  /**
-   * The plugin ID of the parent tab (or NULL for a top-level tab).
-   *
-   * @var array|NULL
-   */
-  public $tab_parent_id;
-
-  /**
-   * The weight of the tab.
-   *
-   * @var int|NULL
-   */
-  public $weight;
-
-  /**
-   * The default link options.
-   *
-   * @var array (optional)
-   */
-  public $options = array();
-
-}
diff --git a/core/lib/Drupal/Core/Asset/AssetCollectionGrouperInterface.php b/core/lib/Drupal/Core/Asset/AssetCollectionGrouperInterface.php
deleted file mode 100644
index 94f9e85..0000000
--- a/core/lib/Drupal/Core/Asset/AssetCollectionGrouperInterface.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-/**
- * @file
- * Contains \Drupal\Core\Asset\AssetCollectionGrouperInterface.
- */
-
-namespace Drupal\Core\Asset;
-
-/**
- * Interface defining a service that logically groups a collection of assets.
- */
-interface AssetCollectionGrouperInterface {
-
-  /**
-   * Groups a collection of assets into logical groups of asset collections.
-   *
-   * @param array $assets
-   *   An asset collection.
-   *
-   * @return array
-   *   A sorted array of asset groups.
-   */
-  public function group(array $assets);
-
-}
diff --git a/core/lib/Drupal/Core/Asset/AssetCollectionOptimizerInterface.php b/core/lib/Drupal/Core/Asset/AssetCollectionOptimizerInterface.php
deleted file mode 100644
index f7102d2..0000000
--- a/core/lib/Drupal/Core/Asset/AssetCollectionOptimizerInterface.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-/**
- * @file
- * Contains \Drupal\Core\Asset\AssetCollectionOptimizerInterface.
- */
-
-namespace Drupal\Core\Asset;
-
-/**
- * Interface defining a service that optimizes a collection of assets.
- */
-interface AssetCollectionOptimizerInterface {
-
-  /**
-   * Optimizes a collection of assets.
-   *
-   * @param array $assets
-   *   An asset collection.
-   *
-   * @return array
-   *   An optimized asset collection.
-   */
-  public function optimize(array $assets);
-
-}
diff --git a/core/lib/Drupal/Core/Asset/AssetCollectionRendererInterface.php b/core/lib/Drupal/Core/Asset/AssetCollectionRendererInterface.php
deleted file mode 100644
index 9568ab0..0000000
--- a/core/lib/Drupal/Core/Asset/AssetCollectionRendererInterface.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-/**
- * @file
- * Contains \Drupal\Core\Asset\AssetCollectionRendererInterface.
- */
-
-namespace Drupal\Core\Asset;
-
-/**
- * Interface defining a service that generates a render array to render assets.
- */
-interface AssetCollectionRendererInterface {
-
-  /**
-   * Renders an asset collection.
-   *
-   * @param array $assets
-   *   An asset collection.
-   *
-   * @return array
-   *   A render array to render the asset collection.
-   */
-  public function render(array $assets);
-
-}
diff --git a/core/lib/Drupal/Core/Asset/AssetDumper.php b/core/lib/Drupal/Core/Asset/AssetDumper.php
deleted file mode 100644
index b21beda..0000000
--- a/core/lib/Drupal/Core/Asset/AssetDumper.php
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-
-/**
- * Contains \Drupal\Core\Asset\AssetDumper.
- */
-
-namespace Drupal\Core\Asset;
-
-use Drupal\Core\Asset\AssetDumperInterface;
-use Drupal\Component\Utility\Crypt;
-
-/**
- * Dumps a CSS or JavaScript asset.
- */
-class AssetDumper implements AssetDumperInterface {
-
-  /**
-   * {@inheritdoc}
-   *
-   * The file name for the CSS or JS cache file is generated from the hash of
-   * the aggregated contents of the files in $data. This forces proxies and
-   * browsers to download new CSS when the CSS changes.
-   */
-  public function dump($data, $file_extension) {
-    // Prefix filename to prevent blocking by firewalls which reject files
-    // starting with "ad*".
-    $filename = $file_extension. '_' . Crypt::hashBase64($data) . '.' . $file_extension;
-    // Create the css/ or js/ path within the files folder.
-    $path = 'public://' . $file_extension;
-    $uri = $path . '/' . $filename;
-    // Create the CSS or JS file.
-    file_prepare_directory($path, FILE_CREATE_DIRECTORY);
-    if (!file_exists($uri) && !file_unmanaged_save_data($data, $uri, FILE_EXISTS_REPLACE)) {
-      return FALSE;
-    }
-    // If CSS/JS gzip compression is enabled and the zlib extension is available
-    // then create a gzipped version of this file. This file is served
-    // conditionally to browsers that accept gzip using .htaccess rules.
-    // It's possible that the rewrite rules in .htaccess aren't working on this
-    // server, but there's no harm (other than the time spent generating the
-    // file) in generating the file anyway. Sites on servers where rewrite rules
-    // aren't working can set css.gzip to FALSE in order to skip
-    // generating a file that won't be used.
-    if (config('system.performance')->get($file_extension . '.gzip') && extension_loaded('zlib')) {
-      if (!file_exists($uri . '.gz') && !file_unmanaged_save_data(gzencode($data, 9, FORCE_GZIP), $uri . '.gz', FILE_EXISTS_REPLACE)) {
-        return FALSE;
-      }
-    }
-    return $uri;
-  }
-
-}
diff --git a/core/lib/Drupal/Core/Asset/AssetDumperInterface.php b/core/lib/Drupal/Core/Asset/AssetDumperInterface.php
deleted file mode 100644
index 5f70aa6..0000000
--- a/core/lib/Drupal/Core/Asset/AssetDumperInterface.php
+++ /dev/null
@@ -1,27 +0,0 @@
-<?php
-/**
- * @file
- * Contains \Drupal\Core\Asset\AssetDumperInterface.
- */
-
-namespace Drupal\Core\Asset;
-
-/**
- * Interface defining a service that dumps an (optimized) asset.
- */
-interface AssetDumperInterface {
-
-  /**
-   * Dumps an (optimized) asset to persistent storage.
-   *
-   * @param string $data
-   *   An (optimized) asset's contents.
-   * @param string $file_extension
-   *   The file extension of this asset.
-   *
-   * @return string
-   *   An URI to access the dumped asset.
-   */
-  public function dump($data, $file_extension);
-
-}
diff --git a/core/lib/Drupal/Core/Asset/AssetOptimizerInterface.php b/core/lib/Drupal/Core/Asset/AssetOptimizerInterface.php
deleted file mode 100644
index 31c4b93..0000000
--- a/core/lib/Drupal/Core/Asset/AssetOptimizerInterface.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-/**
- * @file
- * Contains \Drupal\Core\Asset\AssetCollectionOptimizerInterface.
- */
-
-namespace Drupal\Core\Asset;
-
-/**
- * Interface defining a service that optimizes an asset.
- */
-interface AssetOptimizerInterface {
-
-  /**
-   * Optimizes an asset.
-   *
-   * @param array $asset
-   *   An asset.
-   *
-   * @return string
-   *   The optimized asset's contents.
-   */
-  public function optimize(array $asset);
-
-}
diff --git a/core/lib/Drupal/Core/Asset/CssCollectionGrouper.php b/core/lib/Drupal/Core/Asset/CssCollectionGrouper.php
deleted file mode 100644
index 2ccabfa..0000000
--- a/core/lib/Drupal/Core/Asset/CssCollectionGrouper.php
+++ /dev/null
@@ -1,97 +0,0 @@
-<?php
-
-/**
- * Contains \Drupal\Core\Asset\CssCollectionGrouper.
- */
-
-namespace Drupal\Core\Asset;
-
-use Drupal\Core\Asset\AssetCollectionGrouperInterface;
-
-/**
- * Groups CSS assets.
- */
-class CssCollectionGrouper implements AssetCollectionGrouperInterface {
-
-  /**
-   * {@inheritdoc}
-   *
-   * Puts multiple items into the same group if they are groupable and if they
-   * are for the same 'media' and 'browsers'. Items of the 'file' type are
-   * groupable if their 'preprocess' flag is TRUE, items of the 'inline' type
-   * are always groupable, and items of the 'external' type are never groupable.
-   *
-   * Also ensures that the process of grouping items does not change their
-   * relative order. This requirement may result in multiple groups for the same
-   * type, media, and browsers, if needed to accommodate other items in between.
-   */
-  public function group(array $css_assets) {
-    $groups = array();
-    // If a group can contain multiple items, we track the information that must
-    // be the same for each item in the group, so that when we iterate the next
-    // item, we can determine if it can be put into the current group, or if a
-    // new group needs to be made for it.
-    $current_group_keys = NULL;
-    // When creating a new group, we pre-increment $i, so by initializing it to
-    // -1, the first group will have index 0.
-    $i = -1;
-    foreach ($css_assets as $item) {
-      // The browsers for which the CSS item needs to be loaded is part of the
-      // information that determines when a new group is needed, but the order
-      // of keys in the array doesn't matter, and we don't want a new group if
-      // all that's different is that order.
-      ksort($item['browsers']);
-
-      // If the item can be grouped with other items, set $group_keys to an
-      // array of information that must be the same for all items in its group.
-      // If the item can't be grouped with other items, set $group_keys to
-      // FALSE. We put items into a group that can be aggregated together:
-      // whether they will be aggregated is up to the _drupal_css_aggregate()
-      // function or an
-      // override of that function specified in hook_css_alter(), but regardless
-      // of the details of that function, a group represents items that can be
-      // aggregated. Since a group may be rendered with a single HTML tag, all
-      // items in the group must share the same information that would need to
-      // be part of that HTML tag.
-      switch ($item['type']) {
-        case 'file':
-          // Group file items if their 'preprocess' flag is TRUE.
-          // Help ensure maximum reuse of aggregate files by only grouping
-          // together items that share the same 'group' value and 'every_page'
-          // flag. See drupal_add_css() for details about that.
-          $group_keys = $item['preprocess'] ? array($item['type'], $item['group'], $item['every_page'], $item['media'], $item['browsers']) : FALSE;
-          break;
-
-        case 'inline':
-          // Always group inline items.
-          $group_keys = array($item['type'], $item['media'], $item['browsers']);
-          break;
-
-        case 'external':
-          // Do not group external items.
-          $group_keys = FALSE;
-          break;
-      }
-
-      // If the group keys don't match the most recent group we're working with,
-      // then a new group must be made.
-      if ($group_keys !== $current_group_keys) {
-        $i++;
-        // Initialize the new group with the same properties as the first item
-        // being placed into it. The item's 'data', 'weight' and 'basename'
-        // properties are unique to the item and should not be carried over to
-        // the group.
-        $groups[$i] = $item;
-        unset($groups[$i]['data'], $groups[$i]['weight'], $groups[$i]['basename']);
-        $groups[$i]['items'] = array();
-        $current_group_keys = $group_keys ? $group_keys : NULL;
-      }
-
-      // Add the item to the current group.
-      $groups[$i]['items'][] = $item;
-    }
-
-    return $groups;
-  }
-
-}
diff --git a/core/lib/Drupal/Core/Asset/CssCollectionOptimizer.php b/core/lib/Drupal/Core/Asset/CssCollectionOptimizer.php
deleted file mode 100644
index 5d43231..0000000
--- a/core/lib/Drupal/Core/Asset/CssCollectionOptimizer.php
+++ /dev/null
@@ -1,179 +0,0 @@
-<?php
-
-/**
- * Contains \Drupal\Core\Asset\CssCollectionOptimizer.
- */
-
-namespace Drupal\Core\Asset;
-
-use Drupal\Core\Asset\AssetCollectionOptimizerInterface;
-use Drupal\Core\KeyValueStore\KeyValueStoreInterface;
-
-/**
- * Optimizes CSS assets.
- */
-class CssCollectionOptimizer implements AssetCollectionOptimizerInterface {
-
-  /**
-   * A CSS asset grouper.
-   *
-   * @var \Drupal\Core\Asset\CssCollectionGrouper
-   */
-  protected $grouper;
-
-  /**
-   * A CSS asset optimizer.
-   *
-   * @var \Drupal\Core\Asset\CssOptimizer
-   */
-  protected $optimizer;
-
-  /**
-   * An asset dumper.
-   *
-   * @var \Drupal\Core\Asset\AssetDumper
-   */
-  protected $dumper;
-
-  /**
-   * The state key/value store.
-   *
-   * @var \Drupal\Core\KeyValueStore\KeyValueStoreInterface
-   */
-  protected $state;
-
-  /**
-   * Constructs a CssCollectionOptimizer.
-   *
-   * @param \Drupal\Core\Asset\AssetCollectionGrouperInterface
-   *   The grouper for CSS assets.
-   * @param \Drupal\Core\Asset\AssetOptimizerInterface
-   *   The optimizer for a single CSS asset.
-   * @param \Drupal\Core\Asset\AssetDumperInterface
-   *   The dumper for optimized CSS assets.
-   * @param \Drupal\Core\KeyValueStore\KeyValueStoreInterface
-   *   The state key/value store.
-   */
-  public function __construct(AssetCollectionGrouperInterface $grouper, AssetOptimizerInterface $optimizer, AssetDumperInterface $dumper, KeyValueStoreInterface $state) {
-    $this->grouper = $grouper;
-    $this->optimizer = $optimizer;
-    $this->dumper = $dumper;
-    $this->state = $state;
-  }
-
-  /**
-   * {@inheritdoc}
-   *
-   * The cache file name is retrieved on a page load via a lookup variable that
-   * contains an associative array. The array key is the hash of the file names
-   * in $css while the value is the cache file name. The cache file is generated
-   * in two cases. First, if there is no file name value for the key, which will
-   * happen if a new file name has been added to $css or after the lookup
-   * variable is emptied to force a rebuild of the cache. Second, the cache file
-   * is generated if it is missing on disk. Old cache files are not deleted
-   * immediately when the lookup variable is emptied, but are deleted after a
-   * set period by drupal_delete_file_if_stale(). This ensures that files
-   * referenced by a cached page will still be available.
-   */
-  public function optimize(array $css_assets) {
-    // Group the assets.
-    $css_groups = $this->grouper->group($css_assets);
-
-    // Now optimize (concatenate + minify) and dump each asset group, unless
-    // that was already done, in which case it should appear in
-    // drupal_css_cache_files.
-    // Drupal contrib can override this default CSS aggregator to keep the same
-    // grouping, optimizing and dumping, but change the strategy that is used to
-    // determine when the aggregate should be rebuilt (e.g. mtime, HTTPS â€¦).
-    $map = $this->state->get('drupal_css_cache_files') ?: array();
-    $css_assets = array();
-    foreach ($css_groups as $order => $css_group) {
-      // We have to return a single asset, not a group of assets. It is now up
-      // to one of the pieces of code in the switch statement below to set the
-      // 'data' property to the appropriate value.
-      $css_assets[$order] = $css_group;
-      unset($css_assets[$order]['items']);
-
-      switch ($css_group['type']) {
-        case 'file':
-          // No preprocessing, single CSS asset: just use the existing URI.
-          if (!$css_group['preprocess']) {
-            $uri = $css_group['items'][0]['data'];
-            $css_assets[$order]['data'] = $uri;
-          }
-          // Preprocess (aggregate), unless the aggregate file already exists.
-          else {
-            $key = $this->generateHash($css_group);
-            $uri = '';
-            if (isset($map[$key])) {
-              $uri = $map[$key];
-            }
-            if (empty($uri) || !file_exists($uri)) {
-              // Optimize each asset within the group.
-              $data = '';
-              foreach ($css_group['items'] as $css_asset) {
-                $data .= $this->optimizer->optimize($css_asset);
-              }
-              // Per the W3C specification at
-              // http://www.w3.org/TR/REC-CSS2/cascade.html#at-import, @import
-              // rules must proceed any other style, so we move those to the
-              // top.
-              $regexp = '/@import[^;]+;/i';
-              preg_match_all($regexp, $data, $matches);
-              $data = preg_replace($regexp, '', $data);
-              $data = implode('', $matches[0]) . $data;
-              // Dump the optimized CSS for this group into an aggregate file.
-              $uri = $this->dumper->dump($data, 'css');
-              // Set the URI for this group's aggregate file.
-              $css_assets[$order]['data'] = $uri;
-              // Persist the URI for this aggregate file.
-              $map[$key] = $uri;
-              $this->state->set('drupal_css_cache_files', $map);
-            }
-            else {
-              // Use the persisted URI for the optimized CSS file.
-              $css_assets[$order]['data'] = $uri;
-            }
-            $css_assets[$order]['preprocessed'] = TRUE;
-          }
-          break;
-
-        case 'inline':
-          // We don't do any caching for inline CSS assets.
-          $data = '';
-          foreach ($css_group['items'] as $css_asset) {
-            $data .= $this->optimizer->optimize($css_asset);
-          }
-          unset($css_assets[$order]['data']['items']);
-          $css_assets[$order]['data'] = $data;
-          break;
-
-        case 'external':
-          // We don't do any aggregation and hence also no caching for external
-          // CSS assets.
-          $uri = $css_group['items'][0]['data'];
-          $css_assets[$order]['data'] = $uri;
-          break;
-      }
-    }
-
-    return $css_assets;
-  }
-
-  /**
-   * Generate a hash for a given group of CSS assets.
-   *
-   * @param array $css_group
-   *   A group of CSS assets.
-   *
-   * @return string
-   *   A hash to uniquely identify the given group of CSS assets.
-   */
-  protected function generateHash(array $css_group) {
-    $css_data = array();
-    foreach ($css_group['items'] as $css_file) {
-      $css_data[] = $css_file['data'];
-    }
-    return hash('sha256', serialize($css_data));
-  }
-}
diff --git a/core/lib/Drupal/Core/Asset/CssCollectionRenderer.php b/core/lib/Drupal/Core/Asset/CssCollectionRenderer.php
deleted file mode 100644
index 6d36ede..0000000
--- a/core/lib/Drupal/Core/Asset/CssCollectionRenderer.php
+++ /dev/null
@@ -1,177 +0,0 @@
-<?php
-
-/**
- * Contains \Drupal\Core\Asset\CssCollectionRenderer.
- */
-
-namespace Drupal\Core\Asset;
-
-use Drupal\Core\Asset\AssetCollectionRendererInterface;
-use Drupal\Component\Utility\String;
-
-/**
- * Renders CSS assets.
- */
-class CssCollectionRenderer implements AssetCollectionRendererInterface {
-
-  /**
-   * {@inheritdoc}
-   */
-  public function render(array $css_assets) {
-    $elements = array();
-
-    // A dummy query-string is added to filenames, to gain control over
-    // browser-caching. The string changes on every update or full cache
-    // flush, forcing browsers to load a new copy of the files, as the
-    // URL changed.
-    $query_string = variable_get('css_js_query_string', '0');
-
-    // Defaults for LINK and STYLE elements.
-    $link_element_defaults = array(
-      '#type' => 'html_tag',
-      '#tag' => 'link',
-      '#attributes' => array(
-        'rel' => 'stylesheet',
-      ),
-    );
-    $style_element_defaults = array(
-      '#type' => 'html_tag',
-      '#tag' => 'style',
-    );
-
-    // For filthy IE hack.
-    $current_ie_group_keys = NULL;
-    $get_ie_group_key = function ($css_asset) {
-      return array($css_asset['type'], $css_asset['preprocess'], $css_asset['group'], $css_asset['every_page'], $css_asset['media'], $css_asset['browsers']);
-    };
-
-    // Loop through all CSS assets, by key, to allow for the special IE
-    // workaround.
-    $css_assets_keys = array_keys($css_assets);
-    for ($i = 0; $i < count($css_assets_keys); $i++) {
-      $css_asset = $css_assets[$css_assets_keys[$i]];
-      switch ($css_asset['type']) {
-        // For file items, there are three possibilites.
-        // - There are up to 31 CSS assets on the page (some of which may be
-        //   aggregated). In this case, output a LINK tag for file CSS assets.
-        // - There are more than 31 CSS assets on the page, yet we must stay
-        //   below IE<10's limit of 31 total CSS inclussion tags, we handle this
-        //   in two ways:
-        //    - file CSS assets that are not eligible for aggregation (their
-        //      'preprocess' flag has been set to FALSE): in this case, output a
-        //      LINK tag.
-        //    - file CSS assets that can be aggregated (and possibly have been):
-        //      in this case, figure out which subsequent file CSS assets share
-        //      the same key properties ('group', 'every_page', 'media' and
-        //      'browsers') and output this group into as few STYLE tags as
-        //      possible (a STYLE tag may contain only 31 @import statements).
-        case 'file':
-          // The dummy query string needs to be added to the URL to control
-          // browser-caching.
-          $query_string_separator = (strpos($css_asset['data'], '?') !== FALSE) ? '&' : '?';
-
-          // As long as the current page will not run into IE's limit for CSS
-          // assets: output a LINK tag for a file CSS asset.
-          if (count($css_assets) <= 31) {
-            $element = $link_element_defaults;
-            $element['#attributes']['href'] = file_create_url($css_asset['data']) . $query_string_separator . $query_string;;
-            $element['#attributes']['media'] = $css_asset['media'];
-            $element['#browsers'] = $css_asset['browsers'];
-            $elements[] = $element;
-          }
-          // The current page will run into IE's limits for CSS assets: work
-          // around these limits by performing a light form of grouping.
-          // Once Drupal only needs to support IE10 and later, we can drop this.
-          else {
-            // The file CSS asset is ineligible for aggregation: output it in a
-            // LINK tag.
-            if (!$css_asset['preprocess']) {
-              $element = $link_element_defaults;
-              $element['#attributes']['href'] = file_create_url($css_asset['data']) . $query_string_separator . $query_string;
-              $element['#attributes']['media'] = $css_asset['media'];
-              $element['#browsers'] = $css_asset['browsers'];
-              $elements[] = $element;
-            }
-            // The file CSS asset can be aggregated, but hasn't been: combine
-            // multiple items into as few STYLE tags as possible.
-            else {
-              $import = array();
-              // Start with the current CSS asset, iterate over subsequent CSS
-              // assets and find which ones have the same 'type', 'group',
-              // 'every_page', 'preprocess', 'media' and 'browsers' properties.
-              $j = $i;
-              $next_css_asset = $css_asset;
-              $current_ie_group_key = $get_ie_group_key($css_asset);
-              do {
-                // The dummy query string needs to be added to the URL to
-                // control browser-caching. IE7 does not support a media type on
-                // the @import statement, so we instead specify the media for
-                // the group on the STYLE tag.
-                $import[] = '@import url("' . String::checkPlain(file_create_url($next_css_asset['data']) . '?' . $query_string) . '");';
-                // Move the outer for loop skip the next item, since we
-                // processed it here.
-                $i = $j;
-                // Retrieve next CSS asset, unless there is none: then break.
-                if ($j + 1 < count($css_assets_keys)) {
-                  $j++;
-                  $next_css_asset = $css_assets[$css_assets_keys[$j]];
-                }
-                else {
-                  break;
-                }
-              } while ($get_ie_group_key($next_css_asset) == $current_ie_group_key);
-
-              // In addition to IE's limit of 31 total CSS inclusion tags, it
-              // also has a limit of 31 @import statements per STYLE tag.
-              while (!empty($import)) {
-                $import_batch = array_slice($import, 0, 31);
-                $import = array_slice($import, 31);
-                $element = $style_element_defaults;
-                // This simplifies the JavaScript regex, allowing each line
-                // (separated by \n) to be treated as a completely different
-                // string. This means that we can use ^ and $ on one line at a
-                // time, and not worry about style tags since they'll never
-                // match the regex.
-                $element['#value'] = "\n" . implode("\n", $import_batch) . "\n";
-                $element['#attributes']['media'] = $css_asset['media'];
-                $element['#browsers'] = $css_asset['browsers'];
-                $elements[] = $element;
-              }
-            }
-          }
-          break;
-
-        // Output a STYLE tag for an inline CSS asset. The asset's 'data'
-        // property contains the CSS content.
-        case 'inline':
-          $element = $style_element_defaults;
-          $element['#value'] = $css_asset['data'];
-          $element['#attributes']['media'] = $css_asset['media'];
-          $element['#browsers'] = $css_asset['browsers'];
-          // For inline CSS to validate as XHTML, all CSS containing XHTML needs
-          // to be wrapped in CDATA. To make that backwards compatible with HTML
-          // 4, we need to comment out the CDATA-tag.
-          $element['#value_prefix'] = "\n/* <![CDATA[ */\n";
-          $element['#value_suffix'] = "\n/* ]]> */\n";
-          $elements[] = $element;
-          break;
-
-        // Output a LINK tag for an external CSS asset. The asset's 'data'
-        // property contains the full URL.
-        case 'external':
-          $element = $link_element_defaults;
-          $element['#attributes']['href'] = $css_asset['data'];
-          $element['#attributes']['media'] = $css_asset['media'];
-          $element['#browsers'] = $css_asset['browsers'];
-          $elements[] = $element;
-          break;
-
-        default:
-          throw new \Exception('Invalid CSS asset type.');
-      }
-    }
-
-    return $elements;
-  }
-
-}
diff --git a/core/lib/Drupal/Core/Asset/CssOptimizer.php b/core/lib/Drupal/Core/Asset/CssOptimizer.php
deleted file mode 100644
index 2cf07e7..0000000
--- a/core/lib/Drupal/Core/Asset/CssOptimizer.php
+++ /dev/null
@@ -1,229 +0,0 @@
-<?php
-
-/**
- * Contains \Drupal\Core\Asset\CssOptimizer.
- */
-
-namespace Drupal\Core\Asset;
-
-use Drupal\Core\Asset\AssetOptimizerInterface;
-
-/**
- * Optimizes a CSS asset.
- */
-class CssOptimizer implements AssetOptimizerInterface {
-
-  /**
-   * The base path used by rewriteFileURI().
-   *
-   * @var string
-   */
-  public $rewriteFileURIBasePath;
-
-  /**
-   * {@inheritdoc}
-   */
-  public function optimize(array $css_asset) {
-    if (!in_array($css_asset['type'], array('file', 'inline'))) {
-      throw new \Exception('Only file or inline CSS assets can be optimized.');
-    }
-    if ($css_asset['type'] === 'file' && !$css_asset['preprocess']) {
-      throw new \Exception('Only file CSS assets with preprocessing enabled can be optimized.');
-    }
-
-    if ($css_asset['type'] === 'file') {
-      return $this->processFile($css_asset);
-    }
-    else {
-      return $this->processCss($css_asset['data'], $css_asset['preprocess']);
-    }
-  }
-
-  /**
-   * Build aggregate CSS file.
-   */
-  protected function processFile($css_asset) {
-    $contents = $this->loadFile($css_asset['data'], TRUE);
-
-    // Get the parent directory of this file, relative to the Drupal root.
-    $css_base_path = substr($css_asset['data'], 0, strrpos($css_asset['data'], '/'));
-    // Store base path.
-    $this->rewriteFileURIBasePath = $css_base_path . '/';
-
-    // Anchor all paths in the CSS with its base URL, ignoring external and absolute paths.
-    return preg_replace_callback('/url\(\s*[\'"]?(?![a-z]+:|\/+)([^\'")]+)[\'"]?\s*\)/i', array($this, 'rewriteFileURI'), $contents);
-  }
-
-  /**
-   * Loads the stylesheet and resolves all @import commands.
-   *
-   * Loads a stylesheet and replaces @import commands with the contents of the
-   * imported file. Use this instead of file_get_contents when processing
-   * stylesheets.
-   *
-   * The returned contents are compressed removing white space and comments only
-   * when CSS aggregation is enabled. This optimization will not apply for
-   * color.module enabled themes with CSS aggregation turned off.
-   *
-   * Note: the only reason this method is public is so color.module can call it;
-   * it is not on the AssetOptimizerInterface, so future refactorings can make
-   * it protected.
-   *
-   * @param $file
-   *   Name of the stylesheet to be processed.
-   * @param $optimize
-   *   Defines if CSS contents should be compressed or not.
-   * @param $reset_basepath
-   *   Used internally to facilitate recursive resolution of @import commands.
-   *
-   * @return
-   *   Contents of the stylesheet, including any resolved @import commands.
-   */
-  public function loadFile($file, $optimize = NULL, $reset_basepath = TRUE) {
-    // These statics are not cache variables, so we don't use drupal_static().
-    static $_optimize, $basepath;
-    if ($reset_basepath) {
-      $basepath = '';
-    }
-    // Store the value of $optimize for preg_replace_callback with nested
-    // @import loops.
-    if (isset($optimize)) {
-      $_optimize = $optimize;
-    }
-
-    // Stylesheets are relative one to each other. Start by adding a base path
-    // prefix provided by the parent stylesheet (if necessary).
-    if ($basepath && !file_uri_scheme($file)) {
-      $file = $basepath . '/' . $file;
-    }
-    $basepath = dirname($file);
-
-    // Load the CSS stylesheet. We suppress errors because themes may specify
-    // stylesheets in their .info.yml file that don't exist in the theme's path,
-    // but are merely there to disable certain module CSS files.
-    if ($contents = @file_get_contents($file)) {
-      // Return the processed stylesheet.
-      return $this->processCss($contents, $_optimize);
-    }
-
-    return '';
-  }
-
-  /**
-   * Loads stylesheets recursively and returns contents with corrected paths.
-   *
-   * This function is used for recursive loading of stylesheets and
-   * returns the stylesheet content with all url() paths corrected.
-   *
-   * @param array $matches
-   *   An array of matches by a preg_replace_callback() call that scans for
-   *   @import-ed CSS files, except for external CSS files.
-   * @return
-   *   The contents of the CSS file at $matches[1], with corrected paths.
-   *
-   * @see Drupal\Core\Asset\AssetOptimizerInterface::loadFile()
-   */
-  protected function loadNestedFile($matches) {
-    $filename = $matches[1];
-    // Load the imported stylesheet and replace @import commands in there as
-    // well.
-    $file = $this->loadFile($filename, NULL, FALSE);
-
-    // Determine the file's directory.
-    $directory = dirname($filename);
-    // If the file is in the current directory, make sure '.' doesn't appear in
-    // the url() path.
-    $directory = $directory == '.' ? '' : $directory .'/';
-
-    // Alter all internal url() paths. Leave external paths alone. We don't need
-    // to normalize absolute paths here (i.e. remove folder/... segments)
-    // because that will be done later.
-    return preg_replace('/url\(\s*([\'"]?)(?![a-z]+:|\/+)/i', 'url(\1'. $directory, $file);
-  }
-
-  /**
-   * Processes the contents of a stylesheet for aggregation.
-   *
-   * @param $contents
-   *   The contents of the stylesheet.
-   * @param $optimize
-   *   (optional) Boolean whether CSS contents should be minified. Defaults to
-   *   FALSE.
-   *
-   * @return
-   *   Contents of the stylesheet including the imported stylesheets.
-   */
-  protected function processCss($contents, $optimize = FALSE) {
-    // Remove multiple charset declarations for standards compliance (and fixing Safari problems).
-    $contents = preg_replace('/^@charset\s+[\'"](\S*)\b[\'"];/i', '', $contents);
-
-    if ($optimize) {
-      // Perform some safe CSS optimizations.
-      // Regexp to match comment blocks.
-      $comment     = '/\*[^*]*\*+(?:[^/*][^*]*\*+)*/';
-      // Regexp to match double quoted strings.
-      $double_quot = '"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"';
-      // Regexp to match single quoted strings.
-      $single_quot = "'[^'\\\\]*(?:\\\\.[^'\\\\]*)*'";
-      // Strip all comment blocks, but keep double/single quoted strings.
-      $contents = preg_replace(
-        "<($double_quot|$single_quot)|$comment>Ss",
-        "$1",
-        $contents
-      );
-      // Remove certain whitespace.
-      // There are different conditions for removing leading and trailing
-      // whitespace.
-      // @see http://php.net/manual/regexp.reference.subpatterns.php
-      $contents = preg_replace('<
-        # Strip leading and trailing whitespace.
-          \s*([@{};,])\s*
-        # Strip only leading whitespace from:
-        # - Closing parenthesis: Retain "@media (bar) and foo".
-        | \s+([\)])
-        # Strip only trailing whitespace from:
-        # - Opening parenthesis: Retain "@media (bar) and foo".
-        # - Colon: Retain :pseudo-selectors.
-        | ([\(:])\s+
-      >xS',
-        // Only one of the three capturing groups will match, so its reference
-        // will contain the wanted value and the references for the
-        // two non-matching groups will be replaced with empty strings.
-        '$1$2$3',
-        $contents
-      );
-      // End the file with a new line.
-      $contents = trim($contents);
-      $contents .= "\n";
-    }
-
-    // Replaces @import commands with the actual stylesheet content.
-    // This happens recursively but omits external files.
-    $contents = preg_replace_callback('/@import\s*(?:url\(\s*)?[\'"]?(?![a-z]+:)([^\'"\()]+)[\'"]?\s*\)?\s*;/', array($this, 'loadNestedFile'), $contents);
-
-    return $contents;
-  }
-
-  /**
-   * Prefixes all paths within a CSS file for processFile().
-   *
-   * @param array $matches
-   *   An array of matches by a preg_replace_callback() call that scans for
-   *   url() references in CSS files, except for external or absolute ones.
-   *
-   * Note: the only reason this method is public is so color.module can call it;
-   * it is not on the AssetOptimizerInterface, so future refactorings can make
-   * it protected.
-   */
-  public function rewriteFileURI($matches) {
-    // Prefix with base and remove '../' segments where possible.
-    $path = $this->rewriteFileURIBasePath . $matches[1];
-    $last = '';
-    while ($path != $last) {
-      $last = $path;
-      $path = preg_replace('`(^|/)(?!\.\./)([^/]+)/\.\./`', '$1', $path);
-    }
-    return 'url(' . file_create_url($path) . ')';
-  }
-
-}
diff --git a/core/lib/Drupal/Core/Asset/JsCollectionGrouper.php b/core/lib/Drupal/Core/Asset/JsCollectionGrouper.php
deleted file mode 100644
index 9f0aed0..0000000
--- a/core/lib/Drupal/Core/Asset/JsCollectionGrouper.php
+++ /dev/null
@@ -1,80 +0,0 @@
-<?php
-
-/**
- * Contains \Drupal\Core\Asset\JsCollectionGrouper.
- */
-
-namespace Drupal\Core\Asset;
-
-use Drupal\Core\Asset\AssetCollectionGrouperInterface;
-
-/**
- * Groups JavaScript assets.
- */
-class JsCollectionGrouper implements AssetCollectionGrouperInterface {
-
-  /**
-   * {@inheritdoc}
-   *
-   * Puts multiple items into the same group if they are groupable and if they
-   * are for the same browsers. Items of the 'file' type are groupable if their
-   * 'preprocess' flag is TRUE. Items of the 'inline', 'settings', or 'external'
-   * type are not groupable.
-   *
-   * Also ensures that the process of grouping items does not change their
-   * relative order. This requirement may result in multiple groups for the same
-   * type and browsers, if needed to accommodate other items in between.
-   */
-  public function group(array $js_assets) {
-    $groups = array();
-    // If a group can contain multiple items, we track the information that must
-    // be the same for each item in the group, so that when we iterate the next
-    // item, we can determine if it can be put into the current group, or if a
-    // new group needs to be made for it.
-    $current_group_keys = NULL;
-    $index = -1;
-    foreach ($js_assets as $item) {
-      // The browsers for which the JavaScript item needs to be loaded is part
-      // of the information that determines when a new group is needed, but the
-      // order of keys in the array doesn't matter, and we don't want a new
-      // group if all that's different is that order.
-      ksort($item['browsers']);
-
-      switch ($item['type']) {
-        case 'file':
-          // Group file items if their 'preprocess' flag is TRUE.
-          // Help ensure maximum reuse of aggregate files by only grouping
-          // together items that share the same 'group' value and 'every_page'
-          // flag. See drupal_add_js() for details about that.
-          $group_keys = $item['preprocess'] ? array($item['type'], $item['group'], $item['every_page'], $item['browsers']) : FALSE;
-          break;
-
-        case 'external':
-        case 'setting':
-        case 'inline':
-          // Do not group external, settings, and inline items.
-          $group_keys = FALSE;
-          break;
-      }
-
-      // If the group keys don't match the most recent group we're working with,
-      // then a new group must be made.
-      if ($group_keys !== $current_group_keys) {
-        $index++;
-        // Initialize the new group with the same properties as the first item
-        // being placed into it. The item's 'data' and 'weight' properties are
-        // unique to the item and should not be carried over to the group.
-        $groups[$index] = $item;
-        unset($groups[$index]['data'], $groups[$index]['weight']);
-        $groups[$index]['items'] = array();
-        $current_group_keys = $group_keys ? $group_keys : NULL;
-      }
-
-      // Add the item to the current group.
-      $groups[$index]['items'][] = $item;
-    }
-
-    return $groups;
-  }
-
-}
diff --git a/core/lib/Drupal/Core/Asset/JsCollectionOptimizer.php b/core/lib/Drupal/Core/Asset/JsCollectionOptimizer.php
deleted file mode 100644
index bf4cbf6..0000000
--- a/core/lib/Drupal/Core/Asset/JsCollectionOptimizer.php
+++ /dev/null
@@ -1,167 +0,0 @@
-<?php
-
-/**
- * Contains \Drupal\Core\Asset\JsCollectionOptimizer.
- */
-
-namespace Drupal\Core\Asset;
-
-use Drupal\Core\Asset\AssetCollectionOptimizerInterface;
-use Drupal\Core\KeyValueStore\KeyValueStoreInterface;
-
-
-/**
- * Optimizes JavaScript assets.
- */
-class JsCollectionOptimizer implements AssetCollectionOptimizerInterface {
-
-  /**
-   * A JS asset grouper.
-   *
-   * @var \Drupal\Core\Asset\JsCollectionGrouper
-   */
-  protected $grouper;
-
-  /**
-   * A JS asset optimizer.
-   *
-   * @var \Drupal\Core\Asset\JsOptimizer
-   */
-  protected $optimizer;
-
-  /**
-   * An asset dumper.
-   *
-   * @var \Drupal\Core\Asset\AssetDumper
-   */
-  protected $dumper;
-
-  /**
-   * The state key/value store.
-   *
-   * @var \Drupal\Core\KeyValueStore\KeyValueStoreInterface
-   */
-  protected $state;
-
-  /**
-   * Constructs a JsCollectionOptimizer.
-   *
-   * @param \Drupal\Core\Asset\AssetCollectionGrouperInterface
-   *   The grouper for JS assets.
-   * @param \Drupal\Core\Asset\AssetOptimizerInterface
-   *   The optimizer for a single JS asset.
-   * @param \Drupal\Core\Asset\AssetDumperInterface
-   *   The dumper for optimized JS assets.
-   * @param \Drupal\Core\KeyValueStore\KeyValueStoreInterface
-   *   The state key/value store.
-   */
-  public function __construct(AssetCollectionGrouperInterface $grouper, AssetOptimizerInterface $optimizer, AssetDumperInterface $dumper, KeyValueStoreInterface $state) {
-    $this->grouper = $grouper;
-    $this->optimizer = $optimizer;
-    $this->dumper = $dumper;
-    $this->state = $state;
-  }
-
-  /**
-   * {@inheritdoc}
-   *
-   * The cache file name is retrieved on a page load via a lookup variable that
-   * contains an associative array. The array key is the hash of the names in
-   * $files while the value is the cache file name. The cache file is generated
-   * in two cases. First, if there is no file name value for the key, which will
-   * happen if a new file name has been added to $files or after the lookup
-   * variable is emptied to force a rebuild of the cache. Second, the cache file
-   * is generated if it is missing on disk. Old cache files are not deleted
-   * immediately when the lookup variable is emptied, but are deleted after a
-   * set period by drupal_delete_file_if_stale(). This ensures that files
-   * referenced by a cached page will still be available.
-   */
-  public function optimize(array $js_assets) {
-    // Group the assets.
-    $js_groups = $this->grouper->group($js_assets);
-
-    // Now optimize (concatenate, not minify) and dump each asset group, unless
-    // that was already done, in which case it should appear in
-    // system.js_cache_files.
-    // Drupal contrib can override this default JS aggregator to keep the same
-    // grouping, optimizing and dumping, but change the strategy that is used to
-    // determine when the aggregate should be rebuilt (e.g. mtime, HTTPS â€¦).
-    $map = $this->state->get('system.js_cache_files') ?: array();
-    $js_assets = array();
-    foreach ($js_groups as $order => $js_group) {
-      // We have to return a single asset, not a group of assets. It is now up
-      // to one of the pieces of code in the switch statement below to set the
-      // 'data' property to the appropriate value.
-      $js_assets[$order] = $js_group;
-      unset($js_assets[$order]['items']);
-
-      switch ($js_group['type']) {
-        case 'file':
-          // No preprocessing, single JS asset: just use the existing URI.
-          if (!$js_group['preprocess']) {
-            $uri = $js_group['items'][0]['data'];
-            $js_assets[$order]['data'] = $uri;
-          }
-          // Preprocess (aggregate), unless the aggregate file already exists.
-          else {
-            $key = $this->generateHash($js_group);
-            $uri = '';
-            if (isset($map[$key])) {
-              $uri = $map[$key];
-            }
-            if (empty($uri) || !file_exists($uri)) {
-              // Concatenate each asset within the group.
-              $data = '';
-              foreach ($js_group['items'] as $js_asset) {
-                $data .= $this->optimizer->optimize($js_asset);
-                // Append a ';' and a newline after each JS file to prevent them
-                // from running together.
-                $data .= ";\n";
-              }
-              // Dump the optimized JS for this group into an aggregate file.
-              $uri = $this->dumper->dump($data, 'js');
-              // Set the URI for this group's aggregate file.
-              $js_assets[$order]['data'] = $uri;
-              // Persist the URI for this aggregate file.
-              $map[$key] = $uri;
-              $this->state->set('system.js_cache_files', $map);
-            }
-            else {
-              // Use the persisted URI for the optimized JS file.
-              $js_assets[$order]['data'] = $uri;
-            }
-            $js_assets[$order]['preprocessed'] = TRUE;
-          }
-          break;
-
-        case 'external':
-        case 'setting':
-        case 'inline':
-          // We don't do any aggregation and hence also no caching for external,
-          // setting or inline JS assets.
-          $uri = $js_group['items'][0]['data'];
-          $js_assets[$order]['data'] = $uri;
-          break;
-      }
-    }
-
-    return $js_assets;
-  }
-
-  /**
-   * Generate a hash for a given group of JavaScript assets.
-   *
-   * @param array $js_group
-   *   A group of JavaScript assets.
-   *
-   * @return string
-   *   A hash to uniquely identify the given group of JavaScript assets.
-   */
-  protected function generateHash(array $js_group) {
-    $js_data = array();
-    foreach ($js_group['items'] as $js_file) {
-      $js_data[] = $js_file['data'];
-    }
-    return hash('sha256', serialize($js_data));
-  }
-}
diff --git a/core/lib/Drupal/Core/Asset/JsCollectionRenderer.php b/core/lib/Drupal/Core/Asset/JsCollectionRenderer.php
deleted file mode 100644
index b9f6582..0000000
--- a/core/lib/Drupal/Core/Asset/JsCollectionRenderer.php
+++ /dev/null
@@ -1,97 +0,0 @@
-<?php
-
-/**
- * Contains \Drupal\Core\Asset\JsCollectionRenderer.
- */
-
-namespace Drupal\Core\Asset;
-
-use Drupal\Core\Asset\AssetCollectionRendererInterface;
-
-/**
- * Renders JavaScript assets.
- */
-class JsCollectionRenderer implements AssetCollectionRendererInterface {
-
-  /**
-   * {@inheritdoc}
-   */
-  public function render(array $js_assets) {
-    $elements = array();
-
-    // A dummy query-string is added to filenames, to gain control over
-    // browser-caching. The string changes on every update or full cache
-    // flush, forcing browsers to load a new copy of the files, as the
-    // URL changed. Files that should not be cached (see drupal_add_js())
-    // get REQUEST_TIME as query-string instead, to enforce reload on every
-    // page request.
-    $default_query_string = variable_get('css_js_query_string', '0');
-
-    // For inline JavaScript to validate as XHTML, all JavaScript containing
-    // XHTML needs to be wrapped in CDATA. To make that backwards compatible
-    // with HTML 4, we need to comment out the CDATA-tag.
-    $embed_prefix = "\n<!--//--><![CDATA[//><!--\n";
-    $embed_suffix = "\n//--><!]]>\n";
-
-    // Since JavaScript may look for arguments in the URL and act on them, some
-    // third-party code might require the use of a different query string.
-    $js_version_string = variable_get('drupal_js_version_query_string', 'v=');
-
-    // Defaults for each SCRIPT element.
-    $element_defaults = array(
-      '#type' => 'html_tag',
-      '#tag' => 'script',
-      '#value' => '',
-    );
-
-    // Loop through all JS assets.
-    foreach ($js_assets as $js_asset) {
-      // Element properties that do not depend on JS asset type.
-      $element = $element_defaults;
-      $element['#browsers'] = $js_asset['browsers'];
-
-      // Element properties that depend on item type.
-      switch ($js_asset['type']) {
-        case 'setting':
-          $element['#value_prefix'] = $embed_prefix;
-          $element['#value'] = 'var drupalSettings = ' . drupal_json_encode(drupal_merge_js_settings($js_asset['data'])) . ";";
-          $element['#value_suffix'] = $embed_suffix;
-          break;
-
-        case 'inline':
-          $element['#value_prefix'] = $embed_prefix;
-          $element['#value'] = $js_asset['data'];
-          $element['#value_suffix'] = $embed_suffix;
-          break;
-
-        case 'file':
-          $query_string = empty($js_asset['version']) ? $default_query_string : $js_version_string . $js_asset['version'];
-          $query_string_separator = (strpos($js_asset['data'], '?') !== FALSE) ? '&' : '?';
-          $element['#attributes']['src'] = file_create_url($js_asset['data']);
-          // Only add the cache-busting query string if this isn't an aggregate
-          // file.
-          if (!isset($js_asset['preprocessed'])) {
-            $element['#attributes']['src'] .= $query_string_separator . ($js_asset['cache'] ? $query_string : REQUEST_TIME);
-          }
-          break;
-
-        case 'external':
-          $element['#attributes']['src'] = $js_asset['data'];
-          break;
-
-        default:
-          throw new \Exception('Invalid JS asset type.');
-      }
-
-      // Attributes may only be set if this script is output independently.
-      if (!empty($element['#attributes']['src']) && !empty($js_asset['attributes'])) {
-        $element['#attributes'] += $js_asset['attributes'];
-      }
-
-      $elements[] = $element;
-    }
-
-    return $elements;
-  }
-
-}
diff --git a/core/lib/Drupal/Core/Asset/JsOptimizer.php b/core/lib/Drupal/Core/Asset/JsOptimizer.php
deleted file mode 100644
index e6ad293..0000000
--- a/core/lib/Drupal/Core/Asset/JsOptimizer.php
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-
-/**
- * Contains \Drupal\Core\Asset\JsOptimizer.
- */
-
-namespace Drupal\Core\Asset;
-
-use Drupal\Core\Asset\AssetOptimizerInterface;
-
-/**
- * Optimizes a JavaScript asset.
- */
-class JsOptimizer implements AssetOptimizerInterface {
-
-  /**
-   * {@inheritdoc}
-   */
-  public function optimize(array $js_asset) {
-    if ($js_asset['type'] !== 'file') {
-      throw new \Exception('Only file JavaScript assets can be optimized.');
-    }
-    if ($js_asset['type'] === 'file' && !$js_asset['preprocess']) {
-      throw new \Exception('Only file JavaScript assets with preprocessing enabled can be optimized.');
-    }
-
-    // No-op optimizer: no optimizations are applied to JavaScript assets.
-    return file_get_contents($js_asset['data']);
-  }
-
-}
diff --git a/core/lib/Drupal/Core/Cache/CacheCollector.php b/core/lib/Drupal/Core/Cache/CacheCollector.php
index 21d5487..afc6922 100644
--- a/core/lib/Drupal/Core/Cache/CacheCollector.php
+++ b/core/lib/Drupal/Core/Cache/CacheCollector.php
@@ -176,11 +176,11 @@ public function delete($key) {
    * Flags an offset value to be written to the persistent cache.
    *
    * @param string $key
-   *   The key that was requested.
+   *   The key that was request.
    * @param bool $persist
    *   (optional) Whether the offset should be persisted or not, defaults to
    *   TRUE. When called with $persist = FALSE the offset will be unflagged so
-   *   that it will not be written at the end of the request.
+   *   that it will not written at the end of the request.
    */
   protected function persist($key, $persist = TRUE) {
     $this->keysToPersist[$key] = $persist;
diff --git a/core/lib/Drupal/Core/Config/CachedStorage.php b/core/lib/Drupal/Core/Config/CachedStorage.php
index ec143e8..7d094b4 100644
--- a/core/lib/Drupal/Core/Config/CachedStorage.php
+++ b/core/lib/Drupal/Core/Config/CachedStorage.php
@@ -16,7 +16,7 @@
  * the cache and delegates the read to the storage on a cache miss. It also
  * handles cache invalidation.
  */
-class CachedStorage implements StorageInterface, StorageCacheInterface {
+class CachedStorage implements StorageInterface {
 
   /**
    * The configuration storage to be cached.
@@ -33,13 +33,6 @@ class CachedStorage implements StorageInterface, StorageCacheInterface {
   protected $cache;
 
   /**
-   * List of listAll() prefixes with their results.
-   *
-   * @var array
-   */
-  protected $findByPrefixCache = array();
-
-  /**
    * Constructs a new CachedStorage controller.
    *
    * @param Drupal\Core\Config\StorageInterface $storage
@@ -87,32 +80,6 @@ public function read($name) {
   }
 
   /**
-   * {@inheritdoc}
-   */
-  public function readMultiple(array $names) {
-    $list = array();
-    // The names array is passed by reference and will only contain the names of
-    // config object not found after the method call.
-    // @see Drupal\Core\Cache\CacheBackendInterface::getMultiple()
-    $cached_list = $this->cache->getMultiple($names);
-
-    if (!empty($names)) {
-      $list = $this->storage->readMultiple($names);
-      // Cache configuration objects that were loaded from the storage.
-      foreach ($list as $name => $data) {
-        $this->cache->set($name, $data, CacheBackendInterface::CACHE_PERMANENT);
-      }
-    }
-
-    // Add the configuration objects from the cache to the list.
-    foreach ($cached_list as $name => $cache) {
-      $list[$name] = $cache->data;
-    }
-
-    return $list;
-  }
-
-  /**
    * Implements Drupal\Core\Config\StorageInterface::write().
    */
   public function write($name, array $data) {
@@ -120,8 +87,6 @@ public function write($name, array $data) {
       // While not all written data is read back, setting the cache instead of
       // just deleting it avoids cache rebuild stampedes.
       $this->cache->set($name, $data, CacheBackendInterface::CACHE_PERMANENT);
-      $this->cache->deleteTags(array($this::FIND_BY_PREFIX_CACHE_TAG => TRUE));
-      $this->findByPrefixCache = array();
       return TRUE;
     }
     return FALSE;
@@ -135,8 +100,6 @@ public function delete($name) {
     // rebuilding the cache before the storage is gone.
     if ($this->storage->delete($name)) {
       $this->cache->delete($name);
-      $this->cache->deleteTags(array($this::FIND_BY_PREFIX_CACHE_TAG => TRUE));
-      $this->findByPrefixCache = array();
       return TRUE;
     }
     return FALSE;
@@ -151,8 +114,6 @@ public function rename($name, $new_name) {
     if ($this->storage->rename($name, $new_name)) {
       $this->cache->delete($name);
       $this->cache->delete($new_name);
-      $this->cache->deleteTags(array($this::FIND_BY_PREFIX_CACHE_TAG => TRUE));
-      $this->findByPrefixCache = array();
       return TRUE;
     }
     return FALSE;
@@ -173,50 +134,12 @@ public function decode($raw) {
   }
 
   /**
-   * {@inheritdoc}
-   */
-  public function listAll($prefix = '') {
-    // Do not cache when a prefix is not provided.
-    if ($prefix) {
-      return $this->findByPrefix($prefix);
-    }
-    return $this->storage->listAll();
-  }
-
-  /**
-   * Finds configuration object names starting with a given prefix.
+   * Implements Drupal\Core\Config\StorageInterface::listAll().
    *
-   * Given the following configuration objects:
-   * - node.type.article
-   * - node.type.page
-   *
-   * Passing the prefix 'node.type.' will return an array containing the above
-   * names.
-   *
-   * @param string $prefix
-   *   The prefix to search for
-   *
-   * @return array
-   *   An array containing matching configuration object names.
+   * Not supported by CacheBackendInterface.
    */
-  protected function findByPrefix($prefix) {
-    if (!isset($this->findByPrefixCache[$prefix])) {
-      // The : character is not allowed in config file names, so this can not
-      // conflict.
-      if ($cache = $this->cache->get('find:' . $prefix)) {
-        $this->findByPrefixCache[$prefix] = $cache->data;
-      }
-      else {
-        $this->findByPrefixCache[$prefix] = $this->storage->listAll($prefix);
-        $this->cache->set(
-          'find:' . $prefix,
-          $this->findByPrefixCache[$prefix],
-          CacheBackendInterface::CACHE_PERMANENT,
-          array($this::FIND_BY_PREFIX_CACHE_TAG => TRUE)
-        );
-      }
-    }
-    return $this->findByPrefixCache[$prefix];
+  public function listAll($prefix = '') {
+    return $this->storage->listAll($prefix);
   }
 
   /**
@@ -232,11 +155,4 @@ public function deleteAll($prefix = '') {
     }
     return FALSE;
   }
-
-  /**
-   * Clears the static list cache.
-   */
-  public function resetListCache() {
-    $this->findByPrefixCache = array();
-  }
 }
diff --git a/core/lib/Drupal/Core/Config/Config.php b/core/lib/Drupal/Core/Config/Config.php
index 02afbd1..740f316 100644
--- a/core/lib/Drupal/Core/Config/Config.php
+++ b/core/lib/Drupal/Core/Config/Config.php
@@ -108,25 +108,6 @@ public function init() {
   }
 
   /**
-   * Initializes a configuration object with pre-loaded data.
-   *
-   * @param array $data
-   *   Array of loaded data for this configuration object.
-   *
-   * @return Drupal\Core\Config\Config
-   *   The configuration object.
-   */
-  public function initWithData(array $data) {
-    $this->isLoaded = TRUE;
-    $this->overrides = array();
-    $this->isNew = FALSE;
-    $this->notify('init');
-    $this->replaceData($data);
-    $this->notify('load');
-    return $this;
-  }
-
-  /**
    * Returns the name of this configuration object.
    *
    * @return string
diff --git a/core/lib/Drupal/Core/Config/ConfigFactory.php b/core/lib/Drupal/Core/Config/ConfigFactory.php
index fe9f4cb..dd5df1e 100644
--- a/core/lib/Drupal/Core/Config/ConfigFactory.php
+++ b/core/lib/Drupal/Core/Config/ConfigFactory.php
@@ -85,45 +85,6 @@ public function get($name) {
   }
 
   /**
-   * Returns a list of configuration objects for a given names and context.
-   *
-   * This will pre-load all requested configuration objects does not create
-   * new configuration objects.
-   *
-   * @param array $names
-   *   List of names of configuration objects.
-   *
-   * @return array
-   *   List of successfully loaded configuration objects, keyed by name.
-   */
-  public function loadMultiple(array $names) {
-    $context = $this->getContext();
-
-    $list = array();
-    foreach ($names as $key => $name) {
-      $cache_key = $this->getCacheKey($name, $context);
-      // @todo: Deleted configuration stays in $this->cache, only return
-      //   config entities that are not new.
-      if (isset($this->cache[$cache_key]) && !$this->cache[$cache_key]->isNew()) {
-        $list[$name] = $this->cache[$cache_key];
-        unset($names[$key]);
-      }
-    }
-
-    // Pre-load remaining configuration files.
-    if (!empty($names)) {
-      $storage_data = $this->storage->readMultiple($names);
-      foreach ($storage_data as $name => $data) {
-        $cache_key = $this->getCacheKey($name, $context);
-        $this->cache[$cache_key] = new Config($name, $this->storage, $context);
-        $this->cache[$cache_key]->initWithData($data);
-        $list[$name] = $this->cache[$cache_key];
-      }
-    }
-    return $list;
-  }
-
-  /**
    * Resets and re-initializes configuration objects. Internal use only.
    *
    * @param string $name
@@ -143,11 +104,6 @@ public function reset($name = NULL) {
     else {
       $this->cache = array();
     }
-
-    // Clear the static list cache if supported by the storage.
-    if ($this->storage instanceof StorageCacheInterface) {
-      $this->storage->resetListCache();
-    }
     return $this;
   }
 
diff --git a/core/lib/Drupal/Core/Config/DatabaseStorage.php b/core/lib/Drupal/Core/Config/DatabaseStorage.php
index 78e1629..cc595a6 100644
--- a/core/lib/Drupal/Core/Config/DatabaseStorage.php
+++ b/core/lib/Drupal/Core/Config/DatabaseStorage.php
@@ -86,26 +86,6 @@ public function read($name) {
   }
 
   /**
-   * {@inheritdoc}
-   */
-  public function readMultiple(array $names) {
-    // There are situations, like in the installer, where we may attempt a
-    // read without actually having the database available. In this case,
-    // catch the exception and just return an empty array so the caller can
-    // handle it if need be.
-    $list = array();
-    try {
-      $list = $this->connection->query('SELECT name, data FROM {' . $this->connection->escapeTable($this->table) . '} WHERE name IN (:names)', array(':names' => $names), $this->options)->fetchAllKeyed();
-      foreach ($list as &$data) {
-        $data = $this->decode($data);
-      }
-    }
-    catch (Exception $e) {
-    }
-    return $list;
-  }
-
-  /**
    * Implements Drupal\Core\Config\StorageInterface::write().
    *
    * @throws PDOException
diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php b/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php
index 7fe3c49..f4ef9a8 100644
--- a/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php
+++ b/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php
@@ -254,24 +254,27 @@ protected function buildQuery($ids, $revision_id = FALSE) {
     $config_class = $this->entityInfo['class'];
     $prefix = $this->getConfigPrefix();
 
-    // Get the names of the configuration entities we are going to load.
+    // Load all of the configuration entities.
     if ($ids === NULL) {
       $names = $this->configStorage->listAll($prefix);
+      $result = array();
+      foreach ($names as $name) {
+        $config = $this->configFactory->get($name);
+        $result[$config->get($this->idKey)] = new $config_class($config->get(), $this->entityType);
+      }
+      return $result;
     }
     else {
-      $names = array();
+      $result = array();
       foreach ($ids as $id) {
         // Add the prefix to the ID to serve as the configuration object name.
-        $names[] = $prefix . $id;
+        $config = $this->configFactory->get($prefix . $id);
+        if (!$config->isNew()) {
+          $result[$id] = new $config_class($config->get(), $this->entityType);
+        }
       }
+      return $result;
     }
-
-    // Load all of the configuration entities.
-    $result = array();
-    foreach ($this->configFactory->loadMultiple($names) as $config) {
-      $result[$config->get($this->idKey)] = new $config_class($config->get(), $this->entityType);
-    }
-    return $result;
   }
 
   /**
diff --git a/core/lib/Drupal/Core/Config/Entity/Query/Query.php b/core/lib/Drupal/Core/Config/Entity/Query/Query.php
index c6320f3..8577c08 100644
--- a/core/lib/Drupal/Core/Config/Entity/Query/Query.php
+++ b/core/lib/Drupal/Core/Config/Entity/Query/Query.php
@@ -83,8 +83,8 @@ public function condition($property, $value = NULL, $operator = NULL, $langcode
   public function execute() {
     // Load all config files.
     $entity_info = $this->entityManager->getDefinition($this->getEntityType());
-    $prefix = $entity_info['config_prefix'] . '.';
-    $prefix_length = strlen($prefix);
+    $prefix = $entity_info['config_prefix'];
+    $prefix_length = strlen($prefix) + 1;
     $names = $this->configStorage->listAll($prefix);
     $configs = array();
     foreach ($names as $name) {
diff --git a/core/lib/Drupal/Core/Config/FileStorage.php b/core/lib/Drupal/Core/Config/FileStorage.php
index 6e428b3..6422e9d 100644
--- a/core/lib/Drupal/Core/Config/FileStorage.php
+++ b/core/lib/Drupal/Core/Config/FileStorage.php
@@ -90,19 +90,6 @@ public function read($name) {
   }
 
   /**
-   * {@inheritdoc}
-   */
-  public function readMultiple(array $names) {
-    $list = array();
-    foreach ($names as $name) {
-      if ($data = $this->read($name)) {
-        $list[$name] = $data;
-      }
-    }
-    return $list;
-  }
-
-  /**
    * Implements Drupal\Core\Config\StorageInterface::write().
    *
    * @throws Symfony\Component\Yaml\Exception\DumpException
diff --git a/core/lib/Drupal/Core/Config/NullStorage.php b/core/lib/Drupal/Core/Config/NullStorage.php
index 2bf121d..336c111 100644
--- a/core/lib/Drupal/Core/Config/NullStorage.php
+++ b/core/lib/Drupal/Core/Config/NullStorage.php
@@ -38,13 +38,6 @@ public function read($name) {
   }
 
   /**
-   * Implements Drupal\Core\Config\StorageInterface::readMultiple().
-   */
-  public function readMultiple(array $names) {
-    return array();
-  }
-
-  /**
    * Implements Drupal\Core\Config\StorageInterface::write().
    */
   public function write($name, array $data) {
diff --git a/core/lib/Drupal/Core/Config/Schema/Mapping.php b/core/lib/Drupal/Core/Config/Schema/Mapping.php
index 9701df0..b7bddb3 100644
--- a/core/lib/Drupal/Core/Config/Schema/Mapping.php
+++ b/core/lib/Drupal/Core/Config/Schema/Mapping.php
@@ -53,11 +53,15 @@ public function get($property_name) {
    * Implements Drupal\Core\TypedData\ComplexDataInterface::set().
    */
   public function set($property_name, $value, $notify = TRUE) {
+    // Notify the parent of any changes to be made.
+    if ($notify && isset($this->parent)) {
+      $this->parent->onChange($this->name);
+    }
     // Set the data into the configuration array but behave according to the
     // interface specification when we've got a null value.
     if (isset($value)) {
       $this->value[$property_name] = $value;
-      $property = $this->get($property_name);
+      return $this->get($property_name);
     }
     else {
       // In these objects, when clearing the value, the property is gone.
@@ -65,12 +69,8 @@ public function set($property_name, $value, $notify = TRUE) {
       $property = $this->get($property_name);
       unset($this->value[$property_name]);
       $property->setValue($value);
+      return $property;
     }
-    // Notify the parent of any changes.
-    if ($notify && isset($this->parent)) {
-      $this->parent->onChange($this->name);
-    }
-    return $property;
   }
 
   /**
diff --git a/core/lib/Drupal/Core/Config/StorageCacheInterface.php b/core/lib/Drupal/Core/Config/StorageCacheInterface.php
deleted file mode 100644
index 8d864bb..0000000
--- a/core/lib/Drupal/Core/Config/StorageCacheInterface.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\Core\Config\StorageCacheInterface.
- */
-
-namespace Drupal\Core\Config;
-
-/**
- * Defines an interface for cached configuration storage controllers.
- */
-interface StorageCacheInterface {
-
-  /**
-   * Cache tag.
-   *
-   * Used by Drupal\Core\Config\CachedStorage::findByPrefix so that cached items
-   * can be cleared during writes, deletes and renames.
-   */
-  const FIND_BY_PREFIX_CACHE_TAG = 'configFindByPrefix';
-
-  /**
-   * Reset the static cache of the listAll() cache.
-   */
-  public function resetListCache();
-
-}
diff --git a/core/lib/Drupal/Core/Config/StorageInterface.php b/core/lib/Drupal/Core/Config/StorageInterface.php
index 9b45fa8..ceeecba 100644
--- a/core/lib/Drupal/Core/Config/StorageInterface.php
+++ b/core/lib/Drupal/Core/Config/StorageInterface.php
@@ -39,18 +39,6 @@ public function exists($name);
   public function read($name);
 
   /**
-   * Reads configuration data from the storage.
-   *
-   * @param array $name
-   *   List of names of the configuration objects to load.
-   *
-   * @return array
-   *   A list of the configuration data stored for the configuration object name
-   *   that could be loaded for the passed list of names.
-   */
-  public function readMultiple(array $names);
-
-  /**
    * Writes configuration data to the storage.
    *
    * @param string $name
diff --git a/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php b/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php
index 1922e6d..92142e8 100644
--- a/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php
+++ b/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php
@@ -114,19 +114,6 @@ public static function open(array &$connection_options = array()) {
     return $pdo;
   }
 
-  /**
-   * {@inheritdoc}
-   */
-  public function serialize() {
-    // Cleanup the connection, much like __destruct() does it as well.
-    if ($this->needsCleanup) {
-      $this->nextIdDelete();
-    }
-    $this->needsCleanup = FALSE;
-
-    return parent::serialize();
-  }
-
   public function __destruct() {
     if ($this->needsCleanup) {
       $this->nextIdDelete();
diff --git a/core/lib/Drupal/Core/Database/Query/Condition.php b/core/lib/Drupal/Core/Database/Query/Condition.php
index 1b21545..c23ad76 100644
--- a/core/lib/Drupal/Core/Database/Query/Condition.php
+++ b/core/lib/Drupal/Core/Database/Query/Condition.php
@@ -318,24 +318,4 @@ protected function mapConditionOperator($operator) {
     return $return;
   }
 
-  /**
-   * {@inheritdoc}
-   */
-  public function conditionGroupFactory($conjunction = 'AND') {
-    return new Condition($conjunction);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function andConditionGroup() {
-    return $this->conditionGroupFactory('AND');
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function orConditionGroup() {
-    return $this->conditionGroupFactory('OR');
-  }
 }
diff --git a/core/lib/Drupal/Core/Database/Query/ConditionInterface.php b/core/lib/Drupal/Core/Database/Query/ConditionInterface.php
index 7af7079..70c23c7 100644
--- a/core/lib/Drupal/Core/Database/Query/ConditionInterface.php
+++ b/core/lib/Drupal/Core/Database/Query/ConditionInterface.php
@@ -156,32 +156,4 @@ public function compile(Connection $connection, PlaceholderInterface $queryPlace
    *   TRUE if the condition has been previously compiled.
    */
   public function compiled();
-
-  /**
-   * Creates an object holding a group of conditions.
-   *
-   * See andConditionGroup() and orConditionGroup() for more.
-   *
-   * @param $conjunction
-   *   - AND (default): this is the equivalent of andConditionGroup().
-   *   - OR: this is the equivalent of andConditionGroup().
-   *
-   * @return \Drupal\Core\Database\Query\ConditionInterface
-   *   An object holding a group of conditions.
-   */
-  public function conditionGroupFactory($conjunction = 'AND');
-
-  /**
-   * Creates a new group of conditions ANDed together.
-   *
-   * @return \Drupal\Core\Database\Query\ConditionInterface
-   */
-  public function andConditionGroup();
-
-  /**
-   * Creates a new group of conditions ORed together.
-   *
-   * @return \Drupal\Core\Database\Query\ConditionInterface
-   */
-  public function orConditionGroup();
 }
diff --git a/core/lib/Drupal/Core/Database/Query/Query.php b/core/lib/Drupal/Core/Database/Query/Query.php
index 38d926c..95ab4b9 100644
--- a/core/lib/Drupal/Core/Database/Query/Query.php
+++ b/core/lib/Drupal/Core/Database/Query/Query.php
@@ -177,26 +177,4 @@ public function comment($comment) {
   public function &getComments() {
     return $this->comments;
   }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function conditionGroupFactory($conjunction = 'AND') {
-    return new Condition($conjunction);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function andConditionGroup() {
-    return $this->conditionGroupFactory('AND');
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function orConditionGroup() {
-    return $this->conditionGroupFactory('OR');
-  }
-
 }
diff --git a/core/lib/Drupal/Core/Database/Query/SelectExtender.php b/core/lib/Drupal/Core/Database/Query/SelectExtender.php
index e14c65e..2f27d1b 100644
--- a/core/lib/Drupal/Core/Database/Query/SelectExtender.php
+++ b/core/lib/Drupal/Core/Database/Query/SelectExtender.php
@@ -327,25 +327,4 @@ public function __call($method, $args) {
       return $return;
     }
   }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function conditionGroupFactory($conjunction = 'AND') {
-    return new Condition($conjunction);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function andConditionGroup() {
-    return $this->conditionGroupFactory('AND');
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function orConditionGroup() {
-    return $this->conditionGroupFactory('OR');
-  }
 }
diff --git a/core/lib/Drupal/Core/Datetime/Date.php b/core/lib/Drupal/Core/Datetime/Date.php
index 5567331..45aa3be 100644
--- a/core/lib/Drupal/Core/Datetime/Date.php
+++ b/core/lib/Drupal/Core/Datetime/Date.php
@@ -2,14 +2,14 @@
 
 /**
  * @file
- * Contains \Drupal\Core\Datetime\Date.
+ * Contains \Drupal\Component\Datetime\Date.
  */
 
 namespace Drupal\Core\Datetime;
 
 use Drupal\Component\Utility\Xss;
+use Drupal\Core\Config\ConfigFactory;
 use Drupal\Core\Datetime\DrupalDateTime;
-use Drupal\Core\Entity\EntityManager;
 use Drupal\Core\Language\Language;
 use Drupal\Core\Language\LanguageManager;
 
@@ -26,11 +26,11 @@ class Date {
   protected $timezones;
 
   /**
-   * The date format storage.
+   * The config factory.
    *
-   * @var \Drupal\Core\Entity\EntityStorageControllerInterface
+   * @var \Drupal\Core\Config\ConfigFactory
    */
-  protected $dateFormatStorage;
+  protected $configFactory;
 
   /**
    * Language manager for retrieving the default langcode when none is specified.
@@ -40,15 +40,15 @@ class Date {
   protected $languageManager;
 
   /**
-   * Constructs a Date object.
+   * Constructs a DateFormats object.
    *
-   * @param \Drupal\Core\Entity\EntityManager $entity_manager
-   *   The entity manager.
+   * @param \Drupal\Core\Config\ConfigFactory $config_factory
+   *   The config factory.
    * @param \Drupal\Core\Language\LanguageManager $language_manager
    *   The language manager.
    */
-  public function __construct(EntityManager $entity_manager, LanguageManager $language_manager) {
-    $this->dateFormatStorage = $entity_manager->getStorageController('date_format');
+  public function __construct(ConfigFactory $config_factory, LanguageManager $language_manager) {
+    $this->configFactory = $config_factory;
     $this->languageManager = $language_manager;
   }
 
@@ -103,13 +103,14 @@ public function format($timestamp, $type = 'medium', $format = '', $timezone = N
     $key = $date->canUseIntl() ? DrupalDateTime::INTL : DrupalDateTime::PHP;
 
     // If we have a non-custom date format use the provided date format pattern.
-    if ($date_format = $this->dateFormatStorage->load($type)) {
-      $format = $date_format->getPattern($key);
+    $config = $this->configFactory->get('system.date');
+    if ($type != 'custom') {
+      $format = $config->get('formats.' . $type . '.pattern.' . $key);
     }
 
     // Fall back to medium if a format was not found.
     if (empty($format)) {
-      $format = $this->dateFormatStorage->load('fallback')->getPattern($key);
+      $format = $config->get('formats.medium.pattern.' . $key);
     }
 
     // Call $date->format().
diff --git a/core/lib/Drupal/Core/Entity/Entity.php b/core/lib/Drupal/Core/Entity/Entity.php
index ec05c1a..7712bf1 100644
--- a/core/lib/Drupal/Core/Entity/Entity.php
+++ b/core/lib/Drupal/Core/Entity/Entity.php
@@ -11,6 +11,7 @@
 use Drupal\Core\Language\Language;
 use Drupal\Core\TypedData\TranslatableInterface;
 use Drupal\Core\TypedData\TypedDataInterface;
+use Drupal\user\UserInterface;
 use IteratorAggregate;
 use Drupal\Core\Session\AccountInterface;
 
@@ -273,11 +274,6 @@ public function getIterator() {
    * Implements \Drupal\Core\TypedData\AccessibleInterface::access().
    */
   public function access($operation = 'view', AccountInterface $account = NULL) {
-    if ($operation == 'create') {
-      return \Drupal::entityManager()
-        ->getAccessController($this->entityType)
-        ->createAccess($this->bundle(), $account);
-    }
     return \Drupal::entityManager()
       ->getAccessController($this->entityType)
       ->access($this, $operation, Language::LANGCODE_DEFAULT, $account);
@@ -429,66 +425,62 @@ public function getNGEntity() {
   }
 
   /**
-   * {@inheritdoc}
+   * Implements \Drupal\Core\TypedData\TypedDataInterface::getType().
    */
   public function getType() {
-    // @todo: This does not make much sense, so remove once TypedDataInterface
-    // is removed. See https://drupal.org/node/2002138.
-    if ($this->bundle() != $this->entityType()) {
-      return 'entity:' . $this->entityType() . ':' . $this->bundle();
-    }
-    return 'entity:' . $this->entityType();
+    // @todo: Incorporate the entity type here by making entities proper
+    // typed data. See http://drupal.org/node/1868004.
+    return 'entity';
   }
 
   /**
-   * {@inheritdoc}
+   * Implements \Drupal\Core\TypedData\TypedDataInterface::getDefinition().
    */
   public function getDefinition() {
-    // @todo: This does not make much sense, so remove once TypedDataInterface
-    // is removed. See https://drupal.org/node/2002138.
     return array(
       'type' => $this->getType()
     );
   }
 
   /**
-   * {@inheritdoc}
+   * Implements \Drupal\Core\TypedData\TypedDataInterface::getValue().
    */
   public function getValue() {
-    // @todo: This does not make much sense, so remove once TypedDataInterface
-    // is removed. See https://drupal.org/node/2002138.
-    return $this->getPropertyValues();
+    // @todo: Implement by making entities proper typed data. See
+    // http://drupal.org/node/1868004.
   }
 
   /**
    * Implements \Drupal\Core\TypedData\TypedDataInterface::setValue().
    */
   public function setValue($value, $notify = TRUE) {
-    // @todo: This does not make much sense, so remove once TypedDataInterface
-    // is removed. See https://drupal.org/node/2002138.
-    $this->setPropertyValues($value);
+    // @todo: Implement by making entities proper typed data. See
+    // http://drupal.org/node/1868004.
   }
 
   /**
-   * {@inheritdoc}
+   * Implements \Drupal\Core\TypedData\TypedDataInterface::getString().
    */
   public function getString() {
-    return $this->label();
+    // @todo: Implement by making entities proper typed data. See
+    // http://drupal.org/node/1868004.
   }
 
   /**
-   * {@inheritdoc}
+   * Implements \Drupal\Core\TypedData\TypedDataInterface::getConstraints().
    */
   public function getConstraints() {
+    // @todo: Implement by making entities proper typed data. See
+    // http://drupal.org/node/1868004.
     return array();
   }
 
   /**
-   * {@inheritdoc}
+   * Implements \Drupal\Core\TypedData\TypedDataInterface::validate().
    */
   public function validate() {
-    // @todo: Add the typed data manager as proper dependency.
-    return \Drupal::typedData()->getValidator()->validate($this);
+    // @todo: Implement by making entities proper typed data. See
+    // http://drupal.org/node/1868004.
   }
 
   /**
diff --git a/core/lib/Drupal/Core/Entity/EntityAccessCheck.php b/core/lib/Drupal/Core/Entity/EntityAccessCheck.php
index bce3a9e..f55567e 100644
--- a/core/lib/Drupal/Core/Entity/EntityAccessCheck.php
+++ b/core/lib/Drupal/Core/Entity/EntityAccessCheck.php
@@ -10,18 +10,18 @@
 use Drupal\Core\Entity\EntityInterface;
 use Symfony\Component\Routing\Route;
 use Symfony\Component\HttpFoundation\Request;
-use Drupal\Core\Access\StaticAccessCheckInterface;
+use Drupal\Core\Access\AccessCheckInterface;
 
 /**
  * Provides a generic access checker for entities.
  */
-class EntityAccessCheck implements StaticAccessCheckInterface {
+class EntityAccessCheck implements AccessCheckInterface {
 
   /**
    * {@inheritdoc}
    */
-  public function appliesTo() {
-    return array('_entity_access');
+  public function applies(Route $route) {
+    return array_key_exists('_entity_access', $route->getRequirements());
   }
 
   /**
diff --git a/core/lib/Drupal/Core/Entity/EntityAccessController.php b/core/lib/Drupal/Core/Entity/EntityAccessController.php
index 164b83e..a328443 100644
--- a/core/lib/Drupal/Core/Entity/EntityAccessController.php
+++ b/core/lib/Drupal/Core/Entity/EntityAccessController.php
@@ -23,29 +23,14 @@ class EntityAccessController implements EntityAccessControllerInterface {
   protected $accessCache = array();
 
   /**
-   * The entity type of the access controller instance.
-   *
-   * @var string
-   */
-  protected $entityType;
-
-  /**
-   * Constructs an access controller instance.
-   *
-   * @param string $entity_type
-   *   The entity type of the access controller instance.
-   */
-  public function __construct($entity_type) {
-    $this->entity_type = $entity_type;
-  }
-
-  /**
    * {@inheritdoc}
    */
   public function access(EntityInterface $entity, $operation, $langcode = Language::LANGCODE_DEFAULT, AccountInterface $account = NULL) {
-    $account = $this->prepareUser($account);
+    if (!$account) {
+      $account = $GLOBALS['user'];
+    }
 
-    if (($access = $this->getCache($entity->uuid(), $operation, $langcode, $account)) !== NULL) {
+    if (($access = $this->getCache($entity, $operation, $langcode, $account)) !== NULL) {
       // Cache hit, no work necessary.
       return $access;
     }
@@ -60,36 +45,17 @@ public function access(EntityInterface $entity, $operation, $langcode = Language
     // - At least one module says to grant access.
     $access = module_invoke_all($entity->entityType() . '_access', $entity->getBCEntity(), $operation, $account, $langcode);
 
-    if (($return = $this->processAccessHookResults($access)) === NULL) {
-      // No module had an opinion about the access, so let's the access
-      // controller check create access.
-      $return = (bool) $this->checkAccess($entity, $operation, $langcode, $account);
-    }
-    return $this->setCache($return, $entity->uuid(), $operation, $langcode, $account);
-  }
-
-  /**
-   * We grant access to the entity if both of these conditions are met:
-   * - No modules say to deny access.
-   * - At least one module says to grant access.
-   *
-   * @param array $access
-   *   An array of access results of the fired access hook.
-   *
-   * @return bool|NULL
-   *   Returns FALSE if access should be denied, TRUE if access should be
-   *   granted and NULL if no module denied access.
-   */
-  protected function processAccessHookResults(array $access) {
     if (in_array(FALSE, $access, TRUE)) {
-      return FALSE;
+      $return = FALSE;
     }
     elseif (in_array(TRUE, $access, TRUE)) {
-      return TRUE;
+      $return = TRUE;
     }
     else {
-      return;
+      // No result from hook, so entity checks are done.
+      $return = (bool) $this->checkAccess($entity, $operation, $langcode, $account);
     }
+    return $this->setCache($return, $entity, $operation, $langcode, $account);
   }
 
   /**
@@ -119,9 +85,8 @@ protected function checkAccess(EntityInterface $entity, $operation, $langcode, A
   /**
    * Tries to retrieve a previously cached access value from the static cache.
    *
-   * @param string $cid
-   *   Unique string identifier for the entity/operation, for example the
-   *   entity UUID or a custom string.
+   * @param \Drupal\Core\Entity\EntityInterface $entity
+   *   The entity for which to check 'create' access.
    * @param string $operation
    *   The entity operation. Usually one of 'view', 'update', 'create' or
    *   'delete'.
@@ -135,10 +100,13 @@ protected function checkAccess(EntityInterface $entity, $operation, $langcode, A
    *   is no record for the given user, operation, langcode and entity in the
    *   cache.
    */
-  protected function getCache($cid, $operation, $langcode, AccountInterface $account) {
+  protected function getCache(EntityInterface $entity, $operation, $langcode, AccountInterface $account) {
+    $uid = $account ? $account->id() : 0;
+    $uuid = $entity->uuid();
+
     // Return from cache if a value has been set for it previously.
-    if (isset($this->accessCache[$account->id()][$cid][$langcode][$operation])) {
-      return $this->accessCache[$account->id()][$cid][$langcode][$operation];
+    if (isset($this->accessCache[$uid][$uuid][$langcode][$operation])) {
+      return $this->accessCache[$uid][$uuid][$langcode][$operation];
     }
   }
 
@@ -147,9 +115,8 @@ protected function getCache($cid, $operation, $langcode, AccountInterface $accou
    *
    * @param bool $access
    *   TRUE if the user has access, FALSE otherwise.
-   * @param string $cid
-   *   Unique string identifier for the entity/operation, for example the
-   *   entity UUID or a custom string.
+   * @param \Drupal\Core\Entity\EntityInterface $entity
+   *   The entity for which to check 'create' access.
    * @param string $operation
    *   The entity operation. Usually one of 'view', 'update', 'create' or
    *   'delete'.
@@ -161,9 +128,12 @@ protected function getCache($cid, $operation, $langcode, AccountInterface $accou
    * @return bool
    *   TRUE if access was granted, FALSE otherwise.
    */
-  protected function setCache($access, $cid, $operation, $langcode, AccountInterface $account) {
+  protected function setCache($access, EntityInterface $entity, $operation, $langcode, AccountInterface $account) {
+    $uid = $account ? $account->id() : 0;
+    $uuid = $entity->uuid();
+
     // Save the given value in the static cache and directly return it.
-    return $this->accessCache[$account->id()][$cid][$langcode][$operation] = (bool) $access;
+    return $this->accessCache[$uid][$uuid][$langcode][$operation] = (bool) $access;
   }
 
   /**
@@ -173,75 +143,4 @@ public function resetCache() {
     $this->accessCache = array();
   }
 
-  /**
-   * {@inheritdoc}
-   */
-  public function createAccess($entity_bundle = NULL, AccountInterface $account = NULL, array $context = array()) {
-    $account = $this->prepareUser($account);
-    $context += array(
-      'langcode' => Language::LANGCODE_DEFAULT,
-    );
-
-    $cid = $entity_bundle ? 'create:' . $entity_bundle : 'create';
-    if (($access = $this->getCache($cid, 'create', $context['langcode'], $account)) !== NULL) {
-      // Cache hit, no work necessary.
-      return $access;
-    }
-
-    // Invoke hook_entity_access(), hook results take precedence over overridden
-    // implementations of EntityAccessController::checkAccess(). Entities
-    // that have checks that need to be done before the hook is invoked should
-    // do so by overridding this method.
-
-    // We grant access to the entity if both of these conditions are met:
-    // - No modules say to deny access.
-    // - At least one module says to grant access.
-    $access = module_invoke_all($this->entity_type . '_create_access', $account, $context['langcode']);
-
-    if (($return = $this->processAccessHookResults($access)) === NULL) {
-      // No module had an opinion about the access, so let's the access
-      // controller check create access.
-      $return = (bool) $this->checkCreateAccess($account, $context, $entity_bundle);
-    }
-    return $this->setCache($return, $cid, 'create', $context['langcode'], $account);
-  }
-
-  /**
-   * Performs create access checks.
-   *
-   * This method is supposed to be overwritten by extending classes that
-   * do their own custom access checking.
-   *
-   * @param \Drupal\Core\Session\AccountInterface $account
-   *   The user for which to check access.
-   * @param array $context
-   *   An array of key-value pairs to pass additional context when needed.
-   * @param string|null $entity_bundle
-   *   (optional) The bundle of the entity. Required if the entity supports
-   *   bundles, defaults to NULL otherwise.
-   *
-   * @return bool|null
-   *   TRUE if access was granted, FALSE if access was denied and NULL if access
-   *   could not be determined.
-   */
-  protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) {
-    return NULL;
-  }
-
-  /**
-   * Loads the current account object, if it does not exist yet.
-   *
-   * @param \Drupal\Core\Session\AccountInterface $account
-   *   The account interface instance.
-   *
-   * @return \Drupal\Core\Session\AccountInterface
-   *   Returns the current account object.
-   */
-  protected function prepareUser(AccountInterface $account = NULL) {
-    if (!$account) {
-      $account = $GLOBALS['user'];
-    }
-    return $account;
-  }
-
 }
diff --git a/core/lib/Drupal/Core/Entity/EntityAccessControllerInterface.php b/core/lib/Drupal/Core/Entity/EntityAccessControllerInterface.php
index c0296dd..f7b4348 100644
--- a/core/lib/Drupal/Core/Entity/EntityAccessControllerInterface.php
+++ b/core/lib/Drupal/Core/Entity/EntityAccessControllerInterface.php
@@ -18,14 +18,11 @@
   /**
    * Checks access to an operation on a given entity or entity translation.
    *
-   * Use \Drupal\Core\Entity\EntityAccessControllerInterface::createAccess()
-   * to check access to create an entity.
-   *
    * @param \Drupal\Core\Entity\EntityInterface $entity
    *   The entity for which to check access.
    * @param string $operation
    *   The operation access should be checked for.
-   *   Usually one of "view", "update" or "delete".
+   *   Usually one of "view", "create", "update" or "delete".
    * @param string $langcode
    *   (optional) The language code for which to check access. Defaults to
    *   Language::LANGCODE_DEFAULT.
@@ -39,21 +36,6 @@
   public function access(EntityInterface $entity, $operation, $langcode = Language::LANGCODE_DEFAULT, AccountInterface $account = NULL);
 
   /**
-   * Checks access to create an entity.
-   *
-   * @param string $entity_bundle
-   *   (optional) The bundle of the entity. Required if the entity supports
-   *   bundles, defaults to NULL otherwise.
-   * @param \Drupal\Core\Session\AccountInterface $account
-   *   (optional) The user session for which to check access, or NULL to check
-   *   access for the current user. Defaults to NULL.
-   * @param array $context
-   *   (optional) An array of key-value pairs to pass additional context when
-   *   needed.
-   */
-  public function createAccess($entity_bundle = NULL, AccountInterface $account = NULL, array $context = array());
-
-    /**
    * Clears all cached access checks.
    */
   public function resetCache();
diff --git a/core/lib/Drupal/Core/Entity/EntityBCDecorator.php b/core/lib/Drupal/Core/Entity/EntityBCDecorator.php
index a3ffcb9..52d3f6f 100644
--- a/core/lib/Drupal/Core/Entity/EntityBCDecorator.php
+++ b/core/lib/Drupal/Core/Entity/EntityBCDecorator.php
@@ -184,7 +184,6 @@ public function __set($name, $value) {
     // out of sync. That way, the next field object instantiated by EntityNG
     // will hold the updated value.
     unset($this->decorated->fields[$name]);
-    $this->decorated->onChange($name);
   }
 
   /**
diff --git a/core/lib/Drupal/Core/Entity/EntityCreateAccessCheck.php b/core/lib/Drupal/Core/Entity/EntityCreateAccessCheck.php
index 2630034..2cce92a 100644
--- a/core/lib/Drupal/Core/Entity/EntityCreateAccessCheck.php
+++ b/core/lib/Drupal/Core/Entity/EntityCreateAccessCheck.php
@@ -7,14 +7,14 @@
 
 namespace Drupal\Core\Entity;
 
-use Drupal\Core\Access\StaticAccessCheckInterface;
+use Drupal\Core\Access\AccessCheckInterface;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\Routing\Route;
 
 /**
  * Defines an access checker for entity creation.
  */
-class EntityCreateAccessCheck implements StaticAccessCheckInterface {
+class EntityCreateAccessCheck implements AccessCheckInterface {
 
   /**
    * The entity manager.
@@ -43,8 +43,8 @@ public function __construct(EntityManager $entity_manager) {
   /**
    * {@inheritdoc}
    */
-  public function appliesTo() {
-    return array($this->requirementsKey);
+  public function applies(Route $route) {
+    return array_key_exists($this->requirementsKey, $route->getRequirements());
   }
 
   /**
@@ -52,7 +52,35 @@ public function appliesTo() {
    */
   public function access(Route $route, Request $request) {
     list($entity_type, $bundle) = explode(':', $route->getRequirement($this->requirementsKey) . ':');
-    return $this->entityManager->getAccessController($entity_type)->createAccess($bundle);
+
+    $definition = $this->entityManager->getDefinition($entity_type);
+
+    $values = $this->prepareEntityValues($definition, $request, $bundle);
+    $entity = $this->entityManager->getStorageController($entity_type)
+      ->create($values);
+
+    return $this->entityManager->getAccessController($entity_type)->access($entity, 'create');
+  }
+
+  /**
+   * Prepare the values passed into the storage controller.
+   *
+   * @param array $definition
+   *   The entity type definition.
+   * @param \Symfony\Component\HttpFoundation\Request $request
+   *   The request object.
+   * @param string $bundle
+   *   (optional) The bundle to check access for.
+   *
+   * @return array
+   *   An array of values to be used when creating the entity.
+   */
+  protected function prepareEntityValues(array $definition, Request $request, $bundle = NULL) {
+    $values = array();
+    if ($bundle && isset($definition['entity_keys']['bundle'])) {
+      $values[$definition['entity_keys']['bundle']] = $bundle;
+    }
+    return $values;
   }
 
 }
diff --git a/core/lib/Drupal/Core/Entity/EntityInterface.php b/core/lib/Drupal/Core/Entity/EntityInterface.php
index e965b8e..cdb4cd3 100644
--- a/core/lib/Drupal/Core/Entity/EntityInterface.php
+++ b/core/lib/Drupal/Core/Entity/EntityInterface.php
@@ -9,7 +9,6 @@
 
 use Drupal\Core\TypedData\AccessibleInterface;
 use Drupal\Core\TypedData\ComplexDataInterface;
-use Drupal\Core\TypedData\IdentifiableInterface;
 use Drupal\Core\TypedData\TranslatableInterface;
 
 /**
@@ -28,7 +27,16 @@
  * @see \Drupal\Core\TypedData\TypedDataManager
  * @see \Drupal\Core\Field\FieldInterface
  */
-interface EntityInterface extends IdentifiableInterface, ComplexDataInterface, AccessibleInterface, TranslatableInterface {
+interface EntityInterface extends ComplexDataInterface, AccessibleInterface, TranslatableInterface {
+
+  /**
+   * Returns the entity identifier (the entity's machine name or numeric ID).
+   *
+   * @return
+   *   The identifier of the entity, or NULL if the entity does not yet have
+   *   an identifier.
+   */
+  public function id();
 
   /**
    * Returns the entity UUID (Universally Unique Identifier).
diff --git a/core/lib/Drupal/Core/Entity/EntityNG.php b/core/lib/Drupal/Core/Entity/EntityNG.php
index 62b5bfb..3d0c5c6 100644
--- a/core/lib/Drupal/Core/Entity/EntityNG.php
+++ b/core/lib/Drupal/Core/Entity/EntityNG.php
@@ -168,6 +168,15 @@ public function __construct(array $values, $entity_type, $bundle = FALSE, $trans
   }
 
   /**
+   * Gets the typed data type of the entity.
+   *
+   * @return string
+   */
+  public function getType() {
+    return $this->entityType;
+  }
+
+  /**
    * Initialize the object. Invoked upon construction and wake up.
    */
   protected function init() {
@@ -413,11 +422,6 @@ public function isEmpty() {
    * {@inheritdoc}
    */
   public function access($operation = 'view', AccountInterface $account = NULL) {
-    if ($operation == 'create') {
-      return \Drupal::entityManager()
-        ->getAccessController($this->entityType)
-        ->createAccess($this->bundle(), $account);
-    }
     return \Drupal::entityManager()
       ->getAccessController($this->entityType)
       ->access($this, $operation, $this->activeLangcode, $account);
@@ -454,7 +458,7 @@ protected function getDefaultLanguage() {
       }
       if (empty($this->language)) {
         // Make sure we return a proper language object.
-        $this->language = new Language(array('id' => Language::LANGCODE_NOT_SPECIFIED, 'locked' => TRUE));
+        $this->language = new Language(array('id' => Language::LANGCODE_NOT_SPECIFIED));
       }
     }
     return $this->language;
@@ -837,4 +841,12 @@ public function label($langcode = NULL) {
     return $label;
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  public function validate() {
+    // @todo: Add the typed data manager as proper dependency.
+    return \Drupal::typedData()->getValidator()->validate($this);
+  }
+
 }
diff --git a/core/lib/Drupal/Core/Entity/Field/Field.php b/core/lib/Drupal/Core/Entity/Field/Field.php
index 0ff36d7..3948ddf 100644
--- a/core/lib/Drupal/Core/Entity/Field/Field.php
+++ b/core/lib/Drupal/Core/Entity/Field/Field.php
@@ -51,14 +51,6 @@ public function __construct(array $definition, $name = NULL, TypedDataInterface
   /**
    * {@inheritdoc}
    */
-  public function getFieldDefinition() {
-    // @todo https://drupal.org/node/1988612
-    return NULL;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
   public function filterEmptyValues() {
     if (isset($this->list)) {
       $this->list = array_values(array_filter($this->list, function($item) {
@@ -85,6 +77,10 @@ public function getValue($include_computed = FALSE) {
    * Overrides \Drupal\Core\TypedData\ItemList::setValue().
    */
   public function setValue($values, $notify = TRUE) {
+    // Notify the parent of any changes to be made.
+    if ($notify && isset($this->parent)) {
+      $this->parent->onChange($this->name);
+    }
     if (!isset($values) || $values === array()) {
       $this->list = $values;
     }
@@ -112,10 +108,6 @@ public function setValue($values, $notify = TRUE) {
         }
       }
     }
-    // Notify the parent of any changes.
-    if ($notify && isset($this->parent)) {
-      $this->parent->onChange($this->name);
-    }
   }
 
   /**
@@ -172,8 +164,8 @@ public function __unset($property_name) {
    */
   public function access($operation = 'view', AccountInterface $account = NULL) {
     global $user;
-    if (!isset($account)) {
-      $account = $user;
+    if (!isset($account) && $user->uid) {
+      $account = user_load($user->uid);
     }
     // Get the default access restriction that lives within this field.
     $access = $this->defaultAccess($operation, $account);
diff --git a/core/lib/Drupal/Core/Entity/Field/FieldInterface.php b/core/lib/Drupal/Core/Entity/Field/FieldInterface.php
index 0d85da3..c2dfbdb 100644
--- a/core/lib/Drupal/Core/Entity/Field/FieldInterface.php
+++ b/core/lib/Drupal/Core/Entity/Field/FieldInterface.php
@@ -28,14 +28,6 @@
 interface FieldInterface extends ListInterface, AccessibleInterface {
 
   /**
-   * Gets the field definition.
-   *
-   * @return \Drupal\Core\Entity\Field\FieldDefinitionInterface
-   *   The field definition.
-   */
-  public function getFieldDefinition();
-
-  /**
    * Filters out empty field items and re-numbers the item deltas.
    */
   public function filterEmptyValues();
diff --git a/core/lib/Drupal/Core/Entity/Field/FieldItemBase.php b/core/lib/Drupal/Core/Entity/Field/FieldItemBase.php
index 599a3c3..cb243d5 100644
--- a/core/lib/Drupal/Core/Entity/Field/FieldItemBase.php
+++ b/core/lib/Drupal/Core/Entity/Field/FieldItemBase.php
@@ -37,13 +37,6 @@ public function __construct(array $definition, $name = NULL, TypedDataInterface
   }
 
   /**
-   * {@inheritdoc}
-   */
-  public function getFieldDefinition() {
-    return $this->getParent()->getFieldDefinition();
-  }
-
-  /**
    * Overrides \Drupal\Core\TypedData\TypedData::setValue().
    *
    * @param array|null $values
@@ -56,6 +49,10 @@ public function setValue($values, $notify = TRUE) {
       $keys = array_keys($this->getPropertyDefinitions());
       $values = array($keys[0] => $values);
     }
+    // Notify the parent of any changes to be made.
+    if ($notify && isset($this->parent)) {
+      $this->parent->onChange($this->name);
+    }
     $this->values = $values;
     // Update any existing property objects.
     foreach ($this->properties as $name => $property) {
@@ -66,10 +63,6 @@ public function setValue($values, $notify = TRUE) {
       $property->setValue($value, FALSE);
       unset($this->values[$name]);
     }
-    // Notify the parent of any changes.
-    if ($notify && isset($this->parent)) {
-      $this->parent->onChange($this->name);
-    }
   }
 
   /**
@@ -90,6 +83,10 @@ public function __get($name) {
    * {@inheritdoc}
    */
   public function set($property_name, $value, $notify = TRUE) {
+    // Notify the parent of any changes to be made.
+    if ($notify && isset($this->parent)) {
+      $this->parent->onChange($this->name);
+    }
     // For defined properties there is either a property object or a plain
     // value that needs to be updated.
     if (isset($this->properties[$property_name])) {
@@ -100,10 +97,6 @@ public function set($property_name, $value, $notify = TRUE) {
     else {
       $this->values[$property_name] = $value;
     }
-    // Directly notify ourselves.
-    if ($notify) {
-      $this->onChange($property_name);
-    }
   }
 
   /**
@@ -142,9 +135,7 @@ public function onChange($property_name) {
     }
     // Remove the plain value, such that any further __get() calls go via the
     // updated property object.
-    if (isset($this->properties[$property_name])) {
-      unset($this->values[$property_name]);
-    }
+    unset($this->values[$property_name]);
   }
 
   /**
diff --git a/core/lib/Drupal/Core/Entity/Field/FieldItemInterface.php b/core/lib/Drupal/Core/Entity/Field/FieldItemInterface.php
index e4adcdc..059a477 100644
--- a/core/lib/Drupal/Core/Entity/Field/FieldItemInterface.php
+++ b/core/lib/Drupal/Core/Entity/Field/FieldItemInterface.php
@@ -24,14 +24,6 @@
 interface FieldItemInterface extends ComplexDataInterface {
 
   /**
-   * Gets the field definition.
-   *
-   * @return \Drupal\Core\Entity\Field\FieldDefinitionInterface
-   *   The field definition.
-   */
-  public function getFieldDefinition();
-
-  /**
    * Magic method: Gets a property value.
    *
    * @param $property_name
diff --git a/core/lib/Drupal/Core/Entity/Plugin/DataType/Deriver/EntityDeriver.php b/core/lib/Drupal/Core/Entity/Plugin/DataType/Deriver/EntityDeriver.php
deleted file mode 100644
index 67ebea6..0000000
--- a/core/lib/Drupal/Core/Entity/Plugin/DataType/Deriver/EntityDeriver.php
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\Core\Entity\Plugin\DataType\Deriver\EntityDeriver.
- */
-
-namespace Drupal\Core\Entity\Plugin\DataType\Deriver;
-
-use Drupal\Component\Plugin\Derivative\DerivativeInterface;
-
-/**
- * Provides data type plugins for each existing entity type and bundle.
- */
-class EntityDeriver implements DerivativeInterface {
-
-  /**
-   * List of derivative definitions.
-   *
-   * @var array
-   */
-  protected $derivatives = array();
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getDerivativeDefinition($derivative_id, array $base_plugin_definition) {
-    if (!empty($this->derivatives) && !empty($this->derivatives[$derivative_id])) {
-      return $this->derivatives[$derivative_id];
-    }
-    $this->getDerivativeDefinitions($base_plugin_definition);
-    if (isset($this->derivatives[$derivative_id])) {
-      return $this->derivatives[$derivative_id];
-    }
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getDerivativeDefinitions(array $base_plugin_definition) {
-    // Also keep the 'entity' defined as is.
-    $this->derivatives[''] = $base_plugin_definition;
-    // Add definitions for each entity type and bundle.
-    foreach (entity_get_info() as $entity_type => $info) {
-      $this->derivatives[$entity_type] = array(
-        'label' => $info['label'],
-        'class' => $info['class'],
-        'constraints' => array('EntityType' => $entity_type),
-      ) + $base_plugin_definition;
-
-      // Incorporate the bundles as entity:$entity_type:$bundle, if any.
-      foreach (entity_get_bundles($entity_type) as $bundle => $bundle_info) {
-        if ($bundle !== $entity_type) {
-          $this->derivatives[$entity_type . ':' . $bundle] = array(
-            'label' => $bundle_info['label'],
-            'class' => $info['class'],
-            'constraints' => array(
-              'EntityType' => $entity_type,
-              'Bundle' => $bundle,
-            ),
-          ) + $base_plugin_definition;
-        }
-      }
-    }
-    return $this->derivatives;
-  }
-}
diff --git a/core/lib/Drupal/Core/Entity/Plugin/DataType/Deriver/FieldItemDeriver.php b/core/lib/Drupal/Core/Entity/Plugin/DataType/Deriver/FieldItemDeriver.php
deleted file mode 100644
index 2a304df..0000000
--- a/core/lib/Drupal/Core/Entity/Plugin/DataType/Deriver/FieldItemDeriver.php
+++ /dev/null
@@ -1,46 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\Core\Entity\Plugin\DataType\Deriver\FieldItemDeriver.
- */
-
-namespace Drupal\Core\Entity\Plugin\DataType\Deriver;
-
-use Drupal\Component\Plugin\Derivative\DerivativeInterface;
-
-/**
- * Provides data type plugins for each existing field type plugin.
- */
-class FieldItemDeriver implements DerivativeInterface {
-
-  /**
-   * List of derivative definitions.
-   *
-   * @var array
-   */
-  protected $derivatives = array();
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getDerivativeDefinition($derivative_id, array $base_plugin_definition) {
-    if (!isset($this->derivatives)) {
-      $this->getDerivativeDefinitions($base_plugin_definition);
-    }
-    if (isset($this->derivatives[$derivative_id])) {
-      return $this->derivatives[$derivative_id];
-    }
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getDerivativeDefinitions(array $base_plugin_definition) {
-    foreach (\Drupal::service('plugin.manager.entity.field.field_type')->getDefinitions() as $plugin_id => $definition) {
-      $this->derivatives[$plugin_id] = $definition;
-    }
-    return $this->derivatives;
-  }
-
-}
diff --git a/core/lib/Drupal/Core/Entity/Plugin/DataType/Entity.php b/core/lib/Drupal/Core/Entity/Plugin/DataType/Entity.php
deleted file mode 100644
index 9976232..0000000
--- a/core/lib/Drupal/Core/Entity/Plugin/DataType/Entity.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\Core\Entity\Plugin\DataType\Entity.
- */
-
-namespace Drupal\Core\Entity\Plugin\DataType;
-
-use Drupal\Core\TypedData\Annotation\DataType;
-use Drupal\Core\Annotation\Translation;
-
-/**
- * Defines the base plugin for deriving data types for entity types.
- *
- * Note that the class only registers the plugin, and is actually never used.
- * \Drupal\Core\Entity\Entity is available for use as base class.
- *
- * @DataType(
- *   id = "entity",
- *   label = @Translation("Entity"),
- *   description = @Translation("All kind of entities, e.g. nodes, comments or users."),
- *   derivative = "\Drupal\Core\Entity\Plugin\DataType\Deriver\EntityDeriver"
- * )
- */
-abstract class Entity {
-
-}
diff --git a/core/lib/Drupal/Core/Entity/Plugin/DataType/EntityReference.php b/core/lib/Drupal/Core/Entity/Plugin/DataType/EntityReference.php
deleted file mode 100644
index 4741c19..0000000
--- a/core/lib/Drupal/Core/Entity/Plugin/DataType/EntityReference.php
+++ /dev/null
@@ -1,129 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\Core\Entity\Plugin\DataType\EntityReference.
- */
-
-namespace Drupal\Core\Entity\Plugin\DataType;
-
-use Drupal\Core\Entity\EntityInterface;
-use Drupal\Core\TypedData\Annotation\DataType;
-use Drupal\Core\Annotation\Translation;
-use Drupal\Core\TypedData\DataReferenceBase;
-
-/**
- * Defines an 'entity_reference' data type.
- *
- * This serves as 'entity' property of entity reference field items and gets
- * its value set from the parent, i.e. LanguageItem.
- *
- * The plain value of this reference is the entity object, i.e. an instance of
- * \Drupal\Core\Entity\EntityInterface. For setting the value the entity object
- * or the entity ID may be passed, whereas passing the ID is only supported if
- * an 'entity type' constraint is specified.
- *
- * Some supported constraints (below the definition's 'constraints' key) are:
- *  - EntityType: The entity type. Required.
- *  - Bundle: (optional) The bundle or an array of possible bundles.
- *
- * @DataType(
- *   id = "entity_reference",
- *   label = @Translation("Entity reference")
- * )
- */
-class EntityReference extends DataReferenceBase {
-
-  /**
-   * The entity ID.
-   *
-   * @var integer|string
-   */
-  protected $id;
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getTargetDefinition() {
-    $definition = array(
-      'type' => 'entity',
-    );
-    if (isset($this->definition['constraints']['EntityType'])) {
-      $definition['type'] .= ':' . $this->definition['constraints']['EntityType'];
-    }
-    if (isset($this->definition['constraints']['Bundle']) && is_string($this->definition['constraints']['Bundle'])) {
-      $definition['type'] .= ':' . $this->definition['constraints']['Bundle'];
-    }
-    return $definition;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getTarget() {
-    if (!isset($this->target) && isset($this->id)) {
-      // If we have a valid reference, return the entity object which is typed
-      // data itself.
-      $this->target = entity_load($this->definition['constraints']['EntityType'], $this->id);
-    }
-    return $this->target;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getTargetIdentifier() {
-    if (isset($this->id)) {
-      return $this->id;
-    }
-    elseif ($entity = $this->getValue()) {
-      return $entity->id();
-    }
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getValue() {
-    // Entities are already typed data, so just return that.
-    return $this->getTarget();
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function setValue($value, $notify = TRUE) {
-    unset($this->target);
-    unset($this->id);
-
-    // Both the entity ID and the entity object may be passed as value. The
-    // reference may also be unset by passing NULL as value.
-    if (!isset($value) || $value instanceof EntityInterface) {
-      // Ensure we reference a NG Entity object.
-      if (isset($value)) {
-        $value = $value->getNGEntity();
-      }
-      $this->target = $value;
-    }
-    elseif (!is_scalar($value) || empty($this->definition['constraints']['EntityType'])) {
-      throw new \InvalidArgumentException('Value is not a valid entity.');
-    }
-    else {
-      $this->id = $value;
-    }
-    // Notify the parent of any changes.
-    if ($notify && isset($this->parent)) {
-      $this->parent->onChange($this->name);
-    }
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getString() {
-    if ($entity = $this->getValue()) {
-      return $entity->label();
-    }
-    return '';
-  }
-}
diff --git a/core/lib/Drupal/Core/Entity/Plugin/DataType/EntityReferenceItem.php b/core/lib/Drupal/Core/Entity/Plugin/DataType/EntityReferenceItem.php
index 3e67f7e..7f756ad 100644
--- a/core/lib/Drupal/Core/Entity/Plugin/DataType/EntityReferenceItem.php
+++ b/core/lib/Drupal/Core/Entity/Plugin/DataType/EntityReferenceItem.php
@@ -13,13 +13,10 @@
 use Drupal\Core\TypedData\TypedDataInterface;
 
 /**
- * Defines the 'entity_reference_item' entity field item.
+ * Defines the 'entity_reference' entity field item.
  *
- * Supported settings (below the definition's 'settings' key) are:
- * - target_type: The entity type to reference. Required.
- * - target_bundle: (optional): If set, restricts the entity bundles which may
- *   may be referenced. May be set to an single bundle, or to an array of
- *   allowed bundles.
+ * Required settings (below the definition's 'settings' key) are:
+ *  - target_type: The entity type to reference.
  *
  * @DataType(
  *   id = "entity_reference_field",
@@ -43,12 +40,11 @@ class EntityReferenceItem extends FieldItemBase {
    * Implements \Drupal\Core\TypedData\ComplexDataInterface::getPropertyDefinitions().
    */
   public function getPropertyDefinitions() {
-    // Definitions vary by entity type and bundle, so key them accordingly.
-    $key = $this->definition['settings']['target_type'] . ':';
-    $key .= isset($this->definition['settings']['target_bundle']) ? $this->definition['settings']['target_bundle'] : '';
+    // Definitions vary by entity type, so key them by entity type.
+    $target_type = $this->definition['settings']['target_type'];
 
-    if (!isset(static::$propertyDefinitions[$key])) {
-      static::$propertyDefinitions[$key]['target_id'] = array(
+    if (!isset(self::$propertyDefinitions[$target_type])) {
+      static::$propertyDefinitions[$target_type]['target_id'] = array(
         // @todo: Lookup the entity type's ID data type and use it here.
         'type' => 'integer',
         'label' => t('Entity ID'),
@@ -56,22 +52,20 @@ public function getPropertyDefinitions() {
           'Range' => array('min' => 0),
         ),
       );
-      static::$propertyDefinitions[$key]['entity'] = array(
-        'type' => 'entity_reference',
+      static::$propertyDefinitions[$target_type]['entity'] = array(
+        'type' => 'entity',
         'constraints' => array(
-          'EntityType' => $this->definition['settings']['target_type'],
+          'EntityType' => $target_type,
         ),
         'label' => t('Entity'),
         'description' => t('The referenced entity'),
         // The entity object is computed out of the entity ID.
         'computed' => TRUE,
         'read-only' => FALSE,
+        'settings' => array('id source' => 'target_id'),
       );
-      if (isset($this->definition['settings']['target_bundle'])) {
-        static::$propertyDefinitions[$key]['entity']['constraints']['Bundle'] = $this->definition['settings']['target_bundle'];
-      }
     }
-    return static::$propertyDefinitions[$key];
+    return static::$propertyDefinitions[$target_type];
   }
 
   /**
@@ -102,14 +96,12 @@ public function __isset($property_name) {
    * Overrides \Drupal\Core\Entity\Field\FieldItemBase::get().
    */
   public function setValue($values, $notify = TRUE) {
+    // Treat the values as value of the entity property, if no array is
+    // given as this handles entity IDs and objects.
     if (isset($values) && !is_array($values)) {
-      // Directly update the property instead of invoking the parent, so it can
-      // handle objects and IDs.
+      // Directly update the property instead of invoking the parent, so that
+      // the entity property can take care of updating the ID property.
       $this->properties['entity']->setValue($values, $notify);
-      // If notify was FALSE, ensure the target_id property gets synched.
-      if (!$notify) {
-        $this->set('target_id', $this->properties['entity']->getTargetIdentifier(), FALSE);
-      }
     }
     else {
       // Make sure that the 'entity' property gets set as 'target_id'.
@@ -119,18 +111,4 @@ public function setValue($values, $notify = TRUE) {
       parent::setValue($values, $notify);
     }
   }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function onChange($property_name) {
-    // Make sure that the target ID and the target property stay in sync.
-    if ($property_name == 'target_id') {
-      $this->properties['entity']->setValue($this->target_id, FALSE);
-    }
-    elseif ($property_name == 'entity') {
-      $this->set('target_id', $this->properties['entity']->getTargetIdentifier(), FALSE);
-    }
-    parent::onChange($property_name);
-  }
 }
diff --git a/core/lib/Drupal/Core/Entity/Plugin/DataType/EntityWrapper.php b/core/lib/Drupal/Core/Entity/Plugin/DataType/EntityWrapper.php
new file mode 100644
index 0000000..e2561a9
--- /dev/null
+++ b/core/lib/Drupal/Core/Entity/Plugin/DataType/EntityWrapper.php
@@ -0,0 +1,227 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\Entity\Plugin\DataType\EntityWrapper.
+ */
+
+namespace Drupal\Core\Entity\Plugin\DataType;
+
+use Drupal\Core\TypedData\Annotation\DataType;
+use Drupal\Core\Annotation\Translation;
+use Drupal\Core\Entity\EntityInterface;
+use Drupal\Core\TypedData\ComplexDataInterface;
+use Drupal\Core\TypedData\TypedData;
+use Drupal\Core\TypedData\TypedDataInterface;
+use ArrayIterator;
+use IteratorAggregate;
+use InvalidArgumentException;
+
+/**
+ * Defines an 'entity' data type, e.g. the computed 'entity' property of entity references.
+ *
+ * This object wraps the regular entity object and implements the
+ * ComplexDataInterface by forwarding most of its methods to the wrapped entity
+ * (if set).
+ *
+ * The plain value of this wrapper is the entity object, i.e. an instance of
+ * Drupal\Core\Entity\EntityInterface. For setting the value the entity object
+ * or the entity ID may be passed, whereas passing the ID is only supported if
+ * an 'entity type' constraint is specified.
+ *
+ * Supported constraints (below the definition's 'constraints' key) are:
+ *  - EntityType: The entity type.
+ *  - Bundle: The bundle or an array of possible bundles.
+ *
+ * Supported settings (below the definition's 'settings' key) are:
+ *  - id source: If used as computed property, the ID property used to load
+ *    the entity object.
+ *
+ * @DataType(
+ *   id = "entity",
+ *   label = @Translation("Entity"),
+ *   description = @Translation("All kind of entities, e.g. nodes, comments or users.")
+ * )
+ */
+class EntityWrapper extends TypedData implements IteratorAggregate, ComplexDataInterface {
+
+  /**
+   * The referenced entity type.
+   *
+   * @var string
+   */
+  protected $entityType;
+
+  /**
+   * The entity ID if no 'id source' is used.
+   *
+   * @var string
+   */
+  protected $id;
+
+  /**
+   * If set, a new entity to create and reference.
+   *
+   * @var \Drupal\Core\Entity\EntityInterface
+   */
+  protected $newEntity;
+
+  /**
+   * Overrides TypedData::__construct().
+   */
+  public function __construct(array $definition, $name = NULL, TypedDataInterface $parent = NULL) {
+    parent::__construct($definition, $name, $parent);
+    $this->entityType = isset($this->definition['constraints']['EntityType']) ? $this->definition['constraints']['EntityType'] : NULL;
+  }
+
+  /**
+   * Overrides \Drupal\Core\TypedData\TypedData::getValue().
+   */
+  public function getValue() {
+    if (isset($this->newEntity)) {
+      return $this->newEntity;
+    }
+    if (!empty($this->definition['settings']['id source'])) {
+      $this->id = $this->parent->__get($this->definition['settings']['id source']);
+    }
+    return $this->id ? entity_load($this->entityType, $this->id) : NULL;
+  }
+
+  /**
+   * Overrides \Drupal\Core\TypedData\TypedData::setValue().
+   *
+   * Both the entity ID and the entity object may be passed as value.
+   */
+  public function setValue($value, $notify = TRUE) {
+    // Support passing in the entity object. If it's not yet saved we have
+    // to store the whole entity such that it could be saved later on.
+    if ($value instanceof EntityInterface && $value->isNew()) {
+      $this->newEntity = $value;
+      $this->entityType = $value->entityType();
+      $value = 0;
+    }
+    elseif ($value instanceof EntityInterface) {
+      $this->entityType = $value->entityType();
+      $value = $value->id();
+      unset($this->newEntity);
+    }
+    elseif (isset($value) && !(is_scalar($value) && !empty($this->definition['constraints']['EntityType']))) {
+      throw new InvalidArgumentException('Value is not a valid entity.');
+    }
+    // Update the 'id source' property, if given.
+    if (!empty($this->definition['settings']['id source'])) {
+      $this->parent->__set($this->definition['settings']['id source'], $value, $notify);
+    }
+    else {
+      // Notify the parent of any changes to be made.
+      if ($notify && isset($this->parent)) {
+        $this->parent->onChange($this->name);
+      }
+      $this->id = $value;
+    }
+  }
+
+  /**
+   * Overrides \Drupal\Core\TypedData\TypedData::getString().
+   */
+  public function getString() {
+    if ($entity = $this->getValue()) {
+      return $entity->label();
+    }
+    return '';
+  }
+
+  /**
+   * Implements \IteratorAggregate::getIterator().
+   */
+  public function getIterator() {
+    if ($entity = $this->getValue()) {
+      return $entity->getIterator();
+    }
+    return new ArrayIterator(array());
+  }
+
+  /**
+   * Implements \Drupal\Core\TypedData\ComplexDataInterface::get().
+   */
+  public function get($property_name) {
+    // @todo: Allow navigating through the tree without data as well.
+    if ($entity = $this->getValue()) {
+      return $entity->get($property_name);
+    }
+  }
+
+  /**
+   * Implements \Drupal\Core\TypedData\ComplexDataInterface::set().
+   */
+  public function set($property_name, $value, $notify = TRUE) {
+    $this->get($property_name)->setValue($value, FALSE);
+  }
+
+  /**
+   * Implements \Drupal\Core\TypedData\ComplexDataInterface::getProperties().
+   */
+  public function getProperties($include_computed = FALSE) {
+    if ($entity = $this->getValue()) {
+      return $entity->getProperties($include_computed);
+    }
+    return array();
+  }
+
+  /**
+   * Implements \Drupal\Core\TypedData\ComplexDataInterface::getPropertyDefinition().
+   */
+  public function getPropertyDefinition($name) {
+    $definitions = $this->getPropertyDefinitions();
+    if (isset($definitions[$name])) {
+      return $definitions[$name];
+    }
+    else {
+      return FALSE;
+    }
+  }
+
+  /**
+   * Implements \Drupal\Core\TypedData\ComplexDataInterface::getPropertyDefinitions().
+   */
+  public function getPropertyDefinitions() {
+    // @todo: Support getting definitions if multiple bundles are specified.
+    return \Drupal::entityManager()->getFieldDefinitionsByConstraints($this->entityType, $this->definition['constraints']);
+  }
+
+  /**
+   * Implements \Drupal\Core\TypedData\ComplexDataInterface::getPropertyValues().
+   */
+  public function getPropertyValues() {
+    if ($entity = $this->getValue()) {
+      return $entity->getPropertyValues();
+    }
+    return array();
+  }
+
+  /**
+   * Implements \Drupal\Core\TypedData\ComplexDataInterface::setPropertyValues().
+   */
+  public function setPropertyValues($values) {
+    if ($entity = $this->getValue()) {
+      $entity->setPropertyValues($values);
+    }
+  }
+
+  /**
+   * Implements \Drupal\Core\TypedData\ComplexDataInterface::isEmpty().
+   */
+  public function isEmpty() {
+    return !$this->getValue();
+  }
+
+  /**
+   * Implements \Drupal\Core\TypedData\ComplexDataInterface::onChange().
+   */
+  public function onChange($property_name) {
+    // Notify the parent of changes.
+    if (isset($this->parent)) {
+      $this->parent->onChange($this->name);
+    }
+  }
+}
diff --git a/core/lib/Drupal/Core/Entity/Plugin/DataType/FieldDataTypeDerivative.php b/core/lib/Drupal/Core/Entity/Plugin/DataType/FieldDataTypeDerivative.php
new file mode 100644
index 0000000..346b656
--- /dev/null
+++ b/core/lib/Drupal/Core/Entity/Plugin/DataType/FieldDataTypeDerivative.php
@@ -0,0 +1,46 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\Entity\Plugin\DataType\FieldDataTypeDerivative.
+ */
+
+namespace Drupal\Core\Entity\Plugin\DataType;
+
+use Drupal\Component\Plugin\Derivative\DerivativeInterface;
+
+/**
+ * Provides data type plugins for each existing field type plugin.
+ */
+class FieldDataTypeDerivative implements DerivativeInterface {
+
+  /**
+   * List of derivative definitions.
+   *
+   * @var array
+   */
+  protected $derivatives = array();
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getDerivativeDefinition($derivative_id, array $base_plugin_definition) {
+    if (!isset($this->derivatives)) {
+      $this->getDerivativeDefinitions($base_plugin_definition);
+    }
+    if (isset($this->derivatives[$derivative_id])) {
+      return $this->derivatives[$derivative_id];
+    }
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getDerivativeDefinitions(array $base_plugin_definition) {
+    foreach (\Drupal::service('plugin.manager.entity.field.field_type')->getDefinitions() as $plugin_id => $definition) {
+      $this->derivatives[$plugin_id] = $definition;
+    }
+    return $this->derivatives;
+  }
+
+}
diff --git a/core/lib/Drupal/Core/Entity/Plugin/DataType/FieldItem.php b/core/lib/Drupal/Core/Entity/Plugin/DataType/FieldItem.php
index 71fa264..73309d9 100644
--- a/core/lib/Drupal/Core/Entity/Plugin/DataType/FieldItem.php
+++ b/core/lib/Drupal/Core/Entity/Plugin/DataType/FieldItem.php
@@ -9,20 +9,18 @@
 
 use Drupal\Core\TypedData\Annotation\DataType;
 use Drupal\Core\Annotation\Translation;
+use Drupal\Component\Plugin\PluginBase;
 
 /**
- * Defines the base plugin for deriving data types for field types.
- *
- * Note that the class only register the plugin, and is actually never used.
- * \Drupal\Core\Entity\Field\FieldItemBase is available for use as base class.
+ * Defines the base plugin definition for field type typed data types.
  *
  * @DataType(
  *   id = "field_item",
  *   label = @Translation("Field item"),
  *   list_class = "\Drupal\Core\Entity\Field\Field",
- *   derivative = "Drupal\Core\Entity\Plugin\DataType\Deriver\FieldItemDeriver"
+ *   derivative = "Drupal\Core\Entity\Plugin\DataType\FieldDataTypeDerivative"
  * )
  */
-abstract class FieldItem {
+class FieldItem extends PluginBase {
 
 }
diff --git a/core/lib/Drupal/Core/Entity/Plugin/DataType/LanguageItem.php b/core/lib/Drupal/Core/Entity/Plugin/DataType/LanguageItem.php
index 68526f5..5338556 100644
--- a/core/lib/Drupal/Core/Entity/Plugin/DataType/LanguageItem.php
+++ b/core/lib/Drupal/Core/Entity/Plugin/DataType/LanguageItem.php
@@ -42,18 +42,19 @@ class LanguageItem extends FieldItemBase {
    * Implements \Drupal\Core\TypedData\ComplexDataInterface::getPropertyDefinitions().
    */
   public function getPropertyDefinitions() {
+
     if (!isset(static::$propertyDefinitions)) {
       static::$propertyDefinitions['value'] = array(
         'type' => 'string',
         'label' => t('Language code'),
       );
       static::$propertyDefinitions['language'] = array(
-        'type' => 'language_reference',
+        'type' => 'language',
         'label' => t('Language object'),
-        'description' => t('The referenced language'),
         // The language object is retrieved via the language code.
         'computed' => TRUE,
         'read-only' => FALSE,
+        'settings' => array('langcode source' => 'value'),
       );
     }
     return static::$propertyDefinitions;
@@ -70,10 +71,6 @@ public function setValue($values, $notify = TRUE) {
       // the language property can take care of updating the language code
       // property.
       $this->properties['language']->setValue($values, $notify);
-      // If notify was FALSE, ensure the value property gets synched.
-      if (!$notify) {
-        $this->set('value', $this->properties['language']->getTargetIdentifier(), FALSE);
-      }
     }
     else {
       // Make sure that the 'language' property gets set as 'value'.
@@ -92,18 +89,4 @@ public function applyDefaultValue($notify = TRUE) {
     $this->setValue(array('value' => Language::LANGCODE_NOT_SPECIFIED), $notify);
     return $this;
   }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function onChange($property_name) {
-    // Make sure that the value and the language property stay in sync.
-    if ($property_name == 'value') {
-      $this->properties['language']->setValue($this->value, FALSE);
-    }
-    elseif ($property_name == 'language') {
-      $this->set('value', $this->properties['language']->getTargetIdentifier(), FALSE);
-    }
-    parent::onChange($property_name);
-  }
 }
diff --git a/core/lib/Drupal/Core/Entity/Plugin/DataType/LanguageReference.php b/core/lib/Drupal/Core/Entity/Plugin/DataType/LanguageReference.php
deleted file mode 100644
index 8d143a7..0000000
--- a/core/lib/Drupal/Core/Entity/Plugin/DataType/LanguageReference.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\Core\Entity\Plugin\DataType\LanguageReference.
- */
-
-namespace Drupal\Core\Entity\Plugin\DataType;
-
-use Drupal\Core\TypedData\DataReferenceBase;
-use Drupal\Core\TypedData\Annotation\DataType;
-use Drupal\Core\Annotation\Translation;
-
-/**
- * Defines the 'language_reference' data type.
- *
- * This serves as 'language' property of entity reference field items and gets
- * its value set from the parent, i.e. LanguageItem.
- *
- * The plain value is the language object, i.e. an instance of
- * \Drupal\Core\Language\Language. For setting the value the language object or
- * the language code as string may be passed.
- *
- * @DataType(
- *   id = "language_reference",
- *   label = @Translation("Language reference")
- * )
- */
-class LanguageReference extends DataReferenceBase {
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getTargetDefinition() {
-    return array(
-      'type' => 'language',
-    );
-  }
-}
diff --git a/core/lib/Drupal/Core/Entity/Plugin/DataType/UriItem.php b/core/lib/Drupal/Core/Entity/Plugin/DataType/UriItem.php
index fc398a2..263ec22 100644
--- a/core/lib/Drupal/Core/Entity/Plugin/DataType/UriItem.php
+++ b/core/lib/Drupal/Core/Entity/Plugin/DataType/UriItem.php
@@ -39,8 +39,8 @@ public function getPropertyDefinitions() {
 
     if (!isset(self::$propertyDefinitions)) {
       self::$propertyDefinitions['value'] = array(
-        'type' => 'uri',
-        'label' => t('URI value'),
+        'type' => 'string',
+        'label' => t('Text value'),
       );
     }
     return self::$propertyDefinitions;
diff --git a/core/lib/Drupal/Core/Entity/Query/QueryInterface.php b/core/lib/Drupal/Core/Entity/Query/QueryInterface.php
index 4e27ad8..48b884c 100644
--- a/core/lib/Drupal/Core/Entity/Query/QueryInterface.php
+++ b/core/lib/Drupal/Core/Entity/Query/QueryInterface.php
@@ -136,9 +136,10 @@ public function count();
    * Enables sortable tables for this query.
    *
    * @param $headers
-   *   An array of headers of the same structure as described in theme_table().
-   *   Use a 'specifier' in place of a 'field' to specify what to sort on.
-   *   This can be an entity or a field as described in condition().
+   *   An array of headers of the same struucture as described in
+   *   theme_table(). Use a 'specifier' in place of a 'field' to specify what
+   *   to sort on. This can be an entity or a field as described in
+   *   condition().
    * @return \Drupal\Core\Entity\Query\QueryInterface
    *   The called object.
    */
diff --git a/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php b/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php
index 2f7156a..f346129 100644
--- a/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php
+++ b/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php
@@ -8,7 +8,6 @@
 namespace Drupal\Core\Entity\Query\Sql;
 
 use Drupal\Core\Database\Query\SelectInterface;
-use Drupal\Core\Entity\Plugin\DataType\EntityReference;
 use Drupal\Core\Entity\Query\QueryException;
 use Drupal\field\Plugin\Core\Entity\Field;
 
@@ -141,12 +140,13 @@ function addField($field, $type, $langcode) {
             $propertyDefinitions = $entity->{$field['field_name']}->getPropertyDefinitions();
 
             // If the column is not yet known, ie. the
-            // $node->field_image->entity case then use first property as
-            // column, i.e. target_id or fid.
-            // Otherwise, the code executing the relationship will throw an
-            // exception anyways so no need to do it here.
-            if (!$column && isset($propertyDefinitions[$relationship_specifier]) && $entity->{$field['field_name']}->get('entity') instanceof EntityReference) {
-              $column = current(array_keys($propertyDefinitions));
+            // $node->field_image->entity case then use the id source as the
+            // column.
+            if (!$column && isset($propertyDefinitions[$relationship_specifier]['settings']['id source'])) {
+              // If this is a valid relationship, use the id source.
+              // Otherwise, the code executing the relationship will throw an
+              // exception anyways so no need to do it here.
+              $column = $propertyDefinitions[$relationship_specifier]['settings']['id source'];
             }
             // Prepare the next index prefix.
             $next_index_prefix = "$relationship_specifier.$column";
@@ -193,7 +193,7 @@ function addField($field, $type, $langcode) {
           $next_index_prefix = $relationship_specifier;
         }
         // Check for a valid relationship.
-        if (isset($propertyDefinitions[$relationship_specifier]) && $entity->{$specifier}->get('entity') instanceof EntityReference) {
+        if (isset($propertyDefinitions[$relationship_specifier]['constraints']['EntityType']) && isset($propertyDefinitions[$relationship_specifier]['settings']['id source'])) {
           // If it is, use the entity type.
           $entity_type = $propertyDefinitions[$relationship_specifier]['constraints']['EntityType'];
           $entity_info = entity_get_info($entity_type);
diff --git a/core/lib/Drupal/Core/Extension/UpdateModuleHandler.php b/core/lib/Drupal/Core/Extension/UpdateModuleHandler.php
index 0e5a57b..0ef5259 100644
--- a/core/lib/Drupal/Core/Extension/UpdateModuleHandler.php
+++ b/core/lib/Drupal/Core/Extension/UpdateModuleHandler.php
@@ -41,10 +41,6 @@ public function getImplementations($hook) {
         return array('system');
       // This is called during rebuild to find testing themes.
       case 'system_theme_info':
-      // Those are needed by user_access() to check access on update.php.
-      case 'entity_info':
-      case 'entity_load':
-      case 'user_role_load':
         return array();
       // t() in system_stream_wrappers() needs this. Other schema calls aren't
       // supported.
diff --git a/core/lib/Drupal/Core/Language/Language.php b/core/lib/Drupal/Core/Language/Language.php
index 7181b32..8296c18 100644
--- a/core/lib/Drupal/Core/Language/Language.php
+++ b/core/lib/Drupal/Core/Language/Language.php
@@ -141,9 +141,9 @@ public function __construct(array $options = array()) {
    * @todo Remove this function once $GLOBALS['language'] is gone.
    */
   public function extend($obj) {
-    $variables = get_object_vars($obj);
-    foreach ($variables as $variable => $value) {
-      $this->$variable = $value;
+    $vars = get_object_vars($obj);
+    foreach ($vars as $var => $value) {
+      $this->$var = $value;
     }
   }
 
diff --git a/core/lib/Drupal/Core/Language/LanguageManager.php b/core/lib/Drupal/Core/Language/LanguageManager.php
index a17ea10..d13f6f6 100644
--- a/core/lib/Drupal/Core/Language/LanguageManager.php
+++ b/core/lib/Drupal/Core/Language/LanguageManager.php
@@ -146,7 +146,7 @@ public function isMultilingual() {
    *   An array of all language types.
    */
   protected function getLanguageTypes() {
-    return language_types_get_all();
+    return array_keys(variable_get('language_types', language_types_get_default()));
   }
 
   /**
diff --git a/core/lib/Drupal/Core/Menu/LocalActionBase.php b/core/lib/Drupal/Core/Menu/LocalActionBase.php
deleted file mode 100644
index e1eba91..0000000
--- a/core/lib/Drupal/Core/Menu/LocalActionBase.php
+++ /dev/null
@@ -1,104 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\Core\Menu\LocalActionBase.
- */
-
-namespace Drupal\Core\Menu;
-
-use Drupal\Component\Plugin\PluginBase;
-use Drupal\Core\Menu\LocalActionInterface;
-use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
-use Drupal\Core\StringTranslation\Translator\TranslatorInterface;
-use Symfony\Component\DependencyInjection\ContainerInterface;
-use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
-
-/**
- * Provides defaults and base methods for menu local action plugins.
- *
- * @todo This class needs more documentation and/or @see references.
- */
-abstract class LocalActionBase extends PluginBase implements LocalActionInterface, ContainerFactoryPluginInterface {
-
-  /**
-   * String translation object.
-   *
-   * @var \Drupal\Core\StringTranslation\Translator\TranslatorInterface
-   */
-  protected $t;
-
-  /**
-   * URL generator object.
-   *
-   * @var \Symfony\Component\Routing\Generator\UrlGeneratorInterface
-   */
-  protected $generator;
-
-  /**
-   * Constructs a LocalActionBase object.
-   *
-   * @param \Drupal\Core\StringTranslation\Translator\TranslatorInterface $string_translation
-   *   A translator object for use by subclasses generating localized titles.
-   * @param \Symfony\Component\Routing\Generator\UrlGeneratorInterface $generator
-   *   A URL generator object used to get the path from the route.
-   * @param array $configuration
-   *   A configuration array containing information about the plugin instance.
-   * @param string $plugin_id
-   *   The plugin_id for the plugin instance.
-   * @param array $plugin_definition
-   *   The plugin implementation definition.
-   */
-  public function __construct(TranslatorInterface $string_translation,  UrlGeneratorInterface $generator, array $configuration, $plugin_id, array $plugin_definition) {
-    parent::__construct($configuration, $plugin_id, $plugin_definition);
-
-    $this->generator = $generator;
-    // This is available for subclasses that need to translate a dynamic title.
-    $this->t = $string_translation;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, array $plugin_definition) {
-    return new static(
-      $container->get('string_translation'),
-      $container->get('url_generator'),
-      $configuration,
-      $plugin_id,
-      $plugin_definition
-    );
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getRouteName() {
-    return $this->pluginDefinition['route_name'];
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getTitle() {
-    // Subclasses may pull in the request or specific attributes as parameters.
-    return $this->pluginDefinition['title'];
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getPath() {
-    // Subclasses may set a request into the generator or use any desired method
-    // to generate the path.
-    // @todo - use the new method from https://drupal.org/node/2031353
-    $path = $this->generator->generate($this->getRouteName());
-    // In order to get the Drupal path the base URL has to be stripped off.
-    $base_url = $this->generator->getContext()->getBaseUrl();
-    if (!empty($base_url) && strpos($path, $base_url) === 0) {
-      $path = substr($path, strlen($base_url));
-    }
-    return trim($path, '/');
-  }
-
-}
diff --git a/core/lib/Drupal/Core/Menu/LocalActionInterface.php b/core/lib/Drupal/Core/Menu/LocalActionInterface.php
deleted file mode 100644
index 65287b6..0000000
--- a/core/lib/Drupal/Core/Menu/LocalActionInterface.php
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\Core\Menu\LocalActionInterface.
- */
-
-namespace Drupal\Core\Menu;
-
-/**
- * Defines an interface for menu local actions.
- */
-interface LocalActionInterface {
-
-  /**
-   * Get the route name from the settings.
-   *
-   * @return string
-   *   The name of the route this action links to.
-   */
-  public function getRouteName();
-
-  /**
-   * Returns the localized title to be shown for this action.
-   *
-   * Subclasses may add optional arguments like NodeInterface $node = NULL that
-   * will be supplied by the ControllerResolver.
-   *
-   * @return string
-   *   The title to be shown for this action.
-   *
-   * @see \Drupal\Core\Menu\LocalActionManager::getTitle()
-   */
-  public function getTitle();
-
-  /**
-   * Return an internal Drupal path to use when linking to the action.
-   *
-   * Subclasses may add arguments for request attributes which will then be
-   * automatically supplied by the controller resolver.
-   *
-   * @return string
-   *   The path to use when linking to the action.
-   *
-   * @see \Drupal\Core\Menu\LocalActionManager::getPath()
-   */
-  public function getPath();
-
-}
diff --git a/core/lib/Drupal/Core/Menu/LocalActionManager.php b/core/lib/Drupal/Core/Menu/LocalActionManager.php
deleted file mode 100644
index 7857f7a..0000000
--- a/core/lib/Drupal/Core/Menu/LocalActionManager.php
+++ /dev/null
@@ -1,128 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\Core\Menu\LocalActionManager.
- */
-
-namespace Drupal\Core\Menu;
-
-use Drupal\Core\Extension\ModuleHandlerInterface;
-use Drupal\Core\Menu\LocalActionInterface;
-use Drupal\Core\Plugin\DefaultPluginManager;
-use Symfony\Component\HttpFoundation\Request;
-use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface;
-
-/**
- * Manages discovery and instantiation of menu local action plugins.
- *
- * Menu local actions are links that lead to actions like "add new". The plugin
- * format allows them (if needed) to dynamically generate a title or the path
- * they link to. The annotation on the plugin provides the default title,
- * and the list of routes where the action should be rendered.
- */
-class LocalActionManager extends DefaultPluginManager {
-
-  /**
-   * A controller resolver object.
-   *
-   * @var \Symfony\Component\HttpKernel\Controller\ControllerResolverInterface
-   */
-  protected $controllerResolver;
-
-  /**
-   * A request object.
-   *
-   * @var \Symfony\Component\HttpFoundation\Request
-   */
-  protected $request;
-
-  /**
-   * The plugin instances.
-   *
-   * @var array
-   */
-  protected $instances = array();
-
-  /**
-   * Constructs a LocalActionManager object.
-   *
-   * @param \Traversable $namespaces
-   *   An object that implements \Traversable which contains the root paths
-   *   keyed by the corresponding namespace to look for plugin implementations.
-   * @param \Symfony\Component\HttpKernel\Controller\ControllerResolverInterface $controller_resolver
-   *   An object to use in introspecting route methods.
-   * @param \Symfony\Component\HttpFoundation\Request $request
-   *   The request object to use for building titles and paths for plugin
-   *   instances.
-   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
-   *   The module handler.
-   */
-  public function __construct(\Traversable $namespaces, ControllerResolverInterface $controller_resolver, Request $request, ModuleHandlerInterface $module_handler) {
-    parent::__construct('Menu\LocalAction', $namespaces, array(), 'Drupal\Core\Annotation\Menu\LocalAction');
-
-    $this->controllerResolver = $controller_resolver;
-    $this->request = $request;
-    $this->alterInfo($module_handler, 'menu_local_actions');
-  }
-
-  /**
-   * Gets the title for a local action.
-   *
-   * @param \Drupal\Core\Menu\LocalActionInterface $local_action
-   *   An object to get the title from.
-   *
-   * @return string
-   *   The title (already localized).
-   *
-   * @throws \BadMethodCallException
-   *   If the plugin does not implement the getTitle() method.
-   */
-  public function getTitle(LocalActionInterface $local_action) {
-    $controller = array($local_action, 'getTitle');
-    $arguments = $this->controllerResolver->getArguments($this->request, $controller);
-    return call_user_func_array($controller, $arguments);
-  }
-
-  /**
-   * Gets the Drupal path for a local action.
-   *
-   * @param \Drupal\Core\Menu\LocalActionInterface $local_action
-   *   An object to get the path from.
-   *
-   * @return string
-   *   The path.
-   *
-   * @throws \BadMethodCallException
-   *   If the plugin does not implement the getPath() method.
-   */
-  public function getPath(LocalActionInterface $local_action) {
-    $controller = array($local_action, 'getPath');
-    $arguments = $this->controllerResolver->getArguments($this->request, $controller);
-    return call_user_func_array($controller, $arguments);
-  }
-
-  /**
-   * Finds all local actions that appear on a named route.
-   *
-   * @param string $route_name
-   *   The route for which to find local actions.
-   *
-   * @return \Drupal\Core\Menu\LocalActionInterface[]
-   *   An array of LocalActionInterface objects that appear on the route path.
-   */
-  public function getActionsForRoute($route_name) {
-    if (!isset($this->instances[$route_name])) {
-      $this->instances[$route_name] = array();
-      // @todo - optimize this lookup by compiling or caching.
-      foreach ($this->getDefinitions() as $plugin_id => $action_info) {
-        if (in_array($route_name, $action_info['appears_on'])) {
-          $plugin = $this->createInstance($plugin_id);
-          $this->instances[$route_name][$plugin_id] = $plugin;
-        }
-      }
-    }
-    return $this->instances[$route_name];
-  }
-
-}
diff --git a/core/lib/Drupal/Core/Menu/LocalTaskBase.php b/core/lib/Drupal/Core/Menu/LocalTaskBase.php
deleted file mode 100644
index 7568d2b..0000000
--- a/core/lib/Drupal/Core/Menu/LocalTaskBase.php
+++ /dev/null
@@ -1,155 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\Core\Menu\LocalTaskBase.
- */
-
-namespace Drupal\Core\Menu;
-
-use Drupal\Component\Plugin\PluginBase;
-use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
-use Drupal\Core\StringTranslation\Translator\TranslatorInterface;
-use Symfony\Component\DependencyInjection\ContainerInterface;
-use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
-
-/**
- * Provides defaults and base methods for menu local tasks plugins.
- */
-abstract class LocalTaskBase extends PluginBase implements LocalTaskInterface, ContainerFactoryPluginInterface{
-
-  /**
-   * String translation object.
-   *
-   * @var \Drupal\Core\StringTranslation\Translator\TranslatorInterface
-   */
-  protected $t;
-
-  /**
-   * URL generator object.
-   *
-   * @var \Symfony\Component\Routing\Generator\UrlGeneratorInterface
-   */
-  protected $generator;
-
-  /**
-   * TRUE if this plugin is forced active for options attributes.
-   *
-   * @var bool
-   */
-  protected $active = FALSE;
-
-  /**
-   * Constructs a \Drupal\system\Plugin\LocalTaskBase object.
-   *
-   * @param array $configuration
-   *   A configuration array containing information about the plugin instance.
-   * @param string $plugin_id
-   *   The plugin_id for the plugin instance.
-   * @param array $plugin_definition
-   *   The plugin implementation definition.
-   * @param \Drupal\Core\StringTranslation\Translator\TranslatorInterface $string_translation
-   *   The string translation object.
-   * @param \Symfony\Component\Routing\Generator\UrlGeneratorInterface $generator
-   *   The url generator object.
-   */
-  public function __construct(array $configuration, $plugin_id, array $plugin_definition, TranslatorInterface $string_translation, UrlGeneratorInterface $generator) {
-    // This is available for subclasses that need to translate a dynamic title.
-    $this->t = $string_translation;
-    $this->generator = $generator;
-    parent::__construct($configuration, $plugin_id, $plugin_definition);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, array $plugin_definition) {
-    return new static(
-      $configuration,
-      $plugin_id,
-      $plugin_definition,
-      $container->get('string_translation'),
-      $container->get('url_generator')
-    );
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getRouteName() {
-    return $this->pluginDefinition['route_name'];
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getTitle() {
-    // Subclasses may pull in the request or specific attributes as parameters.
-    return $this->pluginDefinition['title'];
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getPath() {
-    // Subclasses may set a request into the generator or use any desired method
-    // to generate the path.
-    // @todo - use the new method from https://drupal.org/node/2031353
-    $path = $this->generator->generate($this->getRouteName());
-    // In order to get the Drupal path the base URL has to be stripped off.
-    $base_url = $this->generator->getContext()->getBaseUrl();
-    if (!empty($base_url) && strpos($path, $base_url) === 0) {
-      $path = substr($path, strlen($base_url));
-    }
-    return trim($path, '/');
-  }
-
-  /**
-   * Returns the weight of the local task.
-   *
-   * @return int
-   *   The weight of the task. If not defined in the annotation returns 0 by
-   *   default or -10 for the root tab.
-   */
-  public function getWeight() {
-    // By default the weight is 0, or -10 for the root tab.
-    if (!isset($this->pluginDefinition['weight'])) {
-      if ($this->pluginDefinition['tab_root_id'] == $this->pluginDefinition['id']) {
-        $this->pluginDefinition['weight'] = -10;
-      }
-      else {
-        $this->pluginDefinition['weight'] = 0;
-      }
-    }
-    return (int) $this->pluginDefinition['weight'];
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getOptions() {
-    $options = $this->pluginDefinition['options'];
-    if ($this->active) {
-      if (empty($options['attributes']['class']) || !in_array('active', $options['attributes']['class'])) {
-        $options['attributes']['class'][] = 'active';
-      }
-    }
-    return (array) $options;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function setActive($active = TRUE) {
-    $this->active = $active;
-    return $this;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getActive() {
-    return $this->active;
-  }
-
-}
diff --git a/core/lib/Drupal/Core/Menu/LocalTaskInterface.php b/core/lib/Drupal/Core/Menu/LocalTaskInterface.php
deleted file mode 100644
index b7f581d..0000000
--- a/core/lib/Drupal/Core/Menu/LocalTaskInterface.php
+++ /dev/null
@@ -1,84 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \DrupalCore\Menu\LocalTaskInterface.
- */
-
-namespace Drupal\Core\Menu;
-
-/**
- * Defines an interface for menu local tasks.
- */
-interface LocalTaskInterface {
-
-  /**
-   * Get the route name from the settings.
-   *
-   * @return string
-   *   The name of the route this local task links to.
-   */
-  public function getRouteName();
-
-  /**
-   * Returns the localized title to be shown for this tab.
-   *
-   * Subclasses may add optional arguments like NodeInterface $node = NULL that
-   * will be supplied by the ControllerResolver.
-   *
-   * @return string
-   *   The title of the local task.
-   */
-  public function getTitle();
-
-  /**
-   * Returns an internal Drupal path to use when creating the link for the tab.
-   *
-   * Subclasses may add optional arguments like NodeInterface $node = NULL that
-   * will be supplied by the ControllerResolver.
-   *
-   * @return string
-   *   The path of this local task.
-   */
-  public function getPath();
-
-  /**
-   * Returns the weight of the local task.
-   *
-   * @return int|null
-   *   The weight of the task or NULL.
-   */
-  public function getWeight();
-
-  /**
-   * Returns an array of options suitable to pass to l().
-   *
-   * @return array
-   *   Associative array of options.
-   *
-   * @see l()
-   */
-  public function getOptions();
-
-  /**
-   * Sets the active status.
-   *
-   * @param bool $active
-   *   Sets whether this tab is active (e.g. a parent of the current tab).
-   *
-   * @return \Drupal\Core\Menu\LocalTaskInterface
-   *   The called object for chaining.
-   */
-  public function setActive($active = TRUE);
-
-  /**
-   * Gets the active status.
-   *
-   * @return bool
-   *   TRUE if the local task is active, FALSE otherwise.
-   *
-   * @see \Drupal\system\Plugin\MenuLocalTaskInterface::setActive()
-   */
-  public function getActive();
-
-}
diff --git a/core/lib/Drupal/Core/Menu/LocalTaskManager.php b/core/lib/Drupal/Core/Menu/LocalTaskManager.php
deleted file mode 100644
index 70db0b0..0000000
--- a/core/lib/Drupal/Core/Menu/LocalTaskManager.php
+++ /dev/null
@@ -1,227 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\Core\Menu\MenuLocalTaskManager.
- */
-
-namespace Drupal\Core\Menu;
-
-use Drupal\Core\Extension\ModuleHandlerInterface;
-use Drupal\Core\Plugin\DefaultPluginManager;
-use Drupal\Core\Routing\RouteProviderInterface;
-use Symfony\Component\HttpFoundation\Request;
-use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface;
-
-/**
- * Manages discovery and instantiation of menu local task plugins.
- *
- * This manager finds plugins that are rendered as local tasks (usually tabs).
- * Derivatives are supported for modules that wish to generate multiple tabs on
- * behalf of something else.
- */
-class LocalTaskManager extends DefaultPluginManager {
-
-  /**
-   * A controller resolver object.
-   *
-   * @var \Symfony\Component\HttpKernel\Controller\ControllerResolverInterface
-   */
-  protected $controllerResolver;
-
-  /**
-   * A request object.
-   *
-   * @var \Symfony\Component\HttpFoundation\Request
-   */
-  protected $request;
-
-  /**
-   * The plugin instances.
-   *
-   * @var array
-   */
-  protected $instances = array();
-
-  /**
-   * The route provider to load routes by name.
-   *
-   * @var \Drupal\Core\Routing\RouteProviderInterface
-   */
-  protected $routeProvider;
-
-  /**
-   * Constructs a \Drupal\Core\Menu\LocalTaskManager object.
-   *
-   * @param \Traversable $namespaces
-   *   An object that implements \Traversable which contains the root paths
-   *   keyed by the corresponding namespace to look for plugin implementations,
-   * @param \Symfony\Component\HttpKernel\Controller\ControllerResolverInterface $controller_resolver
-   *   An object to use in introspecting route methods.
-   * @param \Symfony\Component\HttpFoundation\Request $request
-   *   The request object to use for building titles and paths for plugin instances.
-   * @param \Drupal\Core\Routing\RouteProviderInterface $route_provider
-   *   The route provider to load routes by name.
-   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
-   *   The module handler.u
-   */
-  public function __construct(\Traversable $namespaces, ControllerResolverInterface $controller_resolver, Request $request, RouteProviderInterface $route_provider, ModuleHandlerInterface $module_handler) {
-    parent::__construct('Menu\LocalTask', $namespaces, array(), 'Drupal\Core\Annotation\Menu\LocalTask');
-    $this->controllerResolver = $controller_resolver;
-    $this->request = $request;
-    $this->routeProvider = $route_provider;
-    $this->alterInfo($module_handler, 'local_tasks');
-  }
-
-  /**
-   * Gets the title for a local task.
-   *
-   * @param \Drupal\Core\Menu\LocalTaskInterface $local_task
-   *   A local task plugin instance to get the title for.
-   *
-   * @return string
-   *   The localized title.
-   */
-  public function getTitle(LocalTaskInterface $local_task) {
-    $controller = array($local_task, 'getTitle');
-    $arguments = $this->controllerResolver->getArguments($this->request, $controller);
-    return call_user_func_array($controller, $arguments);
-  }
-
-  /**
-   * Gets the Drupal path for a local task.
-   *
-   * @param \Drupal\Core\Menu\LocalTaskInterface $local_task
-   *   The local task plugin instance to get the path for.
-   *
-   * @return string
-   *   The path.
-   */
-  public function getPath(LocalTaskInterface $local_task) {
-    $controller = array($local_task, 'getPath');
-    $arguments = $this->controllerResolver->getArguments($this->request, $controller);
-    return call_user_func_array($controller, $arguments);
-  }
-
-  /**
-   * Find all local tasks that appear on a named route.
-   *
-   * @param string $route_name
-   *   The route for which to find local tasks.
-   *
-   * @return array
-   *   Returns an array of task levels. Each task level contains instances
-   *   of local tasks (LocalTaskInterface) which appear on the tab route.
-   *   The array keys are the depths and the values are arrays of plugin
-   *   instances.
-   */
-  public function getLocalTasksForRoute($route_name) {
-    if (!isset($this->instances[$route_name])) {
-      $this->instances[$route_name] = array();
-      // @todo - optimize this lookup by compiling or caching.
-      $definitions = $this->getDefinitions();
-      // We build the hierarchy by finding all tabs that should
-      // appear on the current route.
-      $tab_root_ids = array();
-      $parents = array();
-      foreach ($definitions as $plugin_id => $task_info) {
-        if ($route_name == $task_info['route_name']) {
-          $tab_root_ids[$task_info['tab_root_id']] = TRUE;
-          // Tabs that link to the current route are viable parents
-          // and their parent and children should be visible also.
-          // @todo - this only works for 2 levels of tabs.
-          // instead need to iterate up.
-          $parents[$plugin_id] = TRUE;
-          if (!empty($task_info['tab_parent_id'])) {
-            $parents[$task_info['tab_parent_id']] = TRUE;
-          }
-        }
-      }
-      if ($tab_root_ids) {
-        // Find all the plugins with the same root and that are at the top
-        // level or that have a visible parent.
-        $children = array();
-        foreach ($definitions  as $plugin_id => $task_info) {
-          if (!empty($tab_root_ids[$task_info['tab_root_id']]) && (empty($task_info['tab_parent_id']) || !empty($parents[$task_info['tab_parent_id']]))) {
-            // Concat '> ' with root ID for the parent of top-level tabs.
-            $parent = empty($task_info['tab_parent_id']) ? '> ' . $task_info['tab_root_id'] : $task_info['tab_parent_id'];
-            $children[$parent][$plugin_id] = $task_info;
-          }
-        }
-        foreach (array_keys($tab_root_ids) as $root_id) {
-          // Convert the tree keyed by plugin IDs into a simple one with
-          // integer depth.  Create instances for each plugin along the way.
-          $level = 0;
-          // We used this above as the top-level parent array key.
-          $next_parent = '> ' . $root_id;
-          do {
-            $parent = $next_parent;
-            $next_parent = FALSE;
-            foreach ($children[$parent] as $plugin_id => $task_info) {
-              $plugin = $this->createInstance($plugin_id);
-              $this->instances[$route_name][$level][$plugin_id] = $plugin;
-              // Normally, l() compares the href of every link with the current
-              // path and sets the active class accordingly. But the parents of
-              // the current local task may be on a different route in which
-              // case we have to set the class manually by flagging it active.
-              if (!empty($parents[$plugin_id]) && $route_name != $task_info['route_name']) {
-                $plugin->setActive();
-              }
-              if (isset($children[$plugin_id])) {
-                // This tab has visible children
-                $next_parent = $plugin_id;
-              }
-            }
-            $level++;
-          } while ($next_parent);
-        }
-      }
-    }
-    return $this->instances[$route_name];
-  }
-
-  /**
-   * Gets the render array for all local tasks.
-   *
-   * @param string $route_name
-   *   The route for which to make renderable local tasks.
-   *
-   * @return array
-   *   A render array as expected by theme_menu_local_tasks.
-   */
-  public function getTasksBuild($route_name) {
-    $tree = $this->getLocalTasksForRoute($route_name);
-    $build = array();
-    foreach ($tree as $level => $instances) {
-      foreach ($instances as $child) {
-        $path = $this->getPath($child);
-        // Find out whether the user has access to the task.
-        $route = $this->routeProvider->getRouteByName($child->getRouteName());
-        $map = array();
-        // @todo - replace this call when we have a real service for it.
-        $access = menu_item_route_access($route, $path, $map);
-        if ($access) {
-          // Need to flag the list element as active for a tab for the current
-          // route or if the plugin is set active (i.e. the parent tab).
-          $active = ($route_name == $child->getRouteName() || $child->getActive());
-          // @todo It might make sense to use menu link entities instead of
-          //   arrays.
-          $menu_link = array(
-            'title' => $this->getTitle($child),
-            'href' => $path,
-            'localized_options' => $child->getOptions(),
-          );
-          $build[$level][$path] = array(
-            '#theme' => 'menu_local_task',
-            '#link' => $menu_link,
-            '#active' => $active,
-            '#weight' => $child->getWeight(),
-            '#access' => $access,
-          );
-        }
-      }
-    }
-    return $build;
-  }
-
-}
diff --git a/core/lib/Drupal/Core/Plugin/ContainerFactoryPluginBase.php b/core/lib/Drupal/Core/Plugin/ContainerFactoryPluginBase.php
new file mode 100644
index 0000000..f8fea75
--- /dev/null
+++ b/core/lib/Drupal/Core/Plugin/ContainerFactoryPluginBase.php
@@ -0,0 +1,25 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\Plugin\ContainerFactoryPluginBase.
+ */
+
+namespace Drupal\Core\Plugin;
+
+use Drupal\Component\Plugin\PluginBase;
+use Symfony\Component\DependencyInjection\ContainerInterface;
+
+/**
+ * Defines a base plugin that can pull its dependencies from the container.
+ */
+abstract class ContainerFactoryPluginBase extends PluginBase implements ContainerFactoryPluginInterface {
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, array $plugin_definition) {
+    return new static($configuration, $plugin_id, $plugin_definition);
+  }
+
+}
diff --git a/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php b/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php
index b7b0557..7a1cdac 100644
--- a/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php
+++ b/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php
@@ -8,7 +8,7 @@
 namespace Drupal\Core\Plugin;
 
 use Drupal\Component\Plugin\Discovery\CachedDiscoveryInterface;
-use Drupal\Core\Plugin\Discovery\ContainerDerivativeDiscoveryDecorator;
+use Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator;
 use Drupal\Component\Plugin\PluginManagerBase;
 use Drupal\Component\Plugin\PluginManagerInterface;
 use Drupal\Component\Utility\NestedArray;
@@ -98,7 +98,7 @@ class DefaultPluginManager extends PluginManagerBase implements PluginManagerInt
   public function __construct($subdir, \Traversable $namespaces, $annotation_namespaces = array(), $plugin_definition_annotation_name = 'Drupal\Component\Annotation\Plugin') {
     $this->subdir = $subdir;
     $this->discovery = new AnnotatedClassDiscovery($subdir, $namespaces, $annotation_namespaces, $plugin_definition_annotation_name);
-    $this->discovery = new ContainerDerivativeDiscoveryDecorator($this->discovery);
+    $this->discovery = new DerivativeDiscoveryDecorator($this->discovery);
     $this->factory = new ContainerFactory($this);
   }
 
diff --git a/core/lib/Drupal/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecorator.php b/core/lib/Drupal/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecorator.php
deleted file mode 100644
index fcae2e3..0000000
--- a/core/lib/Drupal/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecorator.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\Core\Plugin\Discovery\ContainerDerivativeDiscoveryDecorator.
- */
-
-namespace Drupal\Core\Plugin\Discovery;
-
-use Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator;
-
-class ContainerDerivativeDiscoveryDecorator extends DerivativeDiscoveryDecorator {
-
-  /**
-   * {@inheritdoc}
-   */
-  protected function getDerivativeFetcher($base_plugin_id, array $base_definition) {
-    if (!isset($this->derivativeFetchers[$base_plugin_id])) {
-      $this->derivativeFetchers[$base_plugin_id] = FALSE;
-      if (isset($base_definition['derivative'])) {
-        $class = $base_definition['derivative'];
-        // If the derivative class provides a factory method, pass the container
-        // to it.
-        if (is_subclass_of($class, 'Drupal\Core\Plugin\Discovery\ContainerDerivativeInterface')) {
-          $this->derivativeFetchers[$base_plugin_id] = $class::create(\Drupal::getContainer(), $base_plugin_id);
-        }
-        else {
-          $this->derivativeFetchers[$base_plugin_id] = new $class($base_plugin_id);
-        }
-      }
-    }
-    return $this->derivativeFetchers[$base_plugin_id] ?: NULL;
-  }
-
-}
diff --git a/core/lib/Drupal/Core/Plugin/Discovery/ContainerDerivativeInterface.php b/core/lib/Drupal/Core/Plugin/Discovery/ContainerDerivativeInterface.php
deleted file mode 100644
index 6ba68a6..0000000
--- a/core/lib/Drupal/Core/Plugin/Discovery/ContainerDerivativeInterface.php
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\Core\Plugin\Discovery\ContainerDerivativeInterface.
- */
-
-namespace Drupal\Core\Plugin\Discovery;
-
-use Symfony\Component\DependencyInjection\ContainerInterface;
-
-/**
- * Derivative fetcher interface to pass the container to static create method.
- */
-interface ContainerDerivativeInterface {
-
-  /**
-   * Creates an instance of the derivative fetcher.
-   *
-   * @param \Symfony\Component\DependencyInjection\ContainerInterface $container
-   *   The container to pull out services used in the fetcher.
-   * @param string $plugin_id
-   *   The base plugin ID for the plugin ID.
-   *
-   * @return static
-   *   Returns an instance of this fetcher.
-   */
-  public static function create(ContainerInterface $container, $base_plugin_id);
-
-}
diff --git a/core/lib/Drupal/Core/Routing/RouteProvider.php b/core/lib/Drupal/Core/Routing/RouteProvider.php
index 752cf56..bd6c475 100644
--- a/core/lib/Drupal/Core/Routing/RouteProvider.php
+++ b/core/lib/Drupal/Core/Routing/RouteProvider.php
@@ -246,7 +246,7 @@ protected function getRoutesByPath($path) {
 
     $ancestors = $this->getCandidateOutlines($parts);
 
-    $routes = $this->connection->query("SELECT name, route FROM {" . $this->connection->escapeTable($this->tableName) . "} WHERE pattern_outline IN (:patterns) ORDER BY fit DESC", array(
+    $routes = $this->connection->query("SELECT name, route FROM {" . $this->connection->escapeTable($this->tableName) . "} WHERE pattern_outline IN (:patterns) ORDER BY fit", array(
       ':patterns' => $ancestors,
     ))
       ->fetchAllKeyed();
diff --git a/core/lib/Drupal/Core/Session/AccountInterface.php b/core/lib/Drupal/Core/Session/AccountInterface.php
index a53d088..1dbc13c 100644
--- a/core/lib/Drupal/Core/Session/AccountInterface.php
+++ b/core/lib/Drupal/Core/Session/AccountInterface.php
@@ -32,17 +32,6 @@ public function id();
   public function getRoles();
 
   /**
-   * Checks whether a user has a certain permission.
-   *
-   * @param string $permission
-   *   The permission string to check.
-   *
-   * @return bool
-   *   TRUE if the user has the permission, FALSE otherwise.
-   */
-  public function hasPermission($permission);
-
-  /**
    * Returns the session ID.
    *
    * @return string|NULL
@@ -66,63 +55,4 @@ public function getSecureSessionId();
    */
   public function getSessionData();
 
-  /**
-   * Returns TRUE if the account is authenticated.
-   *
-   * @return bool
-   *   TRUE if the account is authenticated.
-   */
-  public function isAuthenticated();
-
-  /**
-   * Returns TRUE if the account is anonymous.
-   *
-   * @return bool
-   *   TRUE if the account is anonymous.
-   */
-  public function isAnonymous();
-
-  /**
-   * Returns the preferred language code of the account.
-   *
-   * @param string $default
-   *   (optional) Default language code to return if the account
-   *   has no valid language, defaults to the site default language.
-   *
-   * @return string
-   *   The language code that is preferred by the account.
-   */
-  public function getPreferredLangcode($default = NULL);
-
-  /**
-   * Returns the preferred administrative language code of the account.
-   *
-   * Defines which language is used on administrative pages.
-   *
-   * @param string $default
-   *   (optional) Default language code to return if the account
-   *   has no valid language, defaults to the site default language.
-   *
-   * @return string
-   *   The language code that is preferred by the account.
-   */
-  public function getPreferredAdminLangcode($default = NULL);
-
-  /**
-   * Returns the username of this account.
-   *
-   * By default, the passed-in object's 'name' property is used if it exists, or
-   * else, the site-defined value for the 'anonymous' variable. However, a module
-   * may override this by implementing
-   * hook_user_format_name_alter(&$name, $account).
-   *
-   * @see hook_user_format_name_alter()
-   *
-   * @return
-   *   An unsanitized string with the username to display. The code receiving
-   *   this result must ensure that check_plain() is called on it before it is
-   *   printed to the page.
-   */
-  public function getUsername();
-
 }
diff --git a/core/lib/Drupal/Core/Session/UserSession.php b/core/lib/Drupal/Core/Session/UserSession.php
index 7922d06..300cd8f 100644
--- a/core/lib/Drupal/Core/Session/UserSession.php
+++ b/core/lib/Drupal/Core/Session/UserSession.php
@@ -19,7 +19,7 @@ class UserSession implements AccountInterface {
    *
    * @var int
    */
-  protected $uid;
+  public $uid;
 
   /**
    * Session hostname.
@@ -66,27 +66,6 @@ class UserSession implements AccountInterface {
   public $timestamp;
 
   /**
-   * The name of this account.
-   *
-   * @var string
-   */
-  public $name;
-
-  /**
-   * The preferred language code of the account.
-   *
-   * @var string
-   */
-  protected $preferred_langcode;
-
-  /**
-   * The preferred administrative language code of the account.
-   *
-   * @var string
-   */
-  protected $preferred_admin_langcode;
-
-  /**
    * Constructs a new user session.
    *
    * @param array $values
@@ -115,26 +94,6 @@ public function getRoles() {
   /**
    * {@inheritdoc}
    */
-  public function hasPermission($permission) {
-    // User #1 has all privileges.
-    if ((int) $this->id() === 1) {
-      return TRUE;
-    }
-
-    $roles = \Drupal::entityManager()->getStorageController('user_role')->loadMultiple($this->getRoles());
-
-    foreach ($roles as $role) {
-      if ($role->hasPermission($permission)) {
-        return TRUE;
-      }
-    }
-
-    return FALSE;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
   public function getSecureSessionId() {
     return $this->ssid;
   }
@@ -153,53 +112,4 @@ public function getSessionId() {
     return $this->sid;
   }
 
-  /**
-   * {@inheritdoc}
-   */
-  public function isAuthenticated() {
-    return $this->uid > 0;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function isAnonymous() {
-    return $this->uid == 0;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  function getPreferredLangcode($default = NULL) {
-    $language_list = language_list();
-    if (!empty($this->preferred_langcode) && isset($language_list[$this->preferred_langcode])) {
-      return $language_list[$this->preferred_langcode]->id;
-    }
-    else {
-      return $default ? $default : language_default()->id;
-    }
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  function getPreferredAdminLangcode($default = NULL) {
-    $language_list = language_list();
-    if (!empty($this->preferred_admin_langcode) && isset($language_list[$this->preferred_admin_langcode])) {
-      return $language_list[$this->preferred_admin_langcode]->id;
-    }
-    else {
-      return $default ? $default : language_default()->id;
-    }
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getUsername() {
-    $name = $this->name ?: \Drupal::config('user.settings')->get('anonymous');
-    \Drupal::moduleHandler()->alter('user_format_name', $name, $this);
-    return $name;
-  }
-
 }
diff --git a/core/lib/Drupal/Core/TypedData/ComplexDataInterface.php b/core/lib/Drupal/Core/TypedData/ComplexDataInterface.php
index a681ffe..595064e 100644
--- a/core/lib/Drupal/Core/TypedData/ComplexDataInterface.php
+++ b/core/lib/Drupal/Core/TypedData/ComplexDataInterface.php
@@ -128,7 +128,7 @@ public function isEmpty();
   /**
    * React to changes to a child property.
    *
-   * Note that this is invoked after any changes have been applied.
+   * Note that this is invoked before any changes are applied.
    *
    * @param $property_name
    *   The name of the property which is changed.
diff --git a/core/lib/Drupal/Core/TypedData/DataDefinitionException.php b/core/lib/Drupal/Core/TypedData/DataDefinitionException.php
deleted file mode 100644
index 2a23315..0000000
--- a/core/lib/Drupal/Core/TypedData/DataDefinitionException.php
+++ /dev/null
@@ -1,15 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\Core\TypedData\MissingContextException.
- */
-
-namespace Drupal\Core\TypedData;
-
-/**
- * Exception thrown when a data definition lacks required information.
- */
-class DataDefinitionException extends \Exception {
-
-}
diff --git a/core/lib/Drupal/Core/TypedData/DataReferenceBase.php b/core/lib/Drupal/Core/TypedData/DataReferenceBase.php
deleted file mode 100644
index 8e67a24..0000000
--- a/core/lib/Drupal/Core/TypedData/DataReferenceBase.php
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\Core\TypedData\DataReferenceBase.
- */
-
-namespace Drupal\Core\TypedData;
-
-/**
- * Base class for typed data references.
- *
- * Implementing classes have to implement at least
- * \Drupal\Core\TypedData\DataReferenceInterface::getTargetDefinition() and
- * \Drupal\Core\TypedData\DataReferenceInterface::getTargetIdentifier().
- */
-abstract class DataReferenceBase extends TypedData implements DataReferenceInterface  {
-
-  /**
-   * The referenced data.
-   *
-   * @var \Drupal\Core\TypedData\TypedDataInterface
-   */
-  protected $target;
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getTarget() {
-    return $this->target;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getValue() {
-    if ($target = $this->getTarget()) {
-      return $target->getValue();
-    }
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function setValue($value, $notify = TRUE) {
-    $this->target = \Drupal::typedData()->create($this->getTargetDefinition(), $value);
-    // Notify the parent of any changes.
-    if ($notify && isset($this->parent)) {
-      $this->parent->onChange($this->name);
-    }
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getString() {
-    return (string) $this->getType() . ':' . $this->getTargetIdentifier();
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getTargetIdentifier() {
-    $target = $this->getTarget();
-    return isset($target) ? $target->id() : NULL;
-  }
-}
diff --git a/core/lib/Drupal/Core/TypedData/DataReferenceInterface.php b/core/lib/Drupal/Core/TypedData/DataReferenceInterface.php
deleted file mode 100644
index 501f9d2..0000000
--- a/core/lib/Drupal/Core/TypedData/DataReferenceInterface.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\Core\TypedData\DataReferenceInterface.
- */
-
-namespace Drupal\Core\TypedData;
-
-/**
- * Interface for typed data references.
- */
-interface DataReferenceInterface  {
-
-  /**
-   * Gets the data definition of the referenced data.
-   *
-   * @return array
-   *   The data definition of the referenced data.
-   */
-  public function getTargetDefinition();
-
-  /**
-   * Gets the referenced data.
-   *
-   * @return \Drupal\Core\TypedData\TypedDataInterface|null
-   *   The referenced typed data object, or NULL if the reference is unset.
-   */
-  public function getTarget();
-
-  /**
-   * Gets the identifier of the referenced data.
-   *
-   * @return int|string|null
-   *   The identifier of the referenced data, or NULL if the reference is unset.
-   */
-  public function getTargetIdentifier();
-}
diff --git a/core/lib/Drupal/Core/TypedData/IdentifiableInterface.php b/core/lib/Drupal/Core/TypedData/IdentifiableInterface.php
deleted file mode 100644
index 09f8c92..0000000
--- a/core/lib/Drupal/Core/TypedData/IdentifiableInterface.php
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\Core\TypedData\IdentifiableInterface.
- */
-
-namespace Drupal\Core\TypedData;
-
-/**
- * Interface for identifiable typed data.
- */
-interface IdentifiableInterface {
-
-  /**
-   * Returns the identifier.
-   *
-   * @return string|int|null
-   *   The object identifier, or NULL if the object does not yet have an identifier.
-   */
-  public function id();
-}
diff --git a/core/lib/Drupal/Core/TypedData/ItemList.php b/core/lib/Drupal/Core/TypedData/ItemList.php
index 9b39e83..ee69432 100644
--- a/core/lib/Drupal/Core/TypedData/ItemList.php
+++ b/core/lib/Drupal/Core/TypedData/ItemList.php
@@ -42,6 +42,10 @@ public function getValue() {
    *   An array of values of the field items, or NULL to unset the field.
    */
   public function setValue($values, $notify = TRUE) {
+    // Notify the parent of any changes to be made.
+    if ($notify && isset($this->parent)) {
+      $this->parent->onChange($this->name);
+    }
     if (!isset($values) || $values === array()) {
       $this->list = $values;
     }
@@ -68,10 +72,6 @@ public function setValue($values, $notify = TRUE) {
         }
       }
     }
-    // Notify the parent of any changes.
-    if ($notify && isset($this->parent)) {
-      $this->parent->onChange($this->name);
-    }
   }
 
   /**
diff --git a/core/lib/Drupal/Core/TypedData/ListInterface.php b/core/lib/Drupal/Core/TypedData/ListInterface.php
index 451e1af..2711cd4 100644
--- a/core/lib/Drupal/Core/TypedData/ListInterface.php
+++ b/core/lib/Drupal/Core/TypedData/ListInterface.php
@@ -41,7 +41,7 @@ public function getItemDefinition();
   /**
    * React to changes to a child item.
    *
-   * Note that this is invoked after any changes have been applied.
+   * Note that this is invoked before any changes are applied.
    *
    * @param $delta
    *   The delta of the item which is changed.
diff --git a/core/lib/Drupal/Core/TypedData/Plugin/DataType/Binary.php b/core/lib/Drupal/Core/TypedData/Plugin/DataType/Binary.php
index 16ac5d6..908f040 100644
--- a/core/lib/Drupal/Core/TypedData/Plugin/DataType/Binary.php
+++ b/core/lib/Drupal/Core/TypedData/Plugin/DataType/Binary.php
@@ -59,6 +59,10 @@ public function getValue() {
    * Supports a PHP file resource or a (absolute) stream resource URI as value.
    */
   public function setValue($value, $notify = TRUE) {
+    // Notify the parent of any changes to be made.
+    if ($notify && isset($this->parent)) {
+      $this->parent->onChange($this->name);
+    }
     if (!isset($value)) {
       $this->handle = NULL;
       $this->uri = NULL;
@@ -72,10 +76,6 @@ public function setValue($value, $notify = TRUE) {
     else {
       $this->handle = $value;
     }
-    // Notify the parent of any changes.
-    if ($notify && isset($this->parent)) {
-      $this->parent->onChange($this->name);
-    }
   }
 
   /**
diff --git a/core/lib/Drupal/Core/TypedData/Plugin/DataType/DateTimeIso8601.php b/core/lib/Drupal/Core/TypedData/Plugin/DataType/DateTimeIso8601.php
index 906b4eb..59bbe8a 100644
--- a/core/lib/Drupal/Core/TypedData/Plugin/DataType/DateTimeIso8601.php
+++ b/core/lib/Drupal/Core/TypedData/Plugin/DataType/DateTimeIso8601.php
@@ -36,12 +36,8 @@ public function getDateTime() {
   /**
    * {@inheritdoc}
    */
-  public function setDateTime(DrupalDateTime $dateTime, $notify = TRUE) {
+  public function setDateTime(DrupalDateTime $dateTime) {
     $this->value = $dateTime->format('c');
-    // Notify the parent of any changes.
-    if ($notify && isset($this->parent)) {
-      $this->parent->onChange($this->name);
-    }
   }
 }
 
diff --git a/core/lib/Drupal/Core/TypedData/Plugin/DataType/DurationIso8601.php b/core/lib/Drupal/Core/TypedData/Plugin/DataType/DurationIso8601.php
index 9e67026..d83261f 100644
--- a/core/lib/Drupal/Core/TypedData/Plugin/DataType/DurationIso8601.php
+++ b/core/lib/Drupal/Core/TypedData/Plugin/DataType/DurationIso8601.php
@@ -37,14 +37,10 @@ public function getDuration() {
   /**
    * {@inheritdoc}
    */
-  public function setDuration(\DateInterval $duration, $notify = TRUE) {
+  public function setDuration(\DateInterval $duration) {
     // Generate an ISO 8601 formatted string as supported by
     // DateInterval::__construct() and setValue().
     $this->value = $duration->format('%rP%yY%mM%dDT%hH%mM%sS');
-    // Notify the parent of any changes.
-    if ($notify && isset($this->parent)) {
-      $this->parent->onChange($this->name);
-    }
   }
 
 }
diff --git a/core/lib/Drupal/Core/TypedData/Plugin/DataType/Language.php b/core/lib/Drupal/Core/TypedData/Plugin/DataType/Language.php
index 87d0bdf..fdb7e59 100644
--- a/core/lib/Drupal/Core/TypedData/Plugin/DataType/Language.php
+++ b/core/lib/Drupal/Core/TypedData/Plugin/DataType/Language.php
@@ -11,7 +11,6 @@
 use Drupal\Core\Annotation\Translation;
 use InvalidArgumentException;
 use Drupal\Core\Language\Language as LanguageObject;
-use Drupal\Core\TypedData\IdentifiableInterface;
 use Drupal\Core\TypedData\TypedData;
 
 /**
@@ -21,36 +20,39 @@
  * \Drupal\Core\Language\Language. For setting the value the language object or
  * the language code as string may be passed.
  *
+ * Optionally, this class may be used as computed property, see the supported
+ * settings below. E.g., it is used as 'language' property of language items.
+ *
+ * Supported settings (below the definition's 'settings' key) are:
+ *  - langcode source: If used as computed property, the langcode property used
+ *    to load the language object.
+ *
  * @DataType(
  *   id = "language",
  *   label = @Translation("Language"),
  *   description = @Translation("A language object.")
  * )
  */
-class Language extends TypedData implements IdentifiableInterface {
+class Language extends TypedData {
 
   /**
-   * The id of the language.
+   * The language code of the language if no 'langcode source' is used.
    *
    * @var string
    */
-  protected $id;
-
-  /**
-   * @var \Drupal\Core\Language
-   */
-  protected $language;
+  protected $langcode;
 
   /**
    * Overrides TypedData::getValue().
-   *
-   * @return \Drupal\Core\Language\Language|null
    */
   public function getValue() {
-    if (!isset($this->language) && $this->id) {
-      $this->language = language_load($this->id);
+    if (!empty($this->definition['settings']['langcode source'])) {
+      $this->id = $this->parent->__get($this->definition['settings']['langcode source']);
+    }
+   if ($this->id) {
+      $language = language_load($this->id);
+      return $language ?: new LanguageObject(array('id' => $this->id));
     }
-    return $this->language;
   }
 
   /**
@@ -61,19 +63,21 @@ public function getValue() {
   public function setValue($value, $notify = TRUE) {
     // Support passing language objects.
     if (is_object($value)) {
-      $this->id = $value->id;
-      $this->language = $value;
+      $value = $value->id;
     }
     elseif (isset($value) && !is_scalar($value)) {
       throw new InvalidArgumentException('Value is no valid langcode or language object.');
     }
+    // Update the 'langcode source' property, if given.
+    if (!empty($this->definition['settings']['langcode source'])) {
+      $this->parent->__set($this->definition['settings']['langcode source'], $value, $notify);
+    }
     else {
+      // Notify the parent of any changes to be made.
+      if ($notify && isset($this->parent)) {
+        $this->parent->onChange($this->name);
+      }
       $this->id = $value;
-      $this->language = NULL;
-    }
-    // Notify the parent of any changes.
-    if ($notify && isset($this->parent)) {
-      $this->parent->onChange($this->name);
     }
   }
 
@@ -84,17 +88,4 @@ public function getString() {
     $language = $this->getValue();
     return $language ? $language->name : '';
   }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function id() {
-    if (isset($this->id)) {
-      return $this->id;
-    }
-    elseif (isset($this->language)) {
-      return $this->language->id;
-    }
-  }
-
 }
diff --git a/core/lib/Drupal/Core/TypedData/Plugin/DataType/Map.php b/core/lib/Drupal/Core/TypedData/Plugin/DataType/Map.php
index 180003c..a033322 100644
--- a/core/lib/Drupal/Core/TypedData/Plugin/DataType/Map.php
+++ b/core/lib/Drupal/Core/TypedData/Plugin/DataType/Map.php
@@ -84,6 +84,10 @@ public function setValue($values, $notify = TRUE) {
     if (isset($values) && !is_array($values)) {
       throw new \InvalidArgumentException("Invalid values given. Values must be represented as an associative array.");
     }
+    // Notify the parent of any changes to be made.
+    if ($notify && isset($this->parent)) {
+      $this->parent->onChange($this->name);
+    }
     $this->values = $values;
 
     // Update any existing property objects.
@@ -94,10 +98,6 @@ public function setValue($values, $notify = TRUE) {
       }
       $property->setValue($value, FALSE);
     }
-    // Notify the parent of any changes.
-    if ($notify && isset($this->parent)) {
-      $this->parent->onChange($this->name);
-    }
   }
 
   /**
@@ -131,16 +131,16 @@ public function get($property_name) {
    * Implements \Drupal\Core\TypedData\ComplexDataInterface::set().
    */
   public function set($property_name, $value, $notify = TRUE) {
+    // Notify the parent of any changes to be made.
+    if ($notify && isset($this->parent)) {
+      $this->parent->onChange($this->name);
+    }
     if ($this->getPropertyDefinition($property_name)) {
-      $this->get($property_name)->setValue($value, $notify);
+      $this->get($property_name)->setValue($value);
     }
     else {
       // Just set the plain value, which allows adding a new entry to the map.
       $this->values[$property_name] = $value;
-      // Directly notify ourselves.
-      if ($notify) {
-        $this->onChange($property_name, $value);
-      }
     }
   }
 
diff --git a/core/lib/Drupal/Core/TypedData/Plugin/DataType/TimeSpan.php b/core/lib/Drupal/Core/TypedData/Plugin/DataType/TimeSpan.php
index c91fcd2..b0ec72a 100644
--- a/core/lib/Drupal/Core/TypedData/Plugin/DataType/TimeSpan.php
+++ b/core/lib/Drupal/Core/TypedData/Plugin/DataType/TimeSpan.php
@@ -43,7 +43,7 @@ public function getDuration() {
   /**
    * {@inheritdoc}
    */
-  public function setDuration(\DateInterval $duration, $notify = TRUE) {
+  public function setDuration(\DateInterval $duration) {
     // Note that this applies the assumption of 12 month's a 30 days and
     // each year having 365 days. There is no accurate conversion for time spans
     // exceeding a day.
@@ -53,11 +53,6 @@ public function setDuration(\DateInterval $duration, $notify = TRUE) {
       ($duration->h * 60 * 60) +
       ($duration->i * 60) +
        $duration->s;
-
-    // Notify the parent of any changes.
-    if ($notify && isset($this->parent)) {
-      $this->parent->onChange($this->name);
-    }
   }
 
 }
diff --git a/core/lib/Drupal/Core/TypedData/Plugin/DataType/Timestamp.php b/core/lib/Drupal/Core/TypedData/Plugin/DataType/Timestamp.php
index c0cad02..18c99dc 100644
--- a/core/lib/Drupal/Core/TypedData/Plugin/DataType/Timestamp.php
+++ b/core/lib/Drupal/Core/TypedData/Plugin/DataType/Timestamp.php
@@ -41,11 +41,7 @@ public function getDateTime() {
   /**
    * {@inheritdoc}
    */
-  public function setDateTime(DrupalDateTime $dateTime, $notify = TRUE) {
+  public function setDateTime(DrupalDateTime $dateTime) {
     $this->value = $dateTime->getTimestamp();
-    // Notify the parent of any changes.
-    if ($notify && isset($this->parent)) {
-      $this->parent->onChange($this->name);
-    }
   }
 }
diff --git a/core/lib/Drupal/Core/TypedData/PrimitiveBase.php b/core/lib/Drupal/Core/TypedData/PrimitiveBase.php
index dae6dbe..1ba9319 100644
--- a/core/lib/Drupal/Core/TypedData/PrimitiveBase.php
+++ b/core/lib/Drupal/Core/TypedData/PrimitiveBase.php
@@ -30,10 +30,10 @@ public function getValue() {
    * {@inheritdoc}
    */
   public function setValue($value, $notify = TRUE) {
-    $this->value = $value;
-    // Notify the parent of any changes.
+    // Notify the parent of any changes to be made.
     if ($notify && isset($this->parent)) {
       $this->parent->onChange($this->name);
     }
+    $this->value = $value;
   }
 }
diff --git a/core/lib/Drupal/Core/TypedData/TypedData.php b/core/lib/Drupal/Core/TypedData/TypedData.php
index f54f8ed..8bfa215 100644
--- a/core/lib/Drupal/Core/TypedData/TypedData.php
+++ b/core/lib/Drupal/Core/TypedData/TypedData.php
@@ -97,11 +97,11 @@ public function getValue() {
    * Implements \Drupal\Core\TypedData\TypedDataInterface::setValue().
    */
   public function setValue($value, $notify = TRUE) {
-    $this->value = $value;
-    // Notify the parent of any changes.
+    // Notify the parent of any changes to be made.
     if ($notify && isset($this->parent)) {
       $this->parent->onChange($this->name);
     }
+    $this->value = $value;
   }
 
   /**
diff --git a/core/lib/Drupal/Core/TypedData/TypedDataManager.php b/core/lib/Drupal/Core/TypedData/TypedDataManager.php
index 5c48fb0..f0e8034 100644
--- a/core/lib/Drupal/Core/TypedData/TypedDataManager.php
+++ b/core/lib/Drupal/Core/TypedData/TypedDataManager.php
@@ -219,16 +219,18 @@ public function getInstance(array $options) {
    * @todo: Add type-hinting to $object once entities implement the
    *   TypedDataInterface.
    */
-  public function getPropertyInstance(TypedDataInterface $object, $property_name, $value = NULL) {
-    $definition = $object->getRoot()->getDefinition();
-    $key = $definition['type'];
-    if (isset($definition['settings'])) {
-      $key .= ':' . implode(',', $definition['settings']);
+  public function getPropertyInstance($object, $property_name, $value = NULL) {
+    if ($root = $object->getRoot()) {
+      $key = $root->getType() . ':' . $object->getPropertyPath() . '.';
+      // If we are creating list items, we always use 0 in the key as all list
+      // items look the same.
+      $key .= is_numeric($property_name) ? 0 : $property_name;
+    }
+    else {
+      // Missing context, thus we cannot determine a unique key for prototyping.
+      // Fall back to create a new prototype on each call.
+      $key = FALSE;
     }
-    $key .= ':' . $object->getPropertyPath() . '.';
-    // If we are creating list items, we always use 0 in the key as all list
-    // items look the same.
-    $key .= is_numeric($property_name) ? 0 : $property_name;
 
     // Make sure we have a prototype. Then, clone the prototype and set object
     // specific values, i.e. the value and the context.
diff --git a/core/lib/Drupal/Core/Utility/CacheArray.php b/core/lib/Drupal/Core/Utility/CacheArray.php
index 9748753..6eef834 100644
--- a/core/lib/Drupal/Core/Utility/CacheArray.php
+++ b/core/lib/Drupal/Core/Utility/CacheArray.php
@@ -62,8 +62,6 @@
  * procedural code. Extending classes may wish to alter this behavior, for
  * example by overriding offsetSet() and adding an automatic call to persist().
  *
- * @deprecated as of Drupal 8.0. Use \Drupal\Core\Cache\CacheCollector instead.
- *
  * @see SchemaCache
  */
 abstract class CacheArray implements ArrayAccess {
@@ -165,11 +163,11 @@ public function offsetUnset($offset) {
    * without necessarily writing back to the persistent cache at the end.
    *
    * @param $offset
-   *   The array offset that was requested.
+   *   The array offset that was request.
    * @param $persist
    *   Optional boolean to specify whether the offset should be persisted or
    *   not, defaults to TRUE. When called with $persist = FALSE the offset will
-   *   be unflagged so that it will not be written at the end of the request.
+   *   be unflagged so that it will not written at the end of the request.
    */
   protected function persist($offset, $persist = TRUE) {
     $this->keysToPersist[$offset] = $persist;
diff --git a/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/BundleConstraint.php b/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/BundleConstraint.php
index ebd844b..f6ea289 100644
--- a/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/BundleConstraint.php
+++ b/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/BundleConstraint.php
@@ -20,7 +20,7 @@
  * @Plugin(
  *   id = "Bundle",
  *   label = @Translation("Bundle", context = "Validation"),
- *   type = { "entity", "entity_reference" }
+ *   type = "entity"
  * )
  */
 class BundleConstraint extends Constraint {
diff --git a/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/BundleConstraintValidator.php b/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/BundleConstraintValidator.php
index 42f09ca..a84251e 100644
--- a/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/BundleConstraintValidator.php
+++ b/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/BundleConstraintValidator.php
@@ -18,7 +18,10 @@ class BundleConstraintValidator extends ConstraintValidator {
   /**
    * Implements \Symfony\Component\Validator\ConstraintValidatorInterface::validate().
    */
-  public function validate($entity, Constraint $constraint) {
+  public function validate($typed_data, Constraint $constraint) {
+    // If the entity is contained in a reference, unwrap it first.
+    $entity = isset($typed_data) && !($typed_data instanceof EntityInterface) ? $typed_data->getValue() : FALSE;
+
     if (!empty($entity) && !in_array($entity->bundle(), $constraint->getBundleOption())) {
       $this->context->addViolation($constraint->message, array('%bundle', implode(', ', $constraint->getBundleOption())));
     }
diff --git a/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/EntityTypeConstraint.php b/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/EntityTypeConstraint.php
index d480fa1..1d38ae5 100644
--- a/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/EntityTypeConstraint.php
+++ b/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/EntityTypeConstraint.php
@@ -20,7 +20,7 @@
  * @Plugin(
  *   id = "EntityType",
  *   label = @Translation("Entity type", context = "Validation"),
- *   type = { "entity", "entity_reference" }
+ *   type = "entity"
  * )
  */
 class EntityTypeConstraint extends Constraint {
diff --git a/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/EntityTypeConstraintValidator.php b/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/EntityTypeConstraintValidator.php
index 304a85c..31c7cb2 100644
--- a/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/EntityTypeConstraintValidator.php
+++ b/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/EntityTypeConstraintValidator.php
@@ -19,7 +19,9 @@ class EntityTypeConstraintValidator extends ConstraintValidator {
   /**
    * Implements \Symfony\Component\Validator\ConstraintValidatorInterface::validate().
    */
-  public function validate($entity, Constraint $constraint) {
+  public function validate($typed_data, Constraint $constraint) {
+    // If the entity is contained in a reference, unwrap it first.
+    $entity = isset($typed_data) && !($typed_data instanceof EntityInterface) ? $typed_data->getValue() : FALSE;
 
     if (!empty($entity) && $entity->entityType() != $constraint->type) {
       $this->context->addViolation($constraint->message, array('%type' => $constraint->type));
diff --git a/core/misc/drupal.base.css b/core/misc/drupal.base.css
deleted file mode 100644
index 2f081e9..0000000
--- a/core/misc/drupal.base.css
+++ /dev/null
@@ -1,89 +0,0 @@
-/**
- * @file
- * Provides a base styling for HTML elements in Drupal.
- */
-
-/**
- * Block-level HTML5 display definition.
- *
- * Provides display values for browsers that don't recognize the new elements
- * and therefore display them inline by default.
- */
-article,
-aside,
-details,
-figcaption,
-figure,
-footer,
-header,
-main,
-nav,
-section,
-summary {
-  display: block;
-}
-
-/**
- * Form elements.
- */
-form {
-  margin: 0;
-  padding: 0;
-}
-fieldset {
-  border: 1px solid #ccc;
-  margin: 1em 0;
-  padding: 0.5em;
-}
-label {
-  display: block;
-  font-weight: bold;
-}
-input {
-  /* Keep form elements from overflowing their containers. */
-  max-width: 100%;
-  -moz-box-sizing: border-box;
-  -webkit-box-sizing: border-box;
-  box-sizing: border-box;
-}
-
-/**
- * Table elements.
- */
-table {
-  border-collapse: collapse;
-  width: 100%;
-}
-caption {
-  text-align: left; /* LTR */
-}
-[dir="rtl"] caption {
-  text-align: right;
-}
-th {
-  padding-right: 1em; /* LTR */
-  text-align: left; /* LTR */
-}
-[dir="rtl"] th {
-  text-align: right;
-  padding-left: 1em;
-  padding-right: 0;
-}
-thead > tr {
-  border-bottom: 1px solid #000;
-}
-tr {
-  border-bottom: 1px solid #ccc;
-  padding: 0.1em 0.6em;
-}
-
-/**
- * Miscellaneous elements.
- */
-hr {
-  border: 1px solid gray;
-  height: 1px;
-}
-img {
-  border: 0;
-}
diff --git a/core/misc/progress.gif b/core/misc/progress.gif
new file mode 100644
index 0000000..f84a9de
--- /dev/null
+++ b/core/misc/progress.gif
@@ -0,0 +1,32 @@
+GIF89a ( æ  h¸êg·êf¶éeµèd´æc³åa±ä`°â^®á]­ß[«Ý`¨ÔZ©Ü`¨Õ_§Ó_§ÔX¨Ú^¦Ò^¦Ó]¥ÒV¦Ù]¥Ñ\¤ÑU¥×\¤Ð[£ÏS£ÖY¡ÎR¢ÔY¡ÍQ¡ÓX ÌX ÍP ÒVžËVžÊOŸÑUœÈ[›ÄZ›ÃZ›ÄNžÐUœÉY›ÃYšÂS›ÇS›ÈX™ÁXšÂW™ÁQ™ÅV—ÀW—ÀQ™ÆP˜ÅP˜ÄU–¾T–¾T•½N–ÃN–ÂS•½M•ÁR“»M•ÂQ’ºP’ºK“ÀK“¿J’¾J’¿O¸N¸I‘½I‘¾NŽ·H¼MŽ·G¼G»LµFŽ»KµFŽºJ‹´IŠ²HŠ²Gˆ°Fˆ°F‡¯E‡¯E…®D…®C„¬Bƒ«Aƒ«A‚ªAª@ª@‚ªþ                                                                                 !ÿNETSCAPE2.0   !ù  d ,     (  ÿ€‚(&(ˆ&Œ‰ •+'+—'›˜’£0,0¥,©¦¢±1/1³/·´°¿343Á4ÅÂÊ989Ð8ÔÑÎÙ=:=Ý:áÞæç?ëìí  ñòABBAúúB"#" 1B$G&D¢"A	!–(°É’‹›¸PÐÂEG-ZXl¥dI)5È¨±’¥R H‘B¥fMnØÐ¹óÆ›5«µ²ƒG‘òàa¥Š•¦U®\Áä‚ W±úðejW©Y´Ñ@dHY³Dˆh	»6‹[.Fÿ812—n‘"\¶pÉ»¥ï%’(<8I’.ˆ+Á¤±ãÆ_¼|‰ì¥²d&OœdÖüäÉ0c>ƒÚ	‰(S¢ ž2EL1®ÃÈ~%Å”Í=ƒMzŒéÌ™Džl¹ò&Œ>¬¸9`Á‚ïâÕË×/\¹tI»VK[·aÇ–=K„«W©è©ZÅ
+DkÓ§Bã5Št‡R@óãÔÉÓçÏ™&”ÒJ-½a´„FyäH"-¨ÐB=ÑDqÐ>÷ø@tO>îÀ#ô|ÐÎ:áô@Ž9èt c7ßˆc6Úd4Õà02Ê0óÁcL1ºðÂ",²Ðb.1´"J(£DPÊ)ª¤ƒ’HB‰%˜hÂÉ
+ž !ù  d ,     (  ÿ€ dƒ„„ˆd&(‰ƒƒ'+d‰‘d,0d‰š/1d‰š43d‰š89d‰š:=d‰š??d#šABdÈšGHd	%%‘KMd
+--‘PRd22‘TTd77‘UVd<<‘WXd>>‘Y´ÑÐˆ‘H[¸áÐ¨H‘H]ºñÐ(IM_È„hÄ„‰&/dH4zòD˜1)M™¢)Œ˜H$MŽ	™¨ãÇŒYÔqb"‡š.LdPSÀ‰üiÊ·/‘=MñæµÓ”nÝTpâÈ%2‡M·DÞ"E›VíZ£eÍ%kDÌX£`‘%xùj”+-[bEbåªQªH¤L5
+¥©Ó§K™"±¨Ôè‘¦I  !ù  d ,     (  è€ d„…d†‰(‰„…+„0–d139=? #B"%H*	M.
+-–R52–T67–V;<–X@>–ZCD–\FE–]JI–_L!L–cN$žtŠ’Ò”Nb 6ØÏÉ¾Nøô%²o^#xëÚ5RWî\#rßÂ5ò–m[#lÓª5’Öì™±FÈ”5biX1`–zýÒeéV.Z–bÍreiU+T–JeéS¨M–0ijT	’$FY
+ !ù  d ,     (  ê€( d…†d‡ŠŠ…Ž†+‘‘…0‘—d1Ž3Ž9Ž=Ž? Ž#B"Ž%H*	Ž-M.
+‘R5‘2—T6‘7—V;‘<—X@‘>—ZC‘D—\F‘E—]J‘I—_L!‘L—cN$‘ž\%E¤)þì4FŸ#~÷ *²ož#xëÚ9RWîœ#rßÂ9ò–m›#lÓª9’vÉ4EÇ.%[ÆLÑ°bÀ.õú¥ëÒ­\´.ÅšåêÒªV¨.•:%êÒ§PŽ8EÊDÉ‘¥H+E‚) !ù  d ,     (  ì€d( d†‡dˆˆ+‹†‡““†0“™d1“Ÿ3Ÿ9Ÿ=Ÿ? #ŸB"%ŸH*	-ŸM.
+2ŸR5Ÿ“T6“7™V;“<™X@“>™ZC“D™\F“E™]J“I™_L!“L™cN$&=É$&JŠISüøI¿O_êAº'O	¼OíÞ-Zg¤ràÄAú¦¤l™ª][ä,4i‹eRÆl‘°LÄŒM[äØ®L¸tÕÊ$‹Ö«L¬\¥Êd
+$R“Bq‚äiŒJ—25zI¤@ !ù  d ,     (  ï€dd( ‚‡‚ˆˆ+‹‚‚0““‚“šd1“ 3“ 9 = ? # B"% H*	- M.
+2 R57 T6 “V;“<šX@“>šZC“Dš\F“Eš]J“Iš_L!“LšcN$&=Ñ$&JŠISüˆO?PôìêòR<vFÔ:—nQ9pâ }Ó´­Û"jš¬a[äL4i‹iRÆl‘0MÄŒ-â¥É°l‹péª¥I­WšX¹‚¤jÒ©QJMŠÁÉ“¦J— ešÔè$I‹ !ù  d ,     (  ï€d‚( ‚‡‚ˆˆ+‹‚‚0““d1“šd“¡3“¡9«¡=¡? #¡B"%¡H*	-¡M.
+2¡R57¡T6<¡V;¡“X@“>šZC“Dš\F“Eš]J“Iš_L!“LšcN$&=Ñ$&JŠISüˆO?yôì…r/—tÖ™B.T¸q‹´iâæm5MÖ°-r¦	š´EÈ4)c¶H˜&bÆñÒäØ"[špéú¶H­WšZ¥‚ä
+ÒŒQ¥4qò	Ô¤J— ešÔè$Iˆ !ù  d ,     (  ë€d‚d( ƒˆˆˆ+‹‚‚0““d1“š3“¡“šd9“¬=“¬? #¬B"%¬H*	-¬M.
+2¬R57¬T6<¬V;>¬X@¬“ZC“Dš\F“Eš]J“Iš_L!“LšcN$&=Ñ$&JŠISüˆO?yôì±s:u¬´ûÈ$mš¸y[DM“5l‹œi‚&m2MÊ˜-¦‰˜±E¼4ù¶È–&\ºÅÒ4ëU¹E9P©
+5ª”&Nž šTé¤L“=‚$iP  !ù  d ,     (  ð€d‚‚( ƒˆˆˆ+‹‚‚0““d1“š3“š9“§“šd=“²? “#²B"%²H*	-²M.
+2²R57²T6<²V;>²X@D²ZC²“\F“Eš]J“Iš_L!“LšcN$&=Ñ$&JŠISüˆO?yôìij÷R¼IèÔ•“5n8MX¼eÛ¶c5MÖ°-r¦	š´EÈ4)c¶H˜&bÆñÒäØ¢[šrÕZKSWXJµ’(RLMâä	¨I•.AÊ4©Ñ#H’ !ù  d ,     (  î€d‚ƒ( ƒˆˆˆ+‹‚‚0““d1“š3“š9“š=“­ “šd?“#¸B"“%¸H*	-¸M.
+2¸R57¸T6<¸V;>¸X@D¸ZCE¸\F¸“]J“Iš_L!“LšcN$&=Ñ$&JŠISüˆO?MóêAº7É¼ušÐ©+§I¹o¸ºMÒ¦É
+¶iÕlLr¦	š´EÈ4)c¶H˜&bÆõÒôk×¢[š~Ð‚$«Õ+H¬N¥‚d*Ô¨x8y‚jR¥K2Mjô’$2  !ù  d ,     (  è€d‚ƒd( „ƒ‰ƒ+Œd‘d0‘”1‘”3‘”9‘”=‘”? ‘³"‘#”dB	‘%¾H*‘-¾M.
+Œ2¾R5Œ7¾T6Œ<¾V;Œ>¾X@ŒD¾ZCŒE¾\FŒI¾]J¾‘_L!‘L”cN$"=¡$&JŠHSüH)ß>Fý"Ñ³’;xë(¡SWŽ’8rß(qó–Í×µHÔ(Q‘ÖìYcÉ–1F©X°D½(	ÑÅ×¬ZŒdµzÅˆÕ©TŒL…ÅÔ¦N÷YÂÄHS$GM
+ !ù  d ,     (  ç€d‚ƒ‚( „ƒ‰ƒ+Œd‘d0‘”1‘”3‘”9‘”=‘”? ‘”B"‘#¹*	‘%”dH
+‘-ÄM.‘2ÄR5Œ7ÄT6Œ<ÄV;Œ>ÄX@ŒDÄZCŒEÄ\FŒIÄ]JŒLÄ_L!Ä‘cN$"=¡$&JŠHS(ýÈh`$}üîQ¢g/%wðÖQB§®%qä¾Qâæ-%kØ¦‹ÖìÙ1FÉ(-F	0F¾ríb„kV-F²Z½bÄêT*F¦BbjS'Fš(YÂÔ/‘#HŒ !ù  d ,     (  é€d‚ƒƒ( „ƒ‰ƒ+Œd‘d0‘”1‘”3‘”9‘”=‘”? ‘”B"‘#”H*	‘%¿.
+‘-”dM‘2ÊR5‘7ÊT6Œ<ÊV;Œ>ÊX@ŒDÊZCŒEÊ\FŒIÊ]JŒLÊ_L!ŒOÊcNH(‹$&JŠHS(Ø’>~÷(Ñ³’;xë(¡SWŽ’8rß(qó–’5lŒ¨EŠÖŒÑ3JÆ)k"Œ±_*z)ÓÅ+®YµÉjõŠ«S©™
+5Š¨Mi¢d	S¢I”Ab !ù  d ,     (  ç€dƒ„„( …Š‹d+ŒŒd0Œ“1Œ“3Œ“9Œ“=Œ“? Œ“B"Œ#“H*	Œ%“M.
+Œ-Ä5Œ2“dRŒ7ÏT6Œ<ÏV;‹>ÏX@‹DÏZC‹EÏ\F‹IÏ]J‹LÏ_L!‹OÏcN$My&&JŠgŒþä7)ß>{“æÕƒ7©Ý;u“Î¥#7)Ü8o“¶u[”‘5i‹¨1’²¬1cÈžöÉ®E½p‰°õlV-E±X¹Z´ÊªE¥@‰ZôI§E™&Uº¤HÒ$G !ù  d ,     (  å€dd„……( †„‹†+Ž“…0“”1“”3“”9“”=“”? “”B"“#”H*	“%”M.
+“-”R5“2Ë6“7”dT“<ÖV;“>ÖX@ŽDÖZCŽEÖ\FŽIÖ]JŽLÖ_L!ŽOÖcNH8šbML”ýþ´6I¿{”èÙ‹GÉ¼u”Ð©+GI9Gà&uËæhÛ$*Ò¨-kö¬Ø±d¿‚³¶«—5!¶áš"–5W°±:•Ê‘©P£ÚÔÉ‘&J–0-jD	’$C  !ù  d ,     (  â€dd‚…†( †‚‹†+ŽŽ…0•šd1•š3•š9•š=•š? •šB"•#šH*	•%šM.
+•-šR5•2šT6•7›;•<›V•>›X@•D›ZCŽE›\FŽI›]JŽL›_L!ŽO›cNH8š²IL”ýþ¼—oß¦JôìÅÓäÞ:MèÔ92WiÜ7Gá*YÉ¶M5kÌœA3†L0aÄtñòµÉ®M?b9šåj«M©V-:%Š”£Pš:}ZDIÓ¥L‹i‚$©P  !ù  d ,     (  Þ€d‚‚…†( †‚‹†+ŽŽ…0Ž•‚1œœ3•œ9•œ=•œ? •œB"•#œH*	•%œM.
+•-œR5•2œT6•7œV;•<¡@•>¡X•D¡ZC•E¡\FŽI¡]JŽL¡_L!ŽO¡cNH8šJL”ýþ¼—o_¼yõBUrÏ»JéÊ9:W	Ë·pØ´q“FÍ3gÐŒ!SL1]¼|Ñ²…+,Y¡z¬rÔ
+UÏE§D‘ÒÊ¨E”8]Ê´¨'H’ !ù  d ,     (  Þ€d‚dƒ†‚( ‡dŒƒ+Œ‚0Œ–d1Œ39–=–? –B"#–H*	%–M.
+-–R52–T67–V;<–X@>CDZE\FI]JŒL_L!ŒOcœ`4¥“˜()üˆO?Fó,Õ»wÈ%xìPÒbÝ·pã²më6­ÚµfÏ¢K¶,Ø°b»zýªu+×«X³:­jÕ)Ç)Q¤,<âdéS¨C•,aÒtÈ‘¥H“È !ù  d ,     (  ñ€d‚‚ƒ†‚( ‡dŒƒ+Œ‚0Œ–d1Œ3Œ9=–? –B"#–H*	%–M.
+-–R52–T67–V;<–X@>–ZCDFE\I]JL_L!ŒOcœ`4¥“˜()üÈ(Ÿ¥}ýÑ³dOÞ¡w–¸°c¤®Ü9WŒÀ‰cDî‘6nŒ¼=¢f¶GÎ 1’ö™2FÌ	#ÆÈØ#^¾{d#]¯bÍ²´ªªN¦²4#Ô¦NŸU²„IÓ!G–"M
+ !ù  d ,     (  ì€d‚ƒƒ†‚( ‡dŒƒ+Œ‚0Œ–d1Œ3Œ9Œ=? –B"#–H*	%–M.
+-–R52–T67–V;<–X@>–ZCD–\FEJI]!L_úŒOcœ`4¥“˜()üÈ¨ß#~øÕ³ÔE#xëÚ1RWî#rßÂÑb¤#o¨Yc„í‘3hŒ¤=B¦Œ³GÂˆ12öˆ—/FÀjÝÊe)Ö,W–VµBe©Ô)Q@=âd)†&J0=rd)R€@ ;
\ No newline at end of file
diff --git a/core/misc/progress.js b/core/misc/progress.js
index e3e000f..922fea5 100644
--- a/core/misc/progress.js
+++ b/core/misc/progress.js
@@ -21,23 +21,21 @@ Drupal.ProgressBar = function (id, updateCallback, method, errorCallback) {
   // The WAI-ARIA setting aria-live="polite" will announce changes after users
   // have completed their current activity and not interrupt the screen reader.
   this.element = $('<div class="progress" aria-live="polite"></div>').attr('id', id);
-  this.element.html('<div class="progress__label">&nbsp;</div>' +
-                    '<div class="progress__track"><div class="progress__bar"></div></div>' +
-                    '<div class="progress__percentage"></div>' +
-                    '<div class="progress__description">&nbsp;</div>');
+  this.element.html('<div class="bar"><div class="filled"></div></div>' +
+                    '<div class="percentage"></div>' +
+                    '<div class="message">&nbsp;</div>');
 };
 
 $.extend(Drupal.ProgressBar.prototype, {
   /**
    * Set the percentage and status message for the progressbar.
    */
-  setProgress: function (percentage, message, label) {
+  setProgress: function (percentage, message) {
     if (percentage >= 0 && percentage <= 100) {
-      $(this.element).find('div.progress__bar').css('width', percentage + '%');
-      $(this.element).find('div.progress__percentage').html(percentage + '%');
+      $(this.element).find('div.filled').css('width', percentage + '%');
+      $(this.element).find('div.percentage').html(percentage + '%');
     }
-    $('div.progress__description', this.element).html(message);
-    $('div.progress__label', this.element).html(label);
+    $('div.message', this.element).html(message);
     if (this.updateCallback) {
       this.updateCallback(percentage, message, this);
     }
@@ -84,7 +82,7 @@ $.extend(Drupal.ProgressBar.prototype, {
             return;
           }
           // Update display.
-          pb.setProgress(progress.percentage, progress.message, progress.label);
+          pb.setProgress(progress.percentage, progress.message);
           // Schedule next timer.
           pb.timer = setTimeout(function () { pb.sendPing(); }, pb.delay);
         },
diff --git a/core/modules/action/lib/Drupal/action/Plugin/Action/EmailAction.php b/core/modules/action/lib/Drupal/action/Plugin/Action/EmailAction.php
index 43908b0..921b91a 100644
--- a/core/modules/action/lib/Drupal/action/Plugin/Action/EmailAction.php
+++ b/core/modules/action/lib/Drupal/action/Plugin/Action/EmailAction.php
@@ -11,7 +11,6 @@
 use Drupal\Core\Annotation\Translation;
 use Drupal\Core\Action\ConfigurableActionBase;
 use Drupal\Core\Entity\EntityManager;
-use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
 use Drupal\Core\Utility\Token;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 
@@ -24,7 +23,7 @@
  *   type = "system"
  * )
  */
-class EmailAction extends ConfigurableActionBase implements ContainerFactoryPluginInterface {
+class EmailAction extends ConfigurableActionBase {
 
   /**
    * The token service.
@@ -87,7 +86,7 @@ public function execute($entity = NULL) {
     $recipient_accounts = $this->storageController->loadByProperties(array('mail' => $recipient));
     $recipient_account = reset($recipient_accounts);
     if ($recipient_account) {
-      $langcode = $recipient_account->getPreferredLangcode();
+      $langcode = user_preferred_langcode($recipient_account);
     }
     else {
       $langcode = language_default()->id;
diff --git a/core/modules/action/lib/Drupal/action/Plugin/Action/GotoAction.php b/core/modules/action/lib/Drupal/action/Plugin/Action/GotoAction.php
index 93a4c87..c20801a 100644
--- a/core/modules/action/lib/Drupal/action/Plugin/Action/GotoAction.php
+++ b/core/modules/action/lib/Drupal/action/Plugin/Action/GotoAction.php
@@ -10,7 +10,6 @@
 use Drupal\Core\Annotation\Action;
 use Drupal\Core\Annotation\Translation;
 use Drupal\Core\Action\ConfigurableActionBase;
-use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
 use Drupal\Core\Routing\PathBasedGeneratorInterface;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 use Symfony\Component\EventDispatcher\EventDispatcherInterface;
@@ -26,7 +25,7 @@
  *   type = "system"
  * )
  */
-class GotoAction extends ConfigurableActionBase implements ContainerFactoryPluginInterface {
+class GotoAction extends ConfigurableActionBase {
 
   /**
    * The event dispatcher service.
diff --git a/core/modules/action/lib/Drupal/action/Plugin/Action/MessageAction.php b/core/modules/action/lib/Drupal/action/Plugin/Action/MessageAction.php
index b7f25a2..3bc59b9 100644
--- a/core/modules/action/lib/Drupal/action/Plugin/Action/MessageAction.php
+++ b/core/modules/action/lib/Drupal/action/Plugin/Action/MessageAction.php
@@ -11,7 +11,6 @@
 use Drupal\Core\Annotation\Action;
 use Drupal\Core\Annotation\Translation;
 use Drupal\Core\Action\ConfigurableActionBase;
-use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
 use Drupal\Core\Utility\Token;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 
@@ -24,7 +23,7 @@
  *   type = "system"
  * )
  */
-class MessageAction extends ConfigurableActionBase implements ContainerFactoryPluginInterface {
+class MessageAction extends ConfigurableActionBase {
 
   /**
    * @var \Drupal\Core\Utility\Token
diff --git a/core/modules/action/tests/action_bulk_test/config/views.view.test_bulk_form.yml b/core/modules/action/tests/action_bulk_test/config/views.view.test_bulk_form.yml
index a16655c..4973c62 100644
--- a/core/modules/action/tests/action_bulk_test/config/views.view.test_bulk_form.yml
+++ b/core/modules/action/tests/action_bulk_test/config/views.view.test_bulk_form.yml
@@ -72,7 +72,6 @@ display:
           empty_zero: '0'
           link_to_node: '1'
           plugin_id: node
-          provider: node
         action_bulk_form:
           id: action_bulk_form
           table: action
@@ -122,7 +121,6 @@ display:
           empty_zero: '0'
           hide_alter_empty: '1'
           plugin_id: action_bulk_form
-          provider: action
       filters:
         status:
           value: '1'
@@ -133,7 +131,6 @@ display:
             operator: '0'
           group: '1'
           plugin_id: boolean
-          provider: views
       sorts:
         created:
           id: created
@@ -141,7 +138,6 @@ display:
           field: created
           order: DESC
           plugin_id: date
-          provider: views
       title: form
   page_1:
     display_plugin: page
diff --git a/core/modules/aggregator/aggregator.module b/core/modules/aggregator/aggregator.module
index 416571d..f7a908a 100644
--- a/core/modules/aggregator/aggregator.module
+++ b/core/modules/aggregator/aggregator.module
@@ -145,6 +145,13 @@ function aggregator_menu() {
     'title' => 'Categories',
     'route_name' => 'aggregator_categories',
   );
+  $items['aggregator/rss'] = array(
+    'title' => 'RSS feed',
+    'page callback' => 'aggregator_page_rss',
+    'access arguments' => array('access news feeds'),
+    'type' => MENU_CALLBACK,
+    'file' => 'aggregator.pages.inc',
+  );
   $items['aggregator/opml'] = array(
     'title' => 'OPML feed',
     'page callback' => 'aggregator_page_opml',
diff --git a/core/modules/aggregator/aggregator.pages.inc b/core/modules/aggregator/aggregator.pages.inc
index ca8ecad..c524505 100644
--- a/core/modules/aggregator/aggregator.pages.inc
+++ b/core/modules/aggregator/aggregator.pages.inc
@@ -319,6 +319,85 @@ function template_preprocess_aggregator_item(&$variables) {
 }
 
 /**
+ * Page callback: Generates an RSS 0.92 feed of aggregator items or categories.
+ *
+ * @return string
+ *   An HTML formatted string.
+ *
+ * @see aggregator_menu()
+ */
+function aggregator_page_rss() {
+  $result = NULL;
+  $rss_config = config('system.rss');
+  // arg(2) is the passed cid, only select for that category.
+  if (arg(2)) {
+    $category = db_query('SELECT cid, title FROM {aggregator_category} WHERE cid = :cid', array(':cid' => arg(2)))->fetchObject();
+    $result = db_query_range('SELECT i.*, f.title AS ftitle, f.link AS flink FROM {aggregator_category_item} c LEFT JOIN {aggregator_item} i ON c.iid = i.iid LEFT JOIN {aggregator_feed} f ON i.fid = f.fid WHERE cid = :cid ORDER BY timestamp DESC, i.iid DESC', 0, $rss_config->get('items.limit'), array(':cid' => $category->cid));
+  }
+  // Or, get the default aggregator items.
+  else {
+    $category = NULL;
+    $result = db_query_range('SELECT i.*, f.title AS ftitle, f.link AS flink FROM {aggregator_item} i INNER JOIN {aggregator_feed} f ON i.fid = f.fid ORDER BY i.timestamp DESC, i.iid DESC', 0, $rss_config->get('items.limit'));
+  }
+
+  $feeds = $result->fetchAll();
+  $aggregator_page_rss = array(
+    '#theme' => 'aggregator_page_rss',
+    '#feeds' => $feeds,
+    '#category' => $category,
+  );
+  return drupal_render($aggregator_page_rss);
+}
+
+/**
+ * Prints the RSS page for a feed.
+ *
+ * @param $variables
+ *   An associative array containing:
+ *   - feeds: An array of the feeds to theme.
+ *   - category: A common category, if any, for all the feeds.
+ *
+ * @return void
+ *
+ * @ingroup themeable
+ */
+function theme_aggregator_page_rss($variables) {
+  $feeds = $variables['feeds'];
+  $category = $variables['category'];
+
+  drupal_add_http_header('Content-Type', 'application/rss+xml; charset=utf-8');
+
+  $items = '';
+  $feed_length = config('system.rss')->get('items.view_mode');
+  foreach ($feeds as $feed) {
+    switch ($feed_length) {
+      case 'teaser':
+        $summary = text_summary($feed->description, NULL, config('aggregator.settings')->get('items.teaser_length'));
+        if ($summary != $feed->description) {
+          $summary .= '<p><a href="' . check_url($feed->link) . '">' . t('read more') . "</a></p>\n";
+        }
+        $feed->description = $summary;
+        break;
+      case 'title':
+        $feed->description = '';
+        break;
+    }
+    $items .= format_rss_item($feed->ftitle . ': ' . $feed->title, $feed->link, $feed->description, array('pubDate' => date('r', $feed->timestamp)));
+  }
+
+  $site_name = config('system.site')->get('name');
+  $url = url((isset($category) ? 'aggregator/categories/' . $category->cid : 'aggregator'), array('absolute' => TRUE));
+  $description = isset($category) ? t('@site_name - aggregated feeds in category @title', array('@site_name' => $site_name, '@title' => $category->title)) : t('@site_name - aggregated feeds', array('@site_name' => $site_name));
+
+  $output  = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
+  $output .= "<rss version=\"2.0\">\n";
+  $output .= format_rss_channel(t('@site_name aggregator', array('@site_name' => $site_name)), $url, $description, $items);
+  $output .= "</rss>\n";
+
+  print $output;
+}
+
+/**
  * Page callback: Generates an OPML representation of all feeds.
  *
  * @param $cid
diff --git a/core/modules/aggregator/config/views.view.aggregator_rss_feed.yml b/core/modules/aggregator/config/views.view.aggregator_rss_feed.yml
deleted file mode 100644
index deef238..0000000
--- a/core/modules/aggregator/config/views.view.aggregator_rss_feed.yml
+++ /dev/null
@@ -1,191 +0,0 @@
-base_field: iid
-base_table: aggregator_item
-core: 8.x
-description: ''
-status: '1'
-display:
-  default:
-    display_plugin: default
-    id: default
-    display_title: Master
-    position: '1'
-    display_options:
-      access:
-        type: none
-        options: {  }
-      cache:
-        type: none
-        options: {  }
-      query:
-        type: views_query
-        options:
-          disable_sql_rewrite: '0'
-          distinct: '0'
-          slave: '0'
-          query_comment: ''
-          query_tags: {  }
-      exposed_form:
-        type: basic
-        options:
-          submit_button: Apply
-          reset_button: '0'
-          reset_button_label: Reset
-          exposed_sorts_label: 'Sort by'
-          expose_sort_order: '1'
-          sort_asc_label: Asc
-          sort_desc_label: Desc
-      pager:
-        type: full
-        options:
-          items_per_page: '10'
-          offset: '0'
-          id: '0'
-          total_pages: ''
-          expose:
-            items_per_page: '0'
-            items_per_page_label: 'Items per page'
-            items_per_page_options: '5, 10, 20, 40, 60'
-            items_per_page_options_all: '0'
-            items_per_page_options_all_label: '- All -'
-            offset: '0'
-            offset_label: Offset
-          tags:
-            previous: 'â€¹ previous'
-            next: 'next â€º'
-            first: 'Â« first'
-            last: 'last Â»'
-          quantity: '9'
-      style:
-        type: default
-      row:
-        type: 'entity:aggregator_item'
-      fields:
-        iid:
-          table: aggregator_item
-          field: iid
-          id: iid
-          relationship: none
-          group_type: group
-          admin_label: ''
-          label: 'Item ID'
-          exclude: '0'
-          alter:
-            alter_text: '0'
-            text: ''
-            make_link: '0'
-            path: ''
-            absolute: '0'
-            external: '0'
-            replace_spaces: '0'
-            path_case: none
-            trim_whitespace: '0'
-            alt: ''
-            rel: ''
-            link_class: ''
-            prefix: ''
-            suffix: ''
-            target: ''
-            nl2br: '0'
-            max_length: ''
-            word_boundary: '1'
-            ellipsis: '1'
-            more_link: '0'
-            more_link_text: ''
-            more_link_path: ''
-            strip_tags: '0'
-            trim: '0'
-            preserve_tags: ''
-            html: '0'
-          element_type: ''
-          element_class: ''
-          element_label_type: ''
-          element_label_class: ''
-          element_label_colon: '1'
-          element_wrapper_type: ''
-          element_wrapper_class: ''
-          element_default_classes: '1'
-          empty: ''
-          hide_empty: '0'
-          empty_zero: '0'
-          hide_alter_empty: '1'
-          set_precision: '0'
-          precision: '0'
-          decimal: .
-          separator: ','
-          format_plural: '0'
-          format_plural_singular: '1'
-          format_plural_plural: '@count'
-          prefix: ''
-          suffix: ''
-      filters: {  }
-      sorts: {  }
-      title: 'Aggregator RSS feed'
-      header: {  }
-      footer: {  }
-      empty: {  }
-      relationships: {  }
-      arguments: {  }
-  feed_items_per_category:
-    display_plugin: feed
-    id: feed_items_per_category
-    display_title: 'Feed per category'
-    position: '2'
-    display_options:
-      path: aggregator/rss/%
-      display_description: ''
-      arguments:
-        cid:
-          id: cid
-          table: aggregator_category
-          field: cid
-          relationship: none
-          group_type: group
-          admin_label: ''
-          default_action: 'not found'
-          exception:
-            value: all
-            title_enable: '0'
-            title: All
-          title_enable: '0'
-          title: ''
-          breadcrumb_enable: '0'
-          breadcrumb: ''
-          default_argument_type: fixed
-          default_argument_options:
-            argument: ''
-          default_argument_skip_url: '0'
-          summary_options:
-            base_path: ''
-            count: '1'
-            items_per_page: '25'
-            override: '0'
-          summary:
-            sort_order: asc
-            number_of_records: '0'
-            format: default_summary
-          specify_validation: '0'
-          validate:
-            type: none
-            fail: 'not found'
-          validate_options: {  }
-          break_phrase: '0'
-          not: '0'
-          plugin_id: aggregator_category_cid
-      defaults:
-        arguments: '0'
-  feed_items:
-    display_plugin: feed
-    id: feed_items
-    display_title: Feed
-    position: '2'
-    display_options:
-      path: aggregator/rss
-      display_description: ''
-      defaults:
-        arguments: '1'
-label: 'Aggregator RSS feed'
-module: views
-id: aggregator_rss_feed
-tag: aggregator
-uuid: 7dfa5cb7-2248-4d52-8c00-cd8e02d1e78e
-langcode: en
diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Access/CategoriesAccessCheck.php b/core/modules/aggregator/lib/Drupal/aggregator/Access/CategoriesAccessCheck.php
index 2429572..576495e 100644
--- a/core/modules/aggregator/lib/Drupal/aggregator/Access/CategoriesAccessCheck.php
+++ b/core/modules/aggregator/lib/Drupal/aggregator/Access/CategoriesAccessCheck.php
@@ -7,7 +7,7 @@
 
 namespace Drupal\aggregator\Access;
 
-use Drupal\Core\Access\StaticAccessCheckInterface;
+use Drupal\Core\Access\AccessCheckInterface;
 use Drupal\Core\Database\Connection;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\Routing\Route;
@@ -15,7 +15,7 @@
 /**
  * Provides an access check for aggregator categories routes.
  */
-class CategoriesAccessCheck implements StaticAccessCheckInterface {
+class CategoriesAccessCheck implements AccessCheckInterface {
 
   /**
    * The database connection.
@@ -37,8 +37,8 @@ public function __construct(Connection $database) {
   /**
    * {@inheritdoc}
    */
-  public function appliesTo() {
-    return array('_access_aggregator_categories');
+  public function applies(Route $route) {
+    return array_key_exists('_access_aggregator_categories', $route->getRequirements());
   }
 
   /**
diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/aggregator/parser/DefaultParser.php b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/aggregator/parser/DefaultParser.php
index b21b9f5..a295749 100644
--- a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/aggregator/parser/DefaultParser.php
+++ b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/aggregator/parser/DefaultParser.php
@@ -32,8 +32,6 @@ class DefaultParser implements ParserInterface {
    * {@inheritdoc}
    */
   public function parse(Feed $feed) {
-    // Set our bridge extension manager to Zend Feed.
-    Reader::setExtensionManager(\Drupal::service('feed.bridge.reader'));
     try {
       $channel = Reader::importString($feed->source_string);
     }
diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/field/TitleLink.php b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/field/TitleLink.php
index 0a8d2ac..3eae377 100644
--- a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/field/TitleLink.php
+++ b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/field/TitleLink.php
@@ -57,7 +57,7 @@ public function buildOptionsForm(&$form, &$form_state) {
   /**
    * {@inheritdoc}
    */
-  public function render($values) {
+  function render($values) {
     $value = $this->getValue($values);
     return $this->render_link($this->sanitizeValue($value), $values);
   }
diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/row/Rss.php b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/row/Rss.php
index 7239213..7e55034 100644
--- a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/row/Rss.php
+++ b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/row/Rss.php
@@ -71,7 +71,7 @@ public function buildOptionsForm(&$form, &$form_state) {
   /**
    * {@inheritdoc}
    */
-  public function render($row) {
+  function render($row) {
     $entity = $row->_entity;
 
     $item = new \stdClass();
diff --git a/core/modules/ban/ban.module b/core/modules/ban/ban.module
index a703a75..ffddbfa 100644
--- a/core/modules/ban/ban.module
+++ b/core/modules/ban/ban.module
@@ -13,7 +13,7 @@ function ban_help($path, $arg) {
     case 'admin/help#ban':
       $output = '';
       $output .= '<h3>' . t('About') . '</h3>';
-      $output .= '<p>' . t('The Ban module allows administrators to ban visits to their site from individual IP addresses. For more information, see <a href="@url">the online documentation for the Ban module</a>.', array('@url' => 'https://drupal.org/documentation/modules/ban')) . '</p>';
+      $output .= '<p>' . t('The Ban module allows administrators to ban visits to their site from individual IP addresses.') . '</p>';
       $output .= '<h3>' . t('Uses') . '</h3>';
       $output .= '<dl>';
       $output .= '<dt>' . t('Banning IP addresses') . '</dt>';
diff --git a/core/modules/block/block.admin.inc b/core/modules/block/block.admin.inc
index 093769e..3fde289 100644
--- a/core/modules/block/block.admin.inc
+++ b/core/modules/block/block.admin.inc
@@ -21,3 +21,32 @@ function block_admin_demo($theme = NULL) {
   );
 }
 
+/**
+ * Page callback: Build the block instance edit form.
+ *
+ * @param \Drupal\block\Plugin\Core\Entity\Block $entity
+ *   The block instance.
+ *
+ * @return array
+ *   The block instance edit form.
+ */
+function block_admin_edit(Block $entity) {
+  // Get the theme for the page title.
+  $admin_theme = config('system.theme')->get('admin');
+  $themes = list_themes();
+  $theme_key = $entity->get('theme');
+  $theme = $themes[$theme_key];
+  // Use meaningful titles for the main site and administrative themes.
+  $theme_title = $theme->info['name'];
+  if ($theme_key == config('system.theme')->get('default')) {
+    $theme_title = t('!theme (default theme)', array('!theme' => $theme_title));
+  }
+  elseif ($admin_theme && $theme_key == $admin_theme) {
+    $theme_title = t('!theme (administration theme)', array('!theme' => $theme_title));
+  }
+
+  // Get the block label for the page title.
+  drupal_set_title(t("Configure %label block in %theme", array('%label' => $entity->label(), '%theme' => $theme_title)), PASS_THROUGH);
+
+  return Drupal::entityManager()->getForm($entity);
+}
diff --git a/core/modules/block/block.module b/core/modules/block/block.module
index cfbad28..321f584 100644
--- a/core/modules/block/block.module
+++ b/core/modules/block/block.module
@@ -43,6 +43,10 @@
  */
 const BLOCK_VISIBILITY_PHP = 2;
 
+/**
+ * Indicates the block label (title) should be displayed to end users.
+ */
+const BLOCK_LABEL_VISIBLE = 'visible';
 
 /**
  * Implements hook_help().
@@ -117,7 +121,10 @@ function block_menu() {
   );
   $items['admin/structure/block/manage/%block'] = array(
     'title' => 'Configure block',
-    'route_name' => 'block_admin_edit',
+    'page callback' => 'block_admin_edit',
+    'page arguments' => array(4),
+    'access arguments' => array('administer blocks'),
+    'file' => 'block.admin.inc',
   );
   $items['admin/structure/block/manage/%block/configure'] = array(
     'title' => 'Configure block',
@@ -289,7 +296,7 @@ function _block_get_renderable_region($list = array()) {
   // the regular 'roles define permissions' schema, it brings too many
   // chances of having unwanted output get in the cache and later be served
   // to other users. We therefore exclude user 1 from block caching.
-  $not_cacheable = $GLOBALS['user']->id() == 1 ||
+  $not_cacheable = $GLOBALS['user']->uid == 1 ||
     count(module_implements('node_grants')) ||
     !\Drupal::request()->isMethodSafe();
 
diff --git a/core/modules/block/block.routing.yml b/core/modules/block/block.routing.yml
index cabd4cb..f46ceaa 100644
--- a/core/modules/block/block.routing.yml
+++ b/core/modules/block/block.routing.yml
@@ -5,13 +5,6 @@ block_admin_block_delete:
   requirements:
     _permission: 'administer blocks'
 
-block_admin_edit:
-  pattern: '/admin/structure/block/manage/{block}'
-  defaults:
-    _entity_form: 'block.default'
-  requirements:
-    _entity_access: 'block.update'
-
 block_admin_display:
   pattern: '/admin/structure/block'
   defaults:
diff --git a/core/modules/block/config/schema/block.schema.yml b/core/modules/block/config/schema/block.schema.yml
index f672cdc..ca36c7e 100644
--- a/core/modules/block/config/schema/block.schema.yml
+++ b/core/modules/block/config/schema/block.schema.yml
@@ -10,6 +10,12 @@ block.block.*.*:
     uuid:
       type: string
       label: 'UUID'
+    label:
+      type: label
+      label: 'Title'
+    label_display:
+      type: string
+      label: 'Display title'
     region:
       type: string
       label: 'Region'
@@ -66,12 +72,9 @@ block.block.*.*:
       type: mapping
       label: 'Block settings'
       mapping:
-        label:
+        admin_label:
           type: label
           label: 'Description'
-        label_display:
-          type: string
-          label: 'Display title'
         cache:
           type: integer
           label: 'Cache'
diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockAccessController.php b/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockAccessController.php
index 9990a2e..8ac282a 100644
--- a/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockAccessController.php
+++ b/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockAccessController.php
@@ -23,16 +23,9 @@ protected function checkAccess(EntityInterface $entity, $operation, $langcode, A
     if ($operation === 'view') {
       return TRUE;
     }
-    elseif (in_array($operation, array('update', 'delete'))) {
+    elseif (in_array($operation, array('create', 'update', 'delete'))) {
       return user_access('administer blocks', $account);
     }
   }
 
-  /**
-   * {@inheritdoc}
-   */
-  protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) {
-    return user_access('administer blocks', $account);
-  }
-
 }
diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockTypeAccessController.php b/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockTypeAccessController.php
index 95b74ac..3aa95ce 100644
--- a/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockTypeAccessController.php
+++ b/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockTypeAccessController.php
@@ -23,16 +23,9 @@ protected function checkAccess(EntityInterface $entity, $operation, $langcode, A
     if ($operation === 'view') {
       return TRUE;
     }
-    elseif (in_array($operation, array('update', 'delete'))) {
+    elseif (in_array($operation, array('create', 'update', 'delete'))) {
       return user_access('administer blocks', $account);
     }
   }
 
-  /**
-   * {@inheritdoc}
-   */
-  protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) {
-    return user_access('administer blocks', $account);
-  }
-
 }
diff --git a/core/modules/block/lib/Drupal/block/Access/BlockThemeAccessCheck.php b/core/modules/block/lib/Drupal/block/Access/BlockThemeAccessCheck.php
index b5ca0b2..4612396 100644
--- a/core/modules/block/lib/Drupal/block/Access/BlockThemeAccessCheck.php
+++ b/core/modules/block/lib/Drupal/block/Access/BlockThemeAccessCheck.php
@@ -7,20 +7,20 @@
 
 namespace Drupal\block\Access;
 
-use Drupal\Core\Access\StaticAccessCheckInterface;
+use Drupal\Core\Access\AccessCheckInterface;
 use Symfony\Component\Routing\Route;
 use Symfony\Component\HttpFoundation\Request;
 
 /**
  * Checks access for displaying block page.
  */
-class BlockThemeAccessCheck implements StaticAccessCheckInterface {
+class BlockThemeAccessCheck implements AccessCheckInterface {
 
   /**
    * {@inheritdoc}
    */
-  public function appliesTo() {
-    return array('_block_themes_access');
+  public function applies(Route $route) {
+    return array_key_exists('_block_themes_access', $route->getRequirements());
   }
 
   /**
diff --git a/core/modules/block/lib/Drupal/block/BlockAccessController.php b/core/modules/block/lib/Drupal/block/BlockAccessController.php
index 372e56d..1584ae3 100644
--- a/core/modules/block/lib/Drupal/block/BlockAccessController.php
+++ b/core/modules/block/lib/Drupal/block/BlockAccessController.php
@@ -20,8 +20,9 @@ class BlockAccessController extends EntityAccessController {
    * {@inheritdoc}
    */
   protected function checkAccess(EntityInterface $entity, $operation, $langcode, AccountInterface $account) {
+    // Currently, only view access is implemented.
     if ($operation != 'view') {
-      return user_access('administer blocks', $account);
+      return FALSE;
     }
 
     // Deny access to disabled blocks.
diff --git a/core/modules/block/lib/Drupal/block/BlockBase.php b/core/modules/block/lib/Drupal/block/BlockBase.php
index b438dc1..6efda89 100644
--- a/core/modules/block/lib/Drupal/block/BlockBase.php
+++ b/core/modules/block/lib/Drupal/block/BlockBase.php
@@ -8,7 +8,6 @@
 namespace Drupal\block;
 
 use Drupal\Component\Plugin\PluginBase;
-use Drupal\block\BlockInterface;
 
 /**
  * Defines a base block implementation that most blocks plugins will extend.
@@ -28,7 +27,7 @@ public function __construct(array $configuration, $plugin_id, array $plugin_defi
     $this->configuration += $this->settings() + array(
       'label' => '',
       'module' => $plugin_definition['module'],
-      'label_display' => BlockInterface::BLOCK_LABEL_VISIBLE,
+      'label_display' => BLOCK_LABEL_VISIBLE,
       'cache' => DRUPAL_NO_CACHE,
     );
   }
@@ -128,8 +127,8 @@ public function form($form, &$form_state) {
     $form['label_display'] = array(
       '#type' => 'checkbox',
       '#title' => t('Display title'),
-      '#default_value' => $this->configuration['label_display'] == BlockInterface::BLOCK_LABEL_VISIBLE,
-      '#return_value' => BlockInterface::BLOCK_LABEL_VISIBLE,
+      '#default_value' => $this->configuration['label_display'] == BLOCK_LABEL_VISIBLE,
+      '#return_value' => BLOCK_LABEL_VISIBLE,
     );
 
     // Add plugin-specific settings for this block type.
diff --git a/core/modules/block/lib/Drupal/block/BlockInterface.php b/core/modules/block/lib/Drupal/block/BlockInterface.php
index d06f708..cf049a5 100644
--- a/core/modules/block/lib/Drupal/block/BlockInterface.php
+++ b/core/modules/block/lib/Drupal/block/BlockInterface.php
@@ -15,11 +15,6 @@
 interface BlockInterface extends ConfigEntityInterface {
 
   /**
-   * Indicates the block label (title) should be displayed to end users.
-   */
-  const BLOCK_LABEL_VISIBLE = 'visible';
-
-  /**
    * Returns the plugin instance.
    *
    * @return \Drupal\block\BlockPluginInterface
diff --git a/core/modules/block/lib/Drupal/block/BlockListController.php b/core/modules/block/lib/Drupal/block/BlockListController.php
index 66774a7..6a5a2ed 100644
--- a/core/modules/block/lib/Drupal/block/BlockListController.php
+++ b/core/modules/block/lib/Drupal/block/BlockListController.php
@@ -9,7 +9,6 @@
 
 use Drupal\Core\Config\Entity\ConfigEntityListController;
 use Drupal\block\Plugin\Core\Entity\Block;
-use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Form\FormInterface;
 
 /**
@@ -149,7 +148,6 @@ public function buildForm(array $form, array &$form_state) {
         'admin_label' => $definition['admin_label'],
         'entity_id' => $entity_id,
         'weight' => $entity->get('weight'),
-        'entity' => $entity,
       );
     }
 
@@ -242,7 +240,18 @@ public function buildForm(array $form, array &$form_state) {
               'class' => array('block-weight', 'block-weight-' . $region),
             ),
           );
-          $form['blocks'][$entity_id]['operations'] = $this->buildOperations($info['entity']);
+          $links['configure'] = array(
+            'title' => t('configure'),
+            'href' => 'admin/structure/block/manage/' . $entity_id . '/configure',
+          );
+          $links['delete'] = array(
+            'title' => t('delete'),
+            'href' => 'admin/structure/block/manage/' . $entity_id . '/delete',
+          );
+          $form['blocks'][$entity_id]['operations'] = array(
+            '#type' => 'operations',
+            '#links' => $links,
+          );
         }
       }
     }
@@ -265,26 +274,6 @@ public function buildForm(array $form, array &$form_state) {
   }
 
   /**
-   * {@inheritdoc}
-   */
-  public function getOperations(EntityInterface $entity) {
-    $uri = $entity->uri();
-    $operations = array();
-    $operations['configure'] = array(
-      'title' => t('configure'),
-      'href' => $uri['path'],
-      'options' => $uri['options'],
-    );
-    $operations['delete'] = array(
-      'title' => t('delete'),
-      'href' => $uri['path'] . '/delete',
-      'options' => $uri['options'],
-    );
-
-    return $operations;
-  }
-
-  /**
    * Implements \Drupal\Core\Form\FormInterface::validateForm().
    */
   public function validateForm(array &$form, array &$form_state) {
diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockHookOperationTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockHookOperationTest.php
deleted file mode 100644
index 3621f26..0000000
--- a/core/modules/block/lib/Drupal/block/Tests/BlockHookOperationTest.php
+++ /dev/null
@@ -1,62 +0,0 @@
-<?php
-
-/**
- * @file
- * Tests for Block module regarding hook_entity_operations_alter().
- */
-
-namespace Drupal\block\Tests;
-
-use Drupal\Component\Utility\Unicode;
-use Drupal\simpletest\WebTestBase;
-
-/**
- * Functional tests for the hook_entity_operations_alter().
- */
-class BlockHookOperationTest extends WebTestBase {
-
-  /**
-   * Modules to enable.
-   *
-   * @var array
-   */
-  public static $modules = array('block', 'entity_test');
-
-  public static function getInfo() {
-    return array(
-      'name' => 'Block operations hook',
-      'description' => 'Implement hook entity operations alter.',
-      'group' => 'Block',
-    );
-  }
-
-  public function setUp() {
-    parent::setUp();
-
-    $permissions = array(
-      'administer blocks',
-    );
-
-    // Create and log in user.
-    $admin_user = $this->drupalCreateUser($permissions);
-    $this->drupalLogin($admin_user);
-  }
-
-  /*
-   * Tests the block list to see if the test_operation link is added.
-   */
-  public function testBlockOperationAlter() {
-    // Add a test block, any block will do.
-    // Set the machine name so the test_operation link can be built later.
-    $block_machine_name = Unicode::strtolower($this->randomName(16));
-    $this->drupalPlaceBlock('system_powered_by_block', array('machine_name' => $block_machine_name));
-
-    // Get the Block listing.
-    $this->drupalGet('admin/structure/block');
-
-    $test_operation_link = 'admin/structure/block/manage/stark.' . $block_machine_name . '/test_operation';
-    // Test if the test_operation link is on the page.
-    $this->assertLinkByHref($test_operation_link);
-  }
-
-}
diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockInterfaceTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockInterfaceTest.php
index 327cf45..cd070df 100644
--- a/core/modules/block/lib/Drupal/block/Tests/BlockInterfaceTest.php
+++ b/core/modules/block/lib/Drupal/block/Tests/BlockInterfaceTest.php
@@ -8,7 +8,6 @@
 namespace Drupal\block\Tests;
 
 use Drupal\simpletest\DrupalUnitTestBase;
-use Drupal\block\BlockInterface;
 
 /**
  * Test BlockInterface methods to ensure no external dependencies exist.
@@ -47,7 +46,7 @@ public function testBlockInterface() {
       'label' => 'Custom Display Message',
       'display_message' => 'no message set',
       'module' => 'block_test',
-      'label_display' => BlockInterface::BLOCK_LABEL_VISIBLE,
+      'label_display' => BLOCK_LABEL_VISIBLE,
       'cache' => DRUPAL_NO_CACHE,
     );
     // Initial configuration of the block at construction time.
diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockStorageUnitTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockStorageUnitTest.php
index 41b5f4d..b14ae0e 100644
--- a/core/modules/block/lib/Drupal/block/Tests/BlockStorageUnitTest.php
+++ b/core/modules/block/lib/Drupal/block/Tests/BlockStorageUnitTest.php
@@ -14,7 +14,6 @@
 use Drupal\block\BlockStorageController;
 use Drupal\Core\Entity\EntityMalformedException;
 use Drupal\block\Plugin\Core\Entity\Block;
-use Drupal\block\BlockInterface;
 
 /**
  * Tests the storage of blocks.
@@ -104,7 +103,7 @@ protected function createTests() {
         'cache' => '1',
         'label' => '',
         'module' => 'block_test',
-        'label_display' => BlockInterface::BLOCK_LABEL_VISIBLE,
+        'label_display' => BLOCK_LABEL_VISIBLE,
       ),
       'visibility' => '',
     );
diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockTest.php
index 7f7855d..75bcb39 100644
--- a/core/modules/block/lib/Drupal/block/Tests/BlockTest.php
+++ b/core/modules/block/lib/Drupal/block/Tests/BlockTest.php
@@ -49,7 +49,7 @@ function testBlockVisibility() {
     $this->drupalGet('user');
     $this->assertNoText($title, 'Block was not displayed according to block visibility rules.');
 
-    $this->drupalGet('USER/' . $this->adminUser->id());
+    $this->drupalGet('USER/' . $this->adminUser->uid);
     $this->assertNoText($title, 'Block was not displayed according to block visibility rules regardless of path case.');
 
     // Confirm that the block is not displayed to anonymous users.
@@ -161,7 +161,7 @@ function testHideBlockTitle() {
     $edit = array(
       'settings[label_display]' => FALSE,
     );
-    $this->drupalPost('admin/structure/block/manage/' . $default_theme . '.' . $machine_name, $edit, t('Save block'));
+    $this->drupalPost('admin/structure/block/manage/' . $default_theme . '.' . $machine_name . '/configure', $edit, t('Save block'));
     $this->assertText('The block configuration has been saved.', 'Block was saved');
 
     $this->drupalGet('user');
diff --git a/core/modules/block/tests/block_test.info.yml b/core/modules/block/tests/block_test.info.yml
new file mode 100644
index 0000000..d6e4137
--- /dev/null
+++ b/core/modules/block/tests/block_test.info.yml
@@ -0,0 +1,7 @@
+name: 'Block test'
+type: module
+description: 'Provides test blocks.'
+package: Testing
+version: VERSION
+core: 8.x
+hidden: true
diff --git a/core/modules/block/tests/block_test.module b/core/modules/block/tests/block_test.module
new file mode 100644
index 0000000..6abb95f
--- /dev/null
+++ b/core/modules/block/tests/block_test.module
@@ -0,0 +1,14 @@
+<?php
+
+/**
+ * @file
+ *   Provide test blocks.
+ */
+
+/**
+ * Implements hook_system_theme_info().
+ */
+function block_test_system_theme_info() {
+  $themes['block_test_theme'] = drupal_get_path('module', 'block_test') . '/themes/block_test_theme/block_test_theme.info.yml';
+  return $themes;
+}
diff --git a/core/modules/block/tests/block_test_views/block_test_views.info.yml b/core/modules/block/tests/block_test_views/block_test_views.info.yml
new file mode 100644
index 0000000..aad655e
--- /dev/null
+++ b/core/modules/block/tests/block_test_views/block_test_views.info.yml
@@ -0,0 +1,10 @@
+name: 'Block test views'
+type: module
+description: 'Provides a view and block to test block displays in views.'
+package: Core
+version: VERSION
+hidden: TRUE
+core: 8.x
+dependencies:
+  - block
+  - views
diff --git a/core/modules/block/tests/block_test_views/block_test_views.module b/core/modules/block/tests/block_test_views/block_test_views.module
new file mode 100644
index 0000000..b3d9bbc
--- /dev/null
+++ b/core/modules/block/tests/block_test_views/block_test_views.module
@@ -0,0 +1 @@
+<?php
diff --git a/core/modules/block/tests/block_test_views/test_views/views.view.test_view_block.yml b/core/modules/block/tests/block_test_views/test_views/views.view.test_view_block.yml
new file mode 100644
index 0000000..2897bfa
--- /dev/null
+++ b/core/modules/block/tests/block_test_views/test_views/views.view.test_view_block.yml
@@ -0,0 +1,47 @@
+base_field: id
+base_table: views_test_data
+core: 8.x
+description: ''
+status: '1'
+display:
+  default:
+    display_plugin: default
+    id: default
+    display_title: Master
+    position: ''
+    display_options:
+      access:
+        type: perm
+      cache:
+        type: none
+      query:
+        type: views_query
+      exposed_form:
+        type: basic
+      pager:
+        type: some
+        options:
+          items_per_page: '5'
+      style:
+        type: default
+      row:
+        type: fields
+      fields:
+        name:
+          id: name
+          table: views_test_data
+          field: name
+      title: test_view_block
+  block_1:
+    display_plugin: block
+    id: block_1
+    display_title: Block
+    position: ''
+    display_options:
+      field:
+        title:
+          link_to_node: '1'
+label: test_view_block
+module: views
+id: test_view_block
+tag: ''
diff --git a/core/modules/block/tests/block_test_views/test_views/views.view.test_view_block2.yml b/core/modules/block/tests/block_test_views/test_views/views.view.test_view_block2.yml
new file mode 100644
index 0000000..eb257e1
--- /dev/null
+++ b/core/modules/block/tests/block_test_views/test_views/views.view.test_view_block2.yml
@@ -0,0 +1,56 @@
+base_field: id
+base_table: views_test_data
+core: 8.x
+description: ''
+status: '1'
+display:
+  default:
+    display_plugin: default
+    id: default
+    display_title: Master
+    position: ''
+    display_options:
+      access:
+        type: perm
+      cache:
+        type: none
+      query:
+        type: views_query
+      exposed_form:
+        type: basic
+      pager:
+        type: some
+        options:
+          items_per_page: '5'
+      style:
+        type: default
+      row:
+        type: fields
+      fields:
+        name:
+          id: name
+          table: views_test_data
+          field: name
+      title: test_view_block2
+  block_1:
+    display_plugin: block
+    id: block_1
+    display_title: Block
+    position: ''
+    display_options:
+      field:
+        title:
+          link_to_node: '1'
+  block_2:
+    display_plugin: block
+    id: block_2
+    display_title: Block
+    position: ''
+    display_options:
+      field:
+        title:
+          link_to_node: '1'
+label: test_view_block2
+module: views
+id: test_view_block2
+tag: ''
diff --git a/core/modules/block/tests/config/block.block.stark.test_block.yml b/core/modules/block/tests/config/block.block.stark.test_block.yml
new file mode 100644
index 0000000..e8b5ade
--- /dev/null
+++ b/core/modules/block/tests/config/block.block.stark.test_block.yml
@@ -0,0 +1,20 @@
+id: stark.test_block
+weight: ''
+status: '1'
+langcode: en
+region: '-1'
+plugin: test_html_id
+settings:
+  label: 'Test block html id"'
+  module: block_test
+  label_display: '0'
+  cache: '1'
+visibility:
+  path:
+    visibility: '0'
+    pages: ''
+  role:
+    roles: {  }
+  node_type:
+    types: {  }
+  visibility__active_tab: edit-visibility-path
diff --git a/core/modules/block/tests/lib/Drupal/block_test/Plugin/Block/TestBlockInstantiation.php b/core/modules/block/tests/lib/Drupal/block_test/Plugin/Block/TestBlockInstantiation.php
new file mode 100644
index 0000000..4c28638
--- /dev/null
+++ b/core/modules/block/tests/lib/Drupal/block_test/Plugin/Block/TestBlockInstantiation.php
@@ -0,0 +1,69 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\block_test\Plugin\Block\TestBlockInstantiation.
+ */
+
+namespace Drupal\block_test\Plugin\Block;
+
+use Drupal\block\BlockBase;
+use Drupal\Component\Annotation\Plugin;
+use Drupal\Core\Annotation\Translation;
+
+/**
+ * Provides a basic block for testing block instantiation and configuration.
+ *
+ * @Plugin(
+ *   id = "test_block_instantiation",
+ *   admin_label = @Translation("Display message"),
+ *   module = "block_test"
+ * )
+ */
+class TestBlockInstantiation extends BlockBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function settings() {
+    return array(
+      'display_message' => 'no message set',
+    );
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function access() {
+    return user_access('access content');
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function blockForm($form, &$form_state) {
+    $form['display_message'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Display message'),
+      '#default_value' => $this->configuration['display_message'],
+    );
+    return $form;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function blockSubmit($form, &$form_state) {
+    $this->configuration['display_message'] = $form_state['values']['display_message'];
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function build() {
+    return array(
+      '#children' => $this->configuration['display_message'],
+    );
+  }
+
+}
diff --git a/core/modules/block/tests/lib/Drupal/block_test/Plugin/Block/TestCacheBlock.php b/core/modules/block/tests/lib/Drupal/block_test/Plugin/Block/TestCacheBlock.php
new file mode 100644
index 0000000..c83d668
--- /dev/null
+++ b/core/modules/block/tests/lib/Drupal/block_test/Plugin/Block/TestCacheBlock.php
@@ -0,0 +1,45 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\block_test\Plugin\Block\TestCacheBlock.
+ */
+
+namespace Drupal\block_test\Plugin\Block;
+
+use Drupal\block\BlockBase;
+use Drupal\Component\Annotation\Plugin;
+use Drupal\Core\Annotation\Translation;
+
+/**
+ * Provides a block to test caching.
+ *
+ * @Plugin(
+ *   id = "test_cache",
+ *   admin_label = @Translation("Test block caching"),
+ *   module = "block_test"
+ * )
+ */
+class TestCacheBlock extends BlockBase {
+
+  /**
+   * Overrides \Drupal\block\BlockBase::settings().
+   *
+   * Sets a different caching strategy for testing purposes.
+   */
+  public function settings() {
+    return array(
+      'cache' => DRUPAL_CACHE_PER_ROLE,
+    );
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function build() {
+    return array(
+      '#children' => \Drupal::state()->get('block_test.content'),
+    );
+  }
+
+}
diff --git a/core/modules/block/tests/lib/Drupal/block_test/Plugin/Block/TestHtmlIdBlock.php b/core/modules/block/tests/lib/Drupal/block_test/Plugin/Block/TestHtmlIdBlock.php
new file mode 100644
index 0000000..82d1310
--- /dev/null
+++ b/core/modules/block/tests/lib/Drupal/block_test/Plugin/Block/TestHtmlIdBlock.php
@@ -0,0 +1,24 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\block_test\Plugin\Block\TestHtmlIdBlock.
+ */
+
+namespace Drupal\block_test\Plugin\Block;
+
+use Drupal\block\BlockBase;
+use Drupal\Component\Annotation\Plugin;
+use Drupal\Core\Annotation\Translation;
+
+/**
+ * Provides a block to test HTML IDs.
+ *
+ * @Plugin(
+ *   id = "test_html_id",
+ *   admin_label = @Translation("Test block html id"),
+ *   module = "block_test"
+ * )
+ */
+class TestHtmlIdBlock extends TestCacheBlock {
+}
diff --git a/core/modules/block/tests/lib/Drupal/block_test/Plugin/Block/TestXSSTitleBlock.php b/core/modules/block/tests/lib/Drupal/block_test/Plugin/Block/TestXSSTitleBlock.php
new file mode 100644
index 0000000..ea134df
--- /dev/null
+++ b/core/modules/block/tests/lib/Drupal/block_test/Plugin/Block/TestXSSTitleBlock.php
@@ -0,0 +1,34 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\block_test\Plugin\Block\TestXSSTitleBlock.
+ */
+
+namespace Drupal\block_test\Plugin\Block;
+
+use Drupal\Component\Annotation\Plugin;
+
+/**
+ * Provides a block to test XSS in title.
+ *
+ * @Plugin(
+ *   id = "test_xss_title",
+ *   admin_label = "<script>alert('XSS subject');</script>",
+ *   module = "block_test"
+ * )
+ */
+class TestXSSTitleBlock extends TestCacheBlock {
+
+  /**
+   * Overrides \Drupal\block\BlockBase::settings().
+   *
+   * Sets a different caching strategy for testing purposes.
+   */
+  public function settings() {
+    return array(
+      'cache' => DRUPAL_NO_CACHE,
+    );
+  }
+
+}
diff --git a/core/modules/block/tests/modules/block_test/block_test.info.yml b/core/modules/block/tests/modules/block_test/block_test.info.yml
deleted file mode 100644
index d6e4137..0000000
--- a/core/modules/block/tests/modules/block_test/block_test.info.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-name: 'Block test'
-type: module
-description: 'Provides test blocks.'
-package: Testing
-version: VERSION
-core: 8.x
-hidden: true
diff --git a/core/modules/block/tests/modules/block_test/block_test.module b/core/modules/block/tests/modules/block_test/block_test.module
deleted file mode 100644
index 6abb95f..0000000
--- a/core/modules/block/tests/modules/block_test/block_test.module
+++ /dev/null
@@ -1,14 +0,0 @@
-<?php
-
-/**
- * @file
- *   Provide test blocks.
- */
-
-/**
- * Implements hook_system_theme_info().
- */
-function block_test_system_theme_info() {
-  $themes['block_test_theme'] = drupal_get_path('module', 'block_test') . '/themes/block_test_theme/block_test_theme.info.yml';
-  return $themes;
-}
diff --git a/core/modules/block/tests/modules/block_test/config/block.block.stark.test_block.yml b/core/modules/block/tests/modules/block_test/config/block.block.stark.test_block.yml
deleted file mode 100644
index e8b5ade..0000000
--- a/core/modules/block/tests/modules/block_test/config/block.block.stark.test_block.yml
+++ /dev/null
@@ -1,20 +0,0 @@
-id: stark.test_block
-weight: ''
-status: '1'
-langcode: en
-region: '-1'
-plugin: test_html_id
-settings:
-  label: 'Test block html id"'
-  module: block_test
-  label_display: '0'
-  cache: '1'
-visibility:
-  path:
-    visibility: '0'
-    pages: ''
-  role:
-    roles: {  }
-  node_type:
-    types: {  }
-  visibility__active_tab: edit-visibility-path
diff --git a/core/modules/block/tests/modules/block_test/lib/Drupal/block_test/Plugin/Block/TestBlockInstantiation.php b/core/modules/block/tests/modules/block_test/lib/Drupal/block_test/Plugin/Block/TestBlockInstantiation.php
deleted file mode 100644
index 4c28638..0000000
--- a/core/modules/block/tests/modules/block_test/lib/Drupal/block_test/Plugin/Block/TestBlockInstantiation.php
+++ /dev/null
@@ -1,69 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\block_test\Plugin\Block\TestBlockInstantiation.
- */
-
-namespace Drupal\block_test\Plugin\Block;
-
-use Drupal\block\BlockBase;
-use Drupal\Component\Annotation\Plugin;
-use Drupal\Core\Annotation\Translation;
-
-/**
- * Provides a basic block for testing block instantiation and configuration.
- *
- * @Plugin(
- *   id = "test_block_instantiation",
- *   admin_label = @Translation("Display message"),
- *   module = "block_test"
- * )
- */
-class TestBlockInstantiation extends BlockBase {
-
-  /**
-   * {@inheritdoc}
-   */
-  public function settings() {
-    return array(
-      'display_message' => 'no message set',
-    );
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function access() {
-    return user_access('access content');
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function blockForm($form, &$form_state) {
-    $form['display_message'] = array(
-      '#type' => 'textfield',
-      '#title' => t('Display message'),
-      '#default_value' => $this->configuration['display_message'],
-    );
-    return $form;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function blockSubmit($form, &$form_state) {
-    $this->configuration['display_message'] = $form_state['values']['display_message'];
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function build() {
-    return array(
-      '#children' => $this->configuration['display_message'],
-    );
-  }
-
-}
diff --git a/core/modules/block/tests/modules/block_test/lib/Drupal/block_test/Plugin/Block/TestCacheBlock.php b/core/modules/block/tests/modules/block_test/lib/Drupal/block_test/Plugin/Block/TestCacheBlock.php
deleted file mode 100644
index c83d668..0000000
--- a/core/modules/block/tests/modules/block_test/lib/Drupal/block_test/Plugin/Block/TestCacheBlock.php
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\block_test\Plugin\Block\TestCacheBlock.
- */
-
-namespace Drupal\block_test\Plugin\Block;
-
-use Drupal\block\BlockBase;
-use Drupal\Component\Annotation\Plugin;
-use Drupal\Core\Annotation\Translation;
-
-/**
- * Provides a block to test caching.
- *
- * @Plugin(
- *   id = "test_cache",
- *   admin_label = @Translation("Test block caching"),
- *   module = "block_test"
- * )
- */
-class TestCacheBlock extends BlockBase {
-
-  /**
-   * Overrides \Drupal\block\BlockBase::settings().
-   *
-   * Sets a different caching strategy for testing purposes.
-   */
-  public function settings() {
-    return array(
-      'cache' => DRUPAL_CACHE_PER_ROLE,
-    );
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function build() {
-    return array(
-      '#children' => \Drupal::state()->get('block_test.content'),
-    );
-  }
-
-}
diff --git a/core/modules/block/tests/modules/block_test/lib/Drupal/block_test/Plugin/Block/TestHtmlIdBlock.php b/core/modules/block/tests/modules/block_test/lib/Drupal/block_test/Plugin/Block/TestHtmlIdBlock.php
deleted file mode 100644
index 82d1310..0000000
--- a/core/modules/block/tests/modules/block_test/lib/Drupal/block_test/Plugin/Block/TestHtmlIdBlock.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\block_test\Plugin\Block\TestHtmlIdBlock.
- */
-
-namespace Drupal\block_test\Plugin\Block;
-
-use Drupal\block\BlockBase;
-use Drupal\Component\Annotation\Plugin;
-use Drupal\Core\Annotation\Translation;
-
-/**
- * Provides a block to test HTML IDs.
- *
- * @Plugin(
- *   id = "test_html_id",
- *   admin_label = @Translation("Test block html id"),
- *   module = "block_test"
- * )
- */
-class TestHtmlIdBlock extends TestCacheBlock {
-}
diff --git a/core/modules/block/tests/modules/block_test/lib/Drupal/block_test/Plugin/Block/TestXSSTitleBlock.php b/core/modules/block/tests/modules/block_test/lib/Drupal/block_test/Plugin/Block/TestXSSTitleBlock.php
deleted file mode 100644
index ea134df..0000000
--- a/core/modules/block/tests/modules/block_test/lib/Drupal/block_test/Plugin/Block/TestXSSTitleBlock.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\block_test\Plugin\Block\TestXSSTitleBlock.
- */
-
-namespace Drupal\block_test\Plugin\Block;
-
-use Drupal\Component\Annotation\Plugin;
-
-/**
- * Provides a block to test XSS in title.
- *
- * @Plugin(
- *   id = "test_xss_title",
- *   admin_label = "<script>alert('XSS subject');</script>",
- *   module = "block_test"
- * )
- */
-class TestXSSTitleBlock extends TestCacheBlock {
-
-  /**
-   * Overrides \Drupal\block\BlockBase::settings().
-   *
-   * Sets a different caching strategy for testing purposes.
-   */
-  public function settings() {
-    return array(
-      'cache' => DRUPAL_NO_CACHE,
-    );
-  }
-
-}
diff --git a/core/modules/block/tests/modules/block_test/themes/block_test_theme/block_test_theme.info.yml b/core/modules/block/tests/modules/block_test/themes/block_test_theme/block_test_theme.info.yml
deleted file mode 100644
index 7b9f6e1..0000000
--- a/core/modules/block/tests/modules/block_test/themes/block_test_theme/block_test_theme.info.yml
+++ /dev/null
@@ -1,16 +0,0 @@
-name: 'Block test theme'
-type: theme
-description: 'Theme for testing the block system'
-core: 8.x
-hidden: true
-regions:
-  sidebar_first: 'Left sidebar'
-  sidebar_second: 'Right sidebar'
-  content: Content
-  header: Header
-  footer: Footer
-  highlighted: Highlighted
-  help: Help
-regions_hidden:
-  - sidebar_first
-  - sidebar_second
diff --git a/core/modules/block/tests/modules/block_test_views/block_test_views.info.yml b/core/modules/block/tests/modules/block_test_views/block_test_views.info.yml
deleted file mode 100644
index aad655e..0000000
--- a/core/modules/block/tests/modules/block_test_views/block_test_views.info.yml
+++ /dev/null
@@ -1,10 +0,0 @@
-name: 'Block test views'
-type: module
-description: 'Provides a view and block to test block displays in views.'
-package: Core
-version: VERSION
-hidden: TRUE
-core: 8.x
-dependencies:
-  - block
-  - views
diff --git a/core/modules/block/tests/modules/block_test_views/block_test_views.module b/core/modules/block/tests/modules/block_test_views/block_test_views.module
deleted file mode 100644
index b3d9bbc..0000000
--- a/core/modules/block/tests/modules/block_test_views/block_test_views.module
+++ /dev/null
@@ -1 +0,0 @@
-<?php
diff --git a/core/modules/block/tests/modules/block_test_views/test_views/views.view.test_view_block.yml b/core/modules/block/tests/modules/block_test_views/test_views/views.view.test_view_block.yml
deleted file mode 100644
index f4723b1..0000000
--- a/core/modules/block/tests/modules/block_test_views/test_views/views.view.test_view_block.yml
+++ /dev/null
@@ -1,48 +0,0 @@
-base_field: id
-base_table: views_test_data
-core: 8.x
-description: ''
-status: '1'
-display:
-  default:
-    display_plugin: default
-    id: default
-    display_title: Master
-    position: ''
-    display_options:
-      access:
-        type: perm
-      cache:
-        type: none
-      query:
-        type: views_query
-      exposed_form:
-        type: basic
-      pager:
-        type: some
-        options:
-          items_per_page: '5'
-      style:
-        type: default
-      row:
-        type: fields
-      fields:
-        name:
-          id: name
-          table: views_test_data
-          field: name
-          provider: views_test_data
-      title: test_view_block
-  block_1:
-    display_plugin: block
-    id: block_1
-    display_title: Block
-    position: ''
-    display_options:
-      field:
-        title:
-          link_to_node: '1'
-label: test_view_block
-module: views
-id: test_view_block
-tag: ''
diff --git a/core/modules/block/tests/modules/block_test_views/test_views/views.view.test_view_block2.yml b/core/modules/block/tests/modules/block_test_views/test_views/views.view.test_view_block2.yml
deleted file mode 100644
index e693732..0000000
--- a/core/modules/block/tests/modules/block_test_views/test_views/views.view.test_view_block2.yml
+++ /dev/null
@@ -1,57 +0,0 @@
-base_field: id
-base_table: views_test_data
-core: 8.x
-description: ''
-status: '1'
-display:
-  default:
-    display_plugin: default
-    id: default
-    display_title: Master
-    position: ''
-    display_options:
-      access:
-        type: perm
-      cache:
-        type: none
-      query:
-        type: views_query
-      exposed_form:
-        type: basic
-      pager:
-        type: some
-        options:
-          items_per_page: '5'
-      style:
-        type: default
-      row:
-        type: fields
-      fields:
-        name:
-          id: name
-          table: views_test_data
-          field: name
-          provider: views_test_data
-      title: test_view_block2
-  block_1:
-    display_plugin: block
-    id: block_1
-    display_title: Block
-    position: ''
-    display_options:
-      field:
-        title:
-          link_to_node: '1'
-  block_2:
-    display_plugin: block
-    id: block_2
-    display_title: Block
-    position: ''
-    display_options:
-      field:
-        title:
-          link_to_node: '1'
-label: test_view_block2
-module: views
-id: test_view_block2
-tag: ''
diff --git a/core/modules/block/tests/themes/block_test_theme/block_test_theme.info.yml b/core/modules/block/tests/themes/block_test_theme/block_test_theme.info.yml
new file mode 100644
index 0000000..7b9f6e1
--- /dev/null
+++ b/core/modules/block/tests/themes/block_test_theme/block_test_theme.info.yml
@@ -0,0 +1,16 @@
+name: 'Block test theme'
+type: theme
+description: 'Theme for testing the block system'
+core: 8.x
+hidden: true
+regions:
+  sidebar_first: 'Left sidebar'
+  sidebar_second: 'Right sidebar'
+  content: Content
+  header: Header
+  footer: Footer
+  highlighted: Highlighted
+  help: Help
+regions_hidden:
+  - sidebar_first
+  - sidebar_second
diff --git a/core/modules/color/color.module b/core/modules/color/color.module
index dc8be4a..549376a 100644
--- a/core/modules/color/color.module
+++ b/core/modules/color/color.module
@@ -4,8 +4,6 @@
  * Allows users to change the color scheme of themes.
  */
 
-use Drupal\Core\Asset\CssOptimizer;
-
 /**
  * Implements hook_help().
  */
@@ -89,13 +87,13 @@ function color_css_alter(&$css) {
  *
  * Replace the logo with the colored version if available.
  */
-function color_preprocess_page(&$variables) {
+function color_preprocess_page(&$vars) {
   global $theme_key;
 
   // Override logo.
   $logo = config('color.' . $theme_key)->get('logo');
-  if ($logo && $variables['logo'] && preg_match('!' . $theme_key . '/logo.png$!', $variables['logo'])) {
-    $variables['logo'] = file_create_url($logo);
+  if ($logo && $vars['logo'] && preg_match('!' . $theme_key . '/logo.png$!', $vars['logo'])) {
+    $vars['logo'] = file_create_url($logo);
   }
 }
 
@@ -236,17 +234,17 @@ function color_scheme_form($complete_form, &$form_state, $theme) {
  *   - form: A render element representing the form.
  */
 function template_preprocess_color_scheme_form(&$variables) {
-  $form = &$variables['form'];
+  $form = $variables['form'];
 
   $theme = $form['theme']['#value'];
   $info = $form['info']['#value'];
   $path = drupal_get_path('theme', $theme) . '/';
+  drupal_add_css($path . $info['preview_css']);
 
-  $preview_css_path = $path . $info['preview_css'];
+  // @todo Transform to add library.
   $preview_js_path = isset($info['preview_js']) ? $path . $info['preview_js'] : drupal_get_path('module', 'color') . '/' . 'preview.js';
-  $form['scheme']['#attached']['css'][$preview_css_path] = array();
   // Add the JS at a weight below color.js.
-  $form['scheme']['#attached']['js'][$preview_js_path] = array('weight' => -1);
+  drupal_add_js($preview_js_path, array('weight' => -1));
 
   // Attempt to load preview HTML if the theme provides it.
   $preview_html_path = DRUPAL_ROOT . '/' . (isset($info['preview_html']) ? drupal_get_path('theme', $theme) . '/' . $info['preview_html'] : drupal_get_path('module', 'color') . '/preview.html');
@@ -380,18 +378,18 @@ function color_scheme_form_submit($form, &$form_state) {
     }
 
     foreach ($files as $file) {
-      $css_optimizer = new CssOptimizer();
       // Aggregate @imports recursively for each configured top level CSS file
       // without optimization. Aggregation and optimization will be
       // handled by drupal_build_css_cache() only.
-      $style = $css_optimizer->loadFile($paths['source'] . $file, FALSE);
+      $style = drupal_load_stylesheet($paths['source'] . $file, FALSE);
 
       // Return the path to where this CSS file originated from, stripping
       // off the name of the file at the end of the path.
-      $css_optimizer->rewriteFileURIBasePath = base_path() . dirname($paths['source'] . $file) . '/';
+      $base = base_path() . dirname($paths['source'] . $file) . '/';
+      _drupal_build_css_path(NULL, $base);
 
       // Prefix all paths within this CSS file, ignoring absolute paths.
-      $style = preg_replace_callback('/url\([\'"]?(?![a-z]+:|\/+)([^\'")]+)[\'"]?\)/i', array($css_optimizer, 'rewriteFileURI'), $style);
+      $style = preg_replace_callback('/url\([\'"]?(?![a-z]+:|\/+)([^\'")]+)[\'"]?\)/i', '_drupal_build_css_path', $style);
 
       // Rewrite stylesheet with new colors.
       $style = _color_rewrite_stylesheet($theme, $info, $paths, $palette, $style);
diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module
index f436966..604cb93 100644
--- a/core/modules/comment/comment.module
+++ b/core/modules/comment/comment.module
@@ -1252,7 +1252,7 @@ function comment_node_search_result(EntityInterface $node) {
 function comment_user_cancel($edit, $account, $method) {
   switch ($method) {
     case 'user_cancel_block_unpublish':
-      $comments = entity_load_multiple_by_properties('comment', array('uid' => $account->id()));
+      $comments = entity_load_multiple_by_properties('comment', array('uid' => $account->uid));
       foreach ($comments as $comment) {
         $comment->status->value = 0;
         $comment->save();
@@ -1260,7 +1260,7 @@ function comment_user_cancel($edit, $account, $method) {
       break;
 
     case 'user_cancel_reassign':
-      $comments = entity_load_multiple_by_properties('comment', array('uid' => $account->id()));
+      $comments = entity_load_multiple_by_properties('comment', array('uid' => $account->uid));
       foreach ($comments as $comment) {
         $comment->uid->target_id = 0;
         $comment->save();
@@ -1273,7 +1273,7 @@ function comment_user_cancel($edit, $account, $method) {
  * Implements hook_user_predelete().
  */
 function comment_user_predelete($account) {
-  $cids = db_query('SELECT c.cid FROM {comment} c WHERE uid = :uid', array(':uid' => $account->id()))->fetchCol();
+  $cids = db_query('SELECT c.cid FROM {comment} c WHERE uid = :uid', array(':uid' => $account->uid))->fetchCol();
   entity_delete_multiple('comment', $cids);
 }
 
@@ -1325,7 +1325,7 @@ function comment_load($cid, $reset = FALSE) {
 function comment_num_new($nid, $timestamp = 0) {
   global $user;
 
-  if ($user->isAuthenticated() && module_exists('history')) {
+  if ($user->uid && module_exists('history')) {
     // Retrieve the timestamp at which the current user last viewed this node.
     if (!$timestamp) {
       $timestamp = history_read($nid);
@@ -1423,12 +1423,12 @@ function comment_preview(Comment $comment) {
     if (!empty($comment->name->value)) {
       $account = user_load_by_name($comment->name->value);
     }
-    elseif ($user->isAuthenticated() && empty($comment->is_anonymous)) {
+    elseif ($user->uid && empty($comment->is_anonymous)) {
       $account = $user;
     }
 
-    if ($account->id()) {
-      $comment->uid->target_id = $account->id();
+    if (!empty($account->uid)) {
+      $comment->uid->target_id = $account->uid;
       $comment->name->value = check_plain($account->name);
     }
     elseif (empty($comment->name->value)) {
@@ -1482,7 +1482,7 @@ function comment_preprocess_block(&$variables) {
 function comment_prepare_author(Comment $comment) {
   // The account has been pre-loaded by CommentRenderController::buildContent().
   $account = $comment->uid->entity;
-  if (empty($account->uid->value)) {
+  if (!$account) {
     $account = entity_create('user', array('uid' => 0, 'name' => $comment->name->value, 'homepage' => $comment->homepage->value));
   }
   return $account->getBCEntity();
@@ -1613,7 +1613,7 @@ function template_preprocess_comment(&$variables) {
     if ($comment->uid->target_id == $variables['node']->uid) {
       $variables['attributes']['class'][] = 'by-node-author';
     }
-    if ($comment->uid->target_id == $variables['user']->id()) {
+    if ($comment->uid->target_id == $variables['user']->uid) {
       $variables['attributes']['class'][] = 'by-viewer';
     }
   }
@@ -1640,7 +1640,7 @@ function theme_comment_post_forbidden($variables) {
   // comments only has to query the database once for all the links.
   $authenticated_post_comments = &drupal_static(__FUNCTION__, NULL);
 
-  if ($user->isAnonymous()) {
+  if (!$user->uid) {
     if (!isset($authenticated_post_comments)) {
       // We only output a link if we are certain that users will get permission
       // to post comments by logging in.
diff --git a/core/modules/comment/lib/Drupal/comment/CommentAccessController.php b/core/modules/comment/lib/Drupal/comment/CommentAccessController.php
index 98e03e1..4749428 100644
--- a/core/modules/comment/lib/Drupal/comment/CommentAccessController.php
+++ b/core/modules/comment/lib/Drupal/comment/CommentAccessController.php
@@ -27,8 +27,12 @@ protected function checkAccess(EntityInterface $entity, $operation, $langcode, A
         return user_access('access comments', $account);
         break;
 
+      case 'create':
+        return user_access('post comments', $account);
+        break;
+
       case 'update':
-        return ($account->id() && $account->id() == $entity->uid->value && $entity->status->value == COMMENT_PUBLISHED && user_access('edit own comments', $account)) || user_access('administer comments', $account);
+        return ($account->uid && $account->uid == $entity->uid->value && $entity->status->value == COMMENT_PUBLISHED && user_access('edit own comments', $account)) || user_access('administer comments', $account);
         break;
 
       case 'delete':
@@ -41,11 +45,4 @@ protected function checkAccess(EntityInterface $entity, $operation, $langcode, A
     }
   }
 
-  /**
-   * {@inheritdoc}
-   */
-  protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) {
-    return user_access('post comments', $account);
-  }
-
 }
diff --git a/core/modules/comment/lib/Drupal/comment/CommentFormController.php b/core/modules/comment/lib/Drupal/comment/CommentFormController.php
index 2264290..0584ae3 100644
--- a/core/modules/comment/lib/Drupal/comment/CommentFormController.php
+++ b/core/modules/comment/lib/Drupal/comment/CommentFormController.php
@@ -31,7 +31,7 @@ public function form(array $form, array &$form_state) {
     $anonymous_contact = variable_get('comment_anonymous_' . $node->type, COMMENT_ANONYMOUS_MAYNOT_CONTACT);
     $is_admin = $comment->id() && user_access('administer comments');
 
-    if (!$user->isAuthenticated() && $anonymous_contact != COMMENT_ANONYMOUS_MAYNOT_CONTACT) {
+    if (!$user->uid && $anonymous_contact != COMMENT_ANONYMOUS_MAYNOT_CONTACT) {
       $form['#attached']['library'][] = array('system', 'jquery.cookie');
       $form['#attributes']['class'][] = 'user-info-from-cookie';
     }
@@ -65,7 +65,7 @@ public function form(array $form, array &$form_state) {
       $date = (!empty($comment->date) ? $comment->date : new DrupalDateTime($comment->created->value));
     }
     else {
-      if ($user->isAuthenticated()) {
+      if ($user->uid) {
         $author = $user->name;
       }
       else {
@@ -80,7 +80,7 @@ public function form(array $form, array &$form_state) {
       '#type' => 'textfield',
       '#title' => t('Your name'),
       '#default_value' => $author,
-      '#required' => ($user->isAnonymous() && $anonymous_contact == COMMENT_ANONYMOUS_MUST_CONTACT),
+      '#required' => (!$user->uid && $anonymous_contact == COMMENT_ANONYMOUS_MUST_CONTACT),
       '#maxlength' => 60,
       '#size' => 30,
     );
@@ -89,7 +89,7 @@ public function form(array $form, array &$form_state) {
       $form['author']['name']['#description'] = t('Leave blank for %anonymous.', array('%anonymous' => config('user.settings')->get('anonymous')));
       $form['author']['name']['#autocomplete_path'] = 'user/autocomplete';
     }
-    elseif ($user->isAuthenticated()) {
+    elseif ($user->uid) {
       $form['author']['name']['#type'] = 'item';
       $form['author']['name']['#value'] = $form['author']['name']['#default_value'];
       $username = array(
@@ -104,11 +104,11 @@ public function form(array $form, array &$form_state) {
       '#type' => 'email',
       '#title' => t('E-mail'),
       '#default_value' => $comment->mail->value,
-      '#required' => ($user->isAnonymous() && $anonymous_contact == COMMENT_ANONYMOUS_MUST_CONTACT),
+      '#required' => (!$user->uid && $anonymous_contact == COMMENT_ANONYMOUS_MUST_CONTACT),
       '#maxlength' => 64,
       '#size' => 30,
       '#description' => t('The content of this field is kept private and will not be shown publicly.'),
-      '#access' => $is_admin || ($user->isAnonymous() && $anonymous_contact != COMMENT_ANONYMOUS_MAYNOT_CONTACT),
+      '#access' => $is_admin || (!$user->uid && $anonymous_contact != COMMENT_ANONYMOUS_MAYNOT_CONTACT),
     );
 
     $form['author']['homepage'] = array(
@@ -117,7 +117,7 @@ public function form(array $form, array &$form_state) {
       '#default_value' => $comment->homepage->value,
       '#maxlength' => 255,
       '#size' => 30,
-      '#access' => $is_admin || ($user->isAnonymous() && $anonymous_contact != COMMENT_ANONYMOUS_MAYNOT_CONTACT),
+      '#access' => $is_admin || (!$user->uid && $anonymous_contact != COMMENT_ANONYMOUS_MAYNOT_CONTACT),
     );
 
     // Add administrative comment publishing options.
@@ -151,7 +151,7 @@ public function form(array $form, array &$form_state) {
     // Used for conditional validation of author fields.
     $form['is_anonymous'] = array(
       '#type' => 'value',
-      '#value' => ($comment->id() ? !$comment->uid->target_id : $user->isAnonymous()),
+      '#value' => ($comment->id() ? !$comment->uid->target_id : !$user->uid),
     );
 
     // Make the comment inherit the current content language unless specifically
@@ -215,7 +215,7 @@ public function validate(array $form, array &$form_state) {
     if (!empty($form_state['values']['cid'])) {
       // Verify the name in case it is being changed from being anonymous.
       $account = user_load_by_name($form_state['values']['name']);
-      $form_state['values']['uid'] = $account ? $account->id() : 0;
+      $form_state['values']['uid'] = $account ? $account->uid : 0;
 
       $date = $form_state['values']['date'];
       if ($date instanceOf DrupalDateTime && $date->hasErrors()) {
@@ -269,7 +269,7 @@ public function submit(array $form, array &$form_state) {
     // @todo Too fragile. Should be prepared and stored in comment_form()
     // already.
     if (!$comment->is_anonymous && !empty($comment->name->value) && ($account = user_load_by_name($comment->name->value))) {
-      $comment->uid->target_id = $account->id();
+      $comment->uid->target_id = $account->uid;
     }
     // If the comment was posted by an anonymous user and no author name was
     // required, use "Anonymous" by default.
diff --git a/core/modules/comment/lib/Drupal/comment/CommentNewItem.php b/core/modules/comment/lib/Drupal/comment/CommentNewItem.php
deleted file mode 100644
index b9dc313..0000000
--- a/core/modules/comment/lib/Drupal/comment/CommentNewItem.php
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\comment\CommentNewItem.
- */
-
-namespace Drupal\comment;
-
-use Drupal\Core\Entity\Plugin\DataType\IntegerItem;
-
-/**
- * The field item for the 'new' field.
- */
-class CommentNewItem extends IntegerItem {
-
-  /**
-   * Definitions of the contained properties.
-   *
-   * @see self::getPropertyDefinitions()
-   *
-   * @var array
-   */
-  static $propertyDefinitions;
-
-  /**
-   * Implements \Drupal\Core\TypedData\ComplexDataInterface::getPropertyDefinitions().
-   */
-  public function getPropertyDefinitions() {
-
-    if (!isset(static::$propertyDefinitions)) {
-      static::$propertyDefinitions['value'] = array(
-        'type' => 'integer',
-        'label' => t('Integer value'),
-        'class' => '\Drupal\comment\CommentNewValue',
-        'computed' => TRUE,
-      );
-    }
-    return static::$propertyDefinitions;
-  }
-}
diff --git a/core/modules/comment/lib/Drupal/comment/CommentNewValue.php b/core/modules/comment/lib/Drupal/comment/CommentNewValue.php
deleted file mode 100644
index 1295776..0000000
--- a/core/modules/comment/lib/Drupal/comment/CommentNewValue.php
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\comment\CommentNewValue.
- */
-
-namespace Drupal\comment;
-
-use Drupal\Core\TypedData\TypedData;
-use Drupal\Core\TypedData\ReadOnlyException;
-use InvalidArgumentException;
-
-/**
- * A computed property for the integer value of the 'new' field.
- *
- * @todo: Declare the list of allowed values once supported.
- */
-class CommentNewValue extends TypedData {
-
-  /**
-   * Implements \Drupal\Core\TypedData\TypedDataInterface::getValue().
-   */
-  public function getValue() {
-    if (!isset($this->value)) {
-      if (!isset($this->parent)) {
-        throw new InvalidArgumentException('Computed properties require context for computation.');
-      }
-      $field = $this->parent->getParent();
-      $entity = $field->getParent();
-      $this->value = node_mark($entity->nid->target_id, $entity->changed->value);
-    }
-    return $this->value;
-  }
-
-  /**
-   * Implements \Drupal\Core\TypedData\TypedDataInterface::setValue().
-   */
-  public function setValue($value, $notify = TRUE) {
-    if (isset($value)) {
-      throw new ReadOnlyException('Unable to set a computed property.');
-    }
-  }
-}
diff --git a/core/modules/comment/lib/Drupal/comment/CommentStorageController.php b/core/modules/comment/lib/Drupal/comment/CommentStorageController.php
index 8cd1a53..4e6ca4c 100644
--- a/core/modules/comment/lib/Drupal/comment/CommentStorageController.php
+++ b/core/modules/comment/lib/Drupal/comment/CommentStorageController.php
@@ -200,7 +200,7 @@ public function baseFieldDefinitions() {
       'description' => t("The comment 'new' marker for the current user (0 read, 1 new, 2 updated)."),
       'type' => 'integer_field',
       'computed' => TRUE,
-      'class' => '\Drupal\comment\CommentNewItem',
+      'class' => '\Drupal\comment\FieldNewItem',
     );
     return $properties;
   }
diff --git a/core/modules/comment/lib/Drupal/comment/FieldNewItem.php b/core/modules/comment/lib/Drupal/comment/FieldNewItem.php
new file mode 100644
index 0000000..3e23ae7
--- /dev/null
+++ b/core/modules/comment/lib/Drupal/comment/FieldNewItem.php
@@ -0,0 +1,41 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\comment\FieldNewItem.
+ */
+
+namespace Drupal\comment;
+
+use Drupal\Core\Entity\Plugin\DataType\IntegerItem;
+
+/**
+ * The field item for the 'new' field.
+ */
+class FieldNewItem extends IntegerItem {
+
+  /**
+   * Definitions of the contained properties.
+   *
+   * @see self::getPropertyDefinitions()
+   *
+   * @var array
+   */
+  static $propertyDefinitions;
+
+  /**
+   * Implements \Drupal\Core\TypedData\ComplexDataInterface::getPropertyDefinitions().
+   */
+  public function getPropertyDefinitions() {
+
+    if (!isset(static::$propertyDefinitions)) {
+      static::$propertyDefinitions['value'] = array(
+        'type' => 'integer',
+        'label' => t('Integer value'),
+        'class' => '\Drupal\comment\FieldNewValue',
+        'computed' => TRUE,
+      );
+    }
+    return static::$propertyDefinitions;
+  }
+}
diff --git a/core/modules/comment/lib/Drupal/comment/FieldNewValue.php b/core/modules/comment/lib/Drupal/comment/FieldNewValue.php
new file mode 100644
index 0000000..8f9c392
--- /dev/null
+++ b/core/modules/comment/lib/Drupal/comment/FieldNewValue.php
@@ -0,0 +1,44 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\comment\FieldNewValue.
+ */
+
+namespace Drupal\comment;
+
+use Drupal\Core\TypedData\TypedData;
+use Drupal\Core\TypedData\ReadOnlyException;
+use InvalidArgumentException;
+
+/**
+ * A computed property for the integer value of the 'new' field.
+ *
+ * @todo: Declare the list of allowed values once supported.
+ */
+class FieldNewValue extends TypedData {
+
+  /**
+   * Implements \Drupal\Core\TypedData\TypedDataInterface::getValue().
+   */
+  public function getValue() {
+    if (!isset($this->value)) {
+      if (!isset($this->parent)) {
+        throw new InvalidArgumentException('Computed properties require context for computation.');
+      }
+      $field = $this->parent->getParent();
+      $entity = $field->getParent();
+      $this->value = node_mark($entity->nid->target_id, $entity->changed->value);
+    }
+    return $this->value;
+  }
+
+  /**
+   * Implements \Drupal\Core\TypedData\TypedDataInterface::setValue().
+   */
+  public function setValue($value, $notify = TRUE) {
+    if (isset($value)) {
+      throw new ReadOnlyException('Unable to set a computed property.');
+    }
+  }
+}
diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/Core/Entity/Comment.php b/core/modules/comment/lib/Drupal/comment/Plugin/Core/Entity/Comment.php
index 27dbf17..700b629 100644
--- a/core/modules/comment/lib/Drupal/comment/Plugin/Core/Entity/Comment.php
+++ b/core/modules/comment/lib/Drupal/comment/Plugin/Core/Entity/Comment.php
@@ -301,7 +301,7 @@ public function preSave(EntityStorageControllerInterface $storage_controller) {
       }
       // We test the value with '===' because we need to modify anonymous
       // users as well.
-      if ($this->uid->target_id === $user->id() && $user->isAuthenticated()) {
+      if ($this->uid->target_id === $user->uid && $user->uid) {
         $this->name->value = $user->name;
       }
       // Add the values which aren't passed into the function.
diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/entity_reference/selection/CommentSelection.php b/core/modules/comment/lib/Drupal/comment/Plugin/entity_reference/selection/CommentSelection.php
index 2c3aada..ae544e0 100644
--- a/core/modules/comment/lib/Drupal/comment/Plugin/entity_reference/selection/CommentSelection.php
+++ b/core/modules/comment/lib/Drupal/comment/Plugin/entity_reference/selection/CommentSelection.php
@@ -7,16 +7,17 @@
 
 namespace Drupal\comment\Plugin\entity_reference\selection;
 
+use Drupal\Component\Annotation\Plugin;
 use Drupal\Core\Annotation\Translation;
 use Drupal\Core\Database\Query\SelectInterface;
-use Drupal\entity_reference\Annotation\EntityReferenceSelection;
 use Drupal\entity_reference\Plugin\entity_reference\selection\SelectionBase;
 
 /**
  * Provides specific access control for the comment entity type.
  *
- * @EntityReferenceSelection(
+ * @Plugin(
  *   id = "comment_default",
+ *   module = "comment",
  *   label = @Translation("Comment selection"),
  *   entity_types = {"comment"},
  *   group = "default",
@@ -26,7 +27,7 @@
 class CommentSelection extends SelectionBase {
 
   /**
-   * {@inheritdoc}
+   * Overrides SelectionBase::buildEntityQuery().
    */
   public function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS') {
     $query = parent::buildEntityQuery($match, $match_operator);
@@ -41,7 +42,7 @@ public function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS') {
   }
 
   /**
-   * {@inheritdoc}
+   * Overrides SelectionBase::entityQueryAlter().
    */
   public function entityQueryAlter(SelectInterface $query) {
     $tables = $query->getTables();
diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/Comment.php b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/Comment.php
index 4f2275e..e9143ae 100644
--- a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/Comment.php
+++ b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/Comment.php
@@ -79,7 +79,7 @@ function render_link($data, $values) {
     return $data;
   }
 
-  public function render($values) {
+  function render($values) {
     $value = $this->getValue($values);
     return $this->render_link($this->sanitizeValue($value), $values);
   }
diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/Depth.php b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/Depth.php
index 2076ff8..08b9d8d 100644
--- a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/Depth.php
+++ b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/Depth.php
@@ -22,7 +22,7 @@ class Depth extends FieldPluginBase {
   /**
    * Work out the depth of this comment
    */
-  public function render($values) {
+  function render($values) {
     $comment_thread = $this->getValue($values);
     return count(explode('.', $comment_thread)) - 1;
   }
diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LastTimestamp.php b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LastTimestamp.php
index ee2772b..5b2c61d 100644
--- a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LastTimestamp.php
+++ b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LastTimestamp.php
@@ -30,7 +30,7 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o
     $this->additional_fields['comment_count'] = 'comment_count';
   }
 
-  public function render($values) {
+  function render($values) {
     $comment_count = $this->getValue($values, 'comment_count');
     if (empty($this->options['empty_zero']) || $comment_count) {
       return parent::render($values);
diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/Link.php b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/Link.php
index 202a224..d1e19f5 100644
--- a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/Link.php
+++ b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/Link.php
@@ -42,7 +42,7 @@ public function buildOptionsForm(&$form, &$form_state) {
 
   public function query() {}
 
-  public function render($values) {
+  function render($values) {
     $comment = $this->getEntity($values);
     return $this->render_link($comment, $values);
   }
diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkEdit.php b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkEdit.php
index 7f1a507..d77b824 100644
--- a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkEdit.php
+++ b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkEdit.php
@@ -33,6 +33,7 @@ public function buildOptionsForm(&$form, &$form_state) {
       '#title' => t('Use destination'),
       '#description' => t('Add destination to the link'),
       '#default_value' => $this->options['destination'],
+      '#fieldset' => 'more',
     );
   }
 
diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NcsLastCommentName.php b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NcsLastCommentName.php
index 6be3577..4417cfb 100644
--- a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NcsLastCommentName.php
+++ b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NcsLastCommentName.php
@@ -56,7 +56,7 @@ protected function defineOptions() {
     return $options;
   }
 
-  public function render($values) {
+  function render($values) {
     if (!empty($this->options['link_to_user'])) {
       $account = entity_create('user', array());
       $account->name = $this->getValue($values);
diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NodeComment.php b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NodeComment.php
index 6642db7..55c366b 100644
--- a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NodeComment.php
+++ b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NodeComment.php
@@ -19,7 +19,7 @@
  */
 class NodeComment extends FieldPluginBase {
 
-  public function render($values) {
+  function render($values) {
     $value = $this->getValue($values);
     switch ($value) {
       case COMMENT_NODE_HIDDEN:
diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NodeLink.php b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NodeLink.php
index 08ec430..cdb3786 100644
--- a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NodeLink.php
+++ b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NodeLink.php
@@ -38,7 +38,7 @@ public function buildOptionsForm(&$form, &$form_state) {
 
   public function query() {}
 
-  public function render($values) {
+  function render($values) {
     $node = $this->getEntity($values);
     comment_node_view($node, $this->options['teaser'] ? 'teaser' : 'full');
 
diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NodeNewComments.php b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NodeNewComments.php
index 8f0e0ec..c19b84c 100644
--- a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NodeNewComments.php
+++ b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NodeNewComments.php
@@ -93,7 +93,7 @@ public function query() {
 
   public function preRender(&$values) {
     global $user;
-    if ($user->isAnonymous() || empty($values)) {
+    if (!$user->uid || empty($values)) {
       return;
     }
 
@@ -114,7 +114,7 @@ public function preRender(&$values) {
         LEFT JOIN {history} h ON h.nid = n.nid AND h.uid = :h_uid WHERE n.nid IN (:nids)
         AND c.changed > GREATEST(COALESCE(h.timestamp, :timestamp), :timestamp) AND c.status = :status GROUP BY n.nid', array(
           ':status' => COMMENT_PUBLISHED,
-          ':h_uid' => $user->id(),
+          ':h_uid' => $user->uid,
           ':nids' => $nids,
           ':timestamp' => HISTORY_READ_LIMIT,
         ));
@@ -142,7 +142,7 @@ function render_link($data, $values) {
     return $data;
   }
 
-  public function render($values) {
+  function render($values) {
     $value = $this->getValue($values);
     if (!empty($value)) {
       return $this->render_link(parent::render($values), $values);
diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/Username.php b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/Username.php
index 43c3171..1b61c05 100644
--- a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/Username.php
+++ b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/Username.php
@@ -65,7 +65,7 @@ function render_link($data, $values) {
     }
   }
 
-  public function render($values) {
+  function render($values) {
     $value = $this->getValue($values);
     return $this->render_link($this->sanitizeValue($value), $values);
   }
diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/views/row/CommentRow.php b/core/modules/comment/lib/Drupal/comment/Plugin/views/row/CommentRow.php
index 6da8161..4ccc754 100644
--- a/core/modules/comment/lib/Drupal/comment/Plugin/views/row/CommentRow.php
+++ b/core/modules/comment/lib/Drupal/comment/Plugin/views/row/CommentRow.php
@@ -40,7 +40,7 @@ public function buildOptionsForm(&$form, &$form_state) {
   /**
    * {@inheritdoc}
    */
-  public function render($row) {
+  function render($row) {
     $entity_id = $row->{$this->field_alias};
     $build = $this->build[$entity_id];
     if (!$this->options['links']) {
diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/views/row/Rss.php b/core/modules/comment/lib/Drupal/comment/Plugin/views/row/Rss.php
index eeaec0b..3f19fa1 100644
--- a/core/modules/comment/lib/Drupal/comment/Plugin/views/row/Rss.php
+++ b/core/modules/comment/lib/Drupal/comment/Plugin/views/row/Rss.php
@@ -87,7 +87,7 @@ function options_form_summary_options() {
     return $options;
   }
 
-  public function render($row) {
+  function render($row) {
     global $base_url;
 
     $cid = $row->{$this->field_alias};
diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/views/wizard/Comment.php b/core/modules/comment/lib/Drupal/comment/Plugin/views/wizard/Comment.php
index 6194d29..f48b917 100644
--- a/core/modules/comment/lib/Drupal/comment/Plugin/views/wizard/Comment.php
+++ b/core/modules/comment/lib/Drupal/comment/Plugin/views/wizard/Comment.php
@@ -54,14 +54,12 @@ class Comment extends WizardPluginBase {
     'status' => array(
       'value' => TRUE,
       'table' => 'comment',
-      'field' => 'status',
-      'provider' => 'user'
+      'field' => 'status'
     ),
     'status_node' => array(
       'value' => TRUE,
       'table' => 'node_field_data',
       'field' => 'status',
-      'provider' => 'user',
       'relationship' => 'nid'
     )
   );
@@ -157,7 +155,6 @@ protected function defaultDisplayOptions() {
     $display_options['fields']['subject']['id'] = 'subject';
     $display_options['fields']['subject']['table'] = 'comment';
     $display_options['fields']['subject']['field'] = 'subject';
-    $display_options['fields']['subject']['provider'] = 'comment';
     $display_options['fields']['subject']['label'] = '';
     $display_options['fields']['subject']['alter']['alter_text'] = 0;
     $display_options['fields']['subject']['alter']['make_link'] = 0;
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentCSSTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentCSSTest.php
index 2b506ce..8b07aec 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentCSSTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentCSSTest.php
@@ -38,8 +38,8 @@ function setUp() {
   function testCommentClasses() {
     // Create all permutations for comments, users, and nodes.
     $parameters = array(
-      'node_uid' => array(0, $this->web_user->id()),
-      'comment_uid' => array(0, $this->web_user->id(), $this->admin_user->id()),
+      'node_uid' => array(0, $this->web_user->uid),
+      'comment_uid' => array(0, $this->web_user->uid, $this->admin_user->uid),
       'comment_status' => array(COMMENT_PUBLISHED, COMMENT_NOT_PUBLISHED),
       'user' => array('anonymous', 'authenticated', 'admin'),
     );
@@ -72,12 +72,12 @@ function testCommentClasses() {
 
         case 'authenticated':
           $this->drupalLogin($this->web_user);
-          $case['user_uid'] = $this->web_user->id();
+          $case['user_uid'] = $this->web_user->uid;
           break;
 
         case 'admin':
           $this->drupalLogin($this->admin_user);
-          $case['user_uid'] = $this->admin_user->id();
+          $case['user_uid'] = $this->admin_user->uid;
           break;
       }
       // Request the node with the comment.
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentInterfaceTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentInterfaceTest.php
index ed1a528..8d7a472 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentInterfaceTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentInterfaceTest.php
@@ -81,7 +81,7 @@ function testCommentInterface() {
     // Test changing the comment author to a verified user.
     $this->drupalGet('comment/' . $comment->id() . '/edit');
     $comment = $this->postComment(NULL, $comment->comment_body->value, $comment->subject->value, array('name' => $this->web_user->name));
-    $this->assertTrue($comment->name->value == $this->web_user->name && $comment->uid->target_id == $this->web_user->id(), 'Comment author successfully changed to a registered user.');
+    $this->assertTrue($comment->name->value == $this->web_user->name && $comment->uid->target_id == $this->web_user->uid, 'Comment author successfully changed to a registered user.');
 
     $this->drupalLogout();
 
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentLanguageTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentLanguageTest.php
index 1e443ac..47efe82 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentLanguageTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentLanguageTest.php
@@ -68,7 +68,7 @@ function setUp() {
     // Change user language preference, this way interface language is always
     // French no matter what path prefix the URLs have.
     $edit = array('preferred_langcode' => 'fr');
-    $this->drupalPost("user/" . $admin_user->id() . "/edit", $edit, t('Save'));
+    $this->drupalPost("user/{$admin_user->uid}/edit", $edit, t('Save'));
 
     // Make comment body translatable.
     $field = field_info_field('comment_body');
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentNewIndicatorTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentNewIndicatorTest.php
index 6d84a76..e121432 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentNewIndicatorTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentNewIndicatorTest.php
@@ -51,7 +51,7 @@ public function testCommentNewCommentsIndicator() {
       'nid' => $this->node->nid,
       'node_type' => $this->node->type,
       'pid' => 0,
-      'uid' => $this->loggedInUser->id(),
+      'uid' => $this->loggedInUser->uid,
       'status' => COMMENT_PUBLISHED,
       'subject' => $this->randomName(),
       'hostname' => '127.0.0.1',
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentPreviewTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentPreviewTest.php
index 0b7cd20..bf1cf6b 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentPreviewTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentPreviewTest.php
@@ -52,7 +52,7 @@ function testCommentPreview() {
     $edit['signature[value]'] = '<a href="http://example.com/">' . $test_signature. '</a>';
     $image = current($this->drupalGetTestFiles('image'));
     $edit['files[user_picture_und_0]'] = drupal_realpath($image->uri);
-    $this->drupalPost('user/' . $this->web_user->id() . '/edit', $edit, t('Save'));
+    $this->drupalPost('user/' . $this->web_user->uid . '/edit', $edit, t('Save'));
 
     // As the web user, fill in the comment form and preview the comment.
     $edit = array();
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentStatisticsTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentStatisticsTest.php
index 06ebf86..4578ade 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentStatisticsTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentStatisticsTest.php
@@ -51,7 +51,7 @@ function testCommentNodeCommentStatistics() {
     $node = node_load($this->node->nid);
     $this->assertEqual($node->last_comment_timestamp, $this->node->created, 'The initial value of node last_comment_timestamp is the node created date.');
     $this->assertEqual($node->last_comment_name, NULL, 'The initial value of node last_comment_name is NULL.');
-    $this->assertEqual($node->last_comment_uid, $this->web_user->id(), 'The initial value of node last_comment_uid is the node uid.');
+    $this->assertEqual($node->last_comment_uid, $this->web_user->uid, 'The initial value of node last_comment_uid is the node uid.');
     $this->assertEqual($node->comment_count, 0, 'The initial value of node comment_count is zero.');
 
     // Post comment #1 as web_user2.
@@ -63,7 +63,7 @@ function testCommentNodeCommentStatistics() {
     // The node needs to be reloaded with a node_load_multiple cache reset.
     $node = node_load($this->node->nid, TRUE);
     $this->assertEqual($node->last_comment_name, NULL, 'The value of node last_comment_name is NULL.');
-    $this->assertEqual($node->last_comment_uid, $this->web_user2->id(), 'The value of node last_comment_uid is the comment #1 uid.');
+    $this->assertEqual($node->last_comment_uid, $this->web_user2->uid, 'The value of node last_comment_uid is the comment #1 uid.');
     $this->assertEqual($node->comment_count, 1, 'The value of node comment_count is 1.');
 
     // Prepare for anonymous comment submission (comment approval enabled).
@@ -86,7 +86,7 @@ function testCommentNodeCommentStatistics() {
     // The node needs to be reloaded with a node_load_multiple cache reset.
     $node = node_load($this->node->nid, TRUE);
     $this->assertEqual($node->last_comment_name, NULL, 'The value of node last_comment_name is still NULL.');
-    $this->assertEqual($node->last_comment_uid, $this->web_user2->id(), 'The value of node last_comment_uid is still the comment #1 uid.');
+    $this->assertEqual($node->last_comment_uid, $this->web_user2->uid, 'The value of node last_comment_uid is still the comment #1 uid.');
     $this->assertEqual($node->comment_count, 1, 'The value of node comment_count is still 1.');
 
     // Prepare for anonymous comment submission (no approval required).
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentTestBase.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentTestBase.php
index 0332dd7..22132c1 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentTestBase.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentTestBase.php
@@ -75,7 +75,7 @@ function setUp() {
     ));
 
     // Create a test node authored by the web user.
-    $this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'uid' => $this->web_user->id()));
+    $this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'uid' => $this->web_user->uid));
   }
 
   /**
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentThreadingTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentThreadingTest.php
index 98860fc..3636f91 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentThreadingTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentThreadingTest.php
@@ -36,7 +36,7 @@ function testCommentThreading() {
 
     // Create a node.
     $this->drupalLogin($this->web_user);
-    $this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'uid' => $this->web_user->id()));
+    $this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'uid' => $this->web_user->uid));
 
     // Post comment #1.
     $this->drupalLogin($this->web_user);
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/Views/ArgumentUserUIDTest.php b/core/modules/comment/lib/Drupal/comment/Tests/Views/ArgumentUserUIDTest.php
index 40a6f76..8234cb5 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/Views/ArgumentUserUIDTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/Views/ArgumentUserUIDTest.php
@@ -29,7 +29,7 @@ public static function getInfo() {
 
   function testCommentUserUIDTest() {
     $view = views_get_view('test_comment_user_uid');
-    $this->executeView($view, array($this->account->id()));
+    $this->executeView($view, array($this->account->uid));
     $result_set = array(
       array(
         'nid' => $this->node_user_posted->nid,
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/Views/CommentTestBase.php b/core/modules/comment/lib/Drupal/comment/Tests/Views/CommentTestBase.php
index 2a14f1f..c913883 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/Views/CommentTestBase.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/Views/CommentTestBase.php
@@ -44,7 +44,7 @@ function setUp() {
     $this->node_user_commented = $this->drupalCreateNode(array('uid' => $this->account2->uid));
 
     $comment = array(
-      'uid' => $this->loggedInUser->id(),
+      'uid' => $this->loggedInUser->uid,
       'nid' => $this->node_user_commented->nid,
       'cid' => '',
       'pid' => '',
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/Views/FilterUserUIDTest.php b/core/modules/comment/lib/Drupal/comment/Tests/Views/FilterUserUIDTest.php
index e775687..9c8c880 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/Views/FilterUserUIDTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/Views/FilterUserUIDTest.php
@@ -38,10 +38,10 @@ function testCommentUserUIDTest() {
       'id' => 'uid_touch',
       'table' => 'node_field_data',
       'field' => 'uid_touch',
-      'value' => array($this->loggedInUser->id()),
+      'value' => array($this->loggedInUser->uid),
     );
     $view->addItem('default', 'filter', 'node_field_data', 'uid_touch', $options);
-    $this->executeView($view, array($this->account->id()));
+    $this->executeView($view, array($this->account->uid));
     $result_set = array(
       array(
         'nid' => $this->node_user_posted->nid,
diff --git a/core/modules/comment/tests/modules/comment_test_views/test_views/views.view.test_comment_rss.yml b/core/modules/comment/tests/modules/comment_test_views/test_views/views.view.test_comment_rss.yml
index e87ac87..d9901aa 100644
--- a/core/modules/comment/tests/modules/comment_test_views/test_views/views.view.test_comment_rss.yml
+++ b/core/modules/comment/tests/modules/comment_test_views/test_views/views.view.test_comment_rss.yml
@@ -30,7 +30,6 @@ display:
           table: comment
           field: nid
           required: '1'
-          provider: views
       fields:
         subject:
           id: subject
@@ -50,7 +49,6 @@ display:
           hide_empty: '0'
           empty_zero: '0'
           link_to_comment: '1'
-          provider: comment
       filters: {  }
       sorts: {  }
   feed_1:
diff --git a/core/modules/comment/tests/modules/comment_test_views/test_views/views.view.test_comment_user_uid.yml b/core/modules/comment/tests/modules/comment_test_views/test_views/views.view.test_comment_user_uid.yml
index d7c3f3e..c67a240 100644
--- a/core/modules/comment/tests/modules/comment_test_views/test_views/views.view.test_comment_user_uid.yml
+++ b/core/modules/comment/tests/modules/comment_test_views/test_views/views.view.test_comment_user_uid.yml
@@ -20,7 +20,6 @@ display:
             items_per_page: '25'
           table: node_field_data
           plugin_id: argument_comment_user_uid
-          provider: comment
       cache:
         type: none
       exposed_form:
@@ -31,7 +30,6 @@ display:
           id: nid
           table: node
           plugin_id: node
-          provider: node
       pager:
         type: full
       query:
diff --git a/core/modules/config/lib/Drupal/config/Form/ConfigImportForm.php b/core/modules/config/lib/Drupal/config/Form/ConfigImportForm.php
index 1906abb..30dc2d3 100644
--- a/core/modules/config/lib/Drupal/config/Form/ConfigImportForm.php
+++ b/core/modules/config/lib/Drupal/config/Form/ConfigImportForm.php
@@ -39,20 +39,15 @@ public function validateForm(array &$form, array &$form_state) {
   public function submitForm(array &$form, array &$form_state) {
     if ($path = $form_state['values']['import_tarball']) {
       \Drupal::service('config.storage.staging')->deleteAll();
-      try {
-        $archiver = new ArchiveTar($path, 'gz');
-        $files = array();
-        foreach ($archiver->listContent() as $file) {
-          $files[] = $file['filename'];
-        }
-        $archiver->extractList($files, config_get_config_directory(CONFIG_STAGING_DIRECTORY));
-        drupal_set_message('Your configuration files were successfully uploaded, ready for import.');
-        $form_state['redirect'] = 'admin/config/development/sync';
-      }
-      catch (\Exception $e) {
-        form_set_error('import_tarball', t('Could not extract the contents of the tar file. The error message is <em>@message</em>', array('@message' => $e->getMessage())));
+      $archiver = new ArchiveTar($path, 'gz');
+      $files = array();
+      foreach ($archiver->listContent() as $file) {
+        $files[] = $file['filename'];
       }
+      $archiver->extractList($files, config_get_config_directory(CONFIG_STAGING_DIRECTORY));
       drupal_unlink($path);
+      drupal_set_message('Your configuration files were successfully uploaded, ready for import.');
+      $form_state['redirect'] = 'admin/config/development/sync';
     }
   }
 }
diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigImportUploadTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigImportUploadTest.php
deleted file mode 100644
index e753695..0000000
--- a/core/modules/config/lib/Drupal/config/Tests/ConfigImportUploadTest.php
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-
-/**
- * @file
- * Definition of Drupal\config\Tests\ConfigImportUploadTest.
- */
-
-namespace Drupal\config\Tests;
-
-use Drupal\simpletest\WebTestBase;
-
-/**
- * Tests importing configuration from an uploaded file.
- */
-class ConfigImportUploadTest extends WebTestBase {
-
-  public static $modules = array('config');
-
-  public static function getInfo() {
-    return array(
-      'name' => 'Import uploaded config',
-      'description' => 'Tests importing configuration from an uploaded file.',
-      'group' => 'Configuration'
-    );
-  }
-
-  function setUp() {
-    parent::setUp();
-
-    $this->web_user = $this->drupalCreateUser(array('import configuration'));
-    $this->drupalLogin($this->web_user);
-  }
-
-  /**
-   * Tests importing configuration.
-   */
-  function testImport() {
-    // Verify access to the config upload form.
-    $this->drupalGet('admin/config/development/import');
-    $this->assertResponse(200);
-
-    // Attempt to upload a non-tar file.
-    $text_file = current($this->drupalGetTestFiles('text'));
-    $edit = array('files[import_tarball]' => drupal_realpath($text_file->uri));
-    $this->drupalPost('admin/config/development/import', $edit, t('Upload'));
-    $this->assertText(t('Could not extract the contents of the tar file'));
-  }
-
-}
diff --git a/core/modules/config/tests/config_test/config_test.module b/core/modules/config/tests/config_test/config_test.module
index 41e7c62..5367d64 100644
--- a/core/modules/config/tests/config_test/config_test.module
+++ b/core/modules/config/tests/config_test/config_test.module
@@ -58,6 +58,21 @@ function config_test_menu() {
 }
 
 /**
+ * Implements hook_local_actions()
+ */
+function config_test_local_actions() {
+  return array(
+    array(
+      'route_name' => 'config_test_entity_add',
+      'title' => t('Add test configuration'),
+      'appears_on' => array(
+        'config_test_list_page',
+      ),
+    ),
+  );
+}
+
+/**
  * Loads a ConfigTest object.
  *
  * @param string $id
diff --git a/core/modules/config/tests/config_test/lib/Drupal/config_test/ConfigTestAccessController.php b/core/modules/config/tests/config_test/lib/Drupal/config_test/ConfigTestAccessController.php
index f084453..cde6f41 100644
--- a/core/modules/config/tests/config_test/lib/Drupal/config_test/ConfigTestAccessController.php
+++ b/core/modules/config/tests/config_test/lib/Drupal/config_test/ConfigTestAccessController.php
@@ -24,11 +24,4 @@ public function access(EntityInterface $entity, $operation, $langcode = Language
     return TRUE;
   }
 
-  /**
-   * {@inheritdoc}
-   */
-  protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) {
-    return TRUE;
-  }
-
 }
diff --git a/core/modules/config/tests/config_test/lib/Drupal/config_test/Plugin/Menu/LocalAction/AddConfigTestEntityLocalAction.php b/core/modules/config/tests/config_test/lib/Drupal/config_test/Plugin/Menu/LocalAction/AddConfigTestEntityLocalAction.php
deleted file mode 100644
index 9a55b79..0000000
--- a/core/modules/config/tests/config_test/lib/Drupal/config_test/Plugin/Menu/LocalAction/AddConfigTestEntityLocalAction.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\config_test\Plugin\Menu\AddConfigTestEntityLocalAction.
- */
-
-namespace Drupal\config_test\Plugin\Menu\LocalAction;
-
-use Drupal\Core\Annotation\Translation;
-use Drupal\Core\Menu\LocalActionBase;
-use Drupal\Core\Annotation\Menu\LocalAction;
-
-/**
- * @LocalAction(
- *   id = "config_test_entity_add_local_action",
- *   route_name = "config_test_entity_add",
- *   title = @Translation("Add test configuration"),
- *   appears_on = {"config_test_list_page"}
- * )
- */
-class AddConfigTestEntityLocalAction extends LocalActionBase {
-
-}
diff --git a/core/modules/contact/contact.module b/core/modules/contact/contact.module
index 6412d32..a2d2359 100644
--- a/core/modules/contact/contact.module
+++ b/core/modules/contact/contact.module
@@ -126,12 +126,12 @@ function _contact_personal_tab_access($account) {
   global $user;
 
   // Anonymous users cannot have contact forms.
-  if ($account->isAnonymous()) {
+  if (!$account->uid) {
     return FALSE;
   }
 
   // Users may not contact themselves.
-  if ($user->id() == $account->id()) {
+  if ($user->uid == $account->uid) {
     return FALSE;
   }
 
@@ -269,7 +269,7 @@ function contact_mail($key, &$message, $params) {
     '!form-url' => url(current_path(), array('absolute' => TRUE, 'language' => $language)),
     '!sender-name' => user_format_name($sender),
   );
-  if ($sender->isAuthenticated()) {
+  if (!empty($sender->uid)) {
     $sender_uri = $sender->uri();
     $variables['!sender-url'] = url($sender_uri['path'], array('absolute' => TRUE, 'language' => $language) + $sender_uri['options']);
   }
@@ -297,7 +297,7 @@ function contact_mail($key, &$message, $params) {
     case 'user_copy':
       $variables += array(
         '!recipient-name' => user_format_name($params['recipient']),
-        '!recipient-edit-url' => url('user/' . $params['recipient']->id() . '/edit', array('absolute' => TRUE, 'language' => $language)),
+        '!recipient-edit-url' => url('user/' . $params['recipient']->uid . '/edit', array('absolute' => TRUE, 'language' => $language)),
       );
       $message['subject'] .= t('[!site-name] !subject', $variables, $options);
       $message['body'][] = t('Hello !recipient-name,', $variables, $options);
diff --git a/core/modules/contact/lib/Drupal/contact/MessageFormController.php b/core/modules/contact/lib/Drupal/contact/MessageFormController.php
index a4abbac..bf807a6 100644
--- a/core/modules/contact/lib/Drupal/contact/MessageFormController.php
+++ b/core/modules/contact/lib/Drupal/contact/MessageFormController.php
@@ -44,7 +44,7 @@ public function form(array $form, array &$form_state) {
       '#title' => t('Your e-mail address'),
       '#required' => TRUE,
     );
-    if ($user->isAnonymous()) {
+    if (!$user->uid) {
       $form['#attached']['library'][] = array('system', 'jquery.cookie');
       $form['#attributes']['class'][] = 'user-info-from-cookie';
     }
@@ -93,7 +93,7 @@ public function form(array $form, array &$form_state) {
       '#title' => t('Send yourself a copy.'),
       // Do not allow anonymous users to send themselves a copy, because it can
       // be abused to spam people.
-      '#access' => $user->isAuthenticated(),
+      '#access' => !empty($user->uid),
     );
     return $form;
   }
@@ -136,8 +136,8 @@ public function save(array $form, array &$form_state) {
     $language_interface = language(Language::TYPE_INTERFACE);
     $message = $this->entity;
 
-    $sender = clone user_load($user->id());
-    if ($user->isAnonymous()) {
+    $sender = clone user_load($user->uid);
+    if (!$user->uid) {
       // At this point, $sender contains drupal_anonymous_user(), so we need to
       // take over the submitted form values.
       $sender->name = $message->getSenderName();
@@ -164,7 +164,7 @@ public function save(array $form, array &$form_state) {
     elseif ($recipient = $message->getPersonalRecipient()) {
       // Send to the user in the user's preferred language.
       $to = $recipient->mail->value;
-      $recipient_langcode = $recipient->getPreferredLangcode();
+      $recipient_langcode = user_preferred_langcode($recipient);
       $params['recipient'] = $recipient->getBCEntity();
     }
     else {
diff --git a/core/modules/contact/lib/Drupal/contact/Tests/ContactPersonalTest.php b/core/modules/contact/lib/Drupal/contact/Tests/ContactPersonalTest.php
index 0f6c72b..e027b63 100644
--- a/core/modules/contact/lib/Drupal/contact/Tests/ContactPersonalTest.php
+++ b/core/modules/contact/lib/Drupal/contact/Tests/ContactPersonalTest.php
@@ -92,22 +92,22 @@ function testSendPersonalContactMessage() {
   function testPersonalContactAccess() {
     // Test allowed access to admin user's contact form.
     $this->drupalLogin($this->web_user);
-    $this->drupalGet('user/' . $this->admin_user->id() . '/contact');
+    $this->drupalGet('user/' . $this->admin_user->uid . '/contact');
     $this->assertResponse(200);
 
     // Test denied access to admin user's own contact form.
     $this->drupalLogout();
     $this->drupalLogin($this->admin_user);
-    $this->drupalGet('user/' . $this->admin_user->id() . '/contact');
+    $this->drupalGet('user/' . $this->admin_user->uid . '/contact');
     $this->assertResponse(403);
 
     // Test allowed access to user with contact form enabled.
     $this->drupalLogin($this->web_user);
-    $this->drupalGet('user/' . $this->contact_user->id() . '/contact');
+    $this->drupalGet('user/' . $this->contact_user->uid . '/contact');
     $this->assertResponse(200);
 
     // Test denied access to the user's own contact form.
-    $this->drupalGet('user/' . $this->web_user->id() . '/contact');
+    $this->drupalGet('user/' . $this->web_user->uid . '/contact');
     $this->assertResponse(403);
 
     // Test always denied access to the anonymous user contact form.
@@ -117,18 +117,18 @@ function testPersonalContactAccess() {
     // Test that anonymous users can access the contact form.
     $this->drupalLogout();
     user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access user contact forms'));
-    $this->drupalGet('user/' . $this->contact_user->id() . '/contact');
+    $this->drupalGet('user/' . $this->contact_user->uid . '/contact');
     $this->assertResponse(200);
 
     // Test that anonymous users can access admin user's contact form.
-    $this->drupalGet('user/' . $this->admin_user->id() . '/contact');
+    $this->drupalGet('user/' . $this->admin_user->uid . '/contact');
     $this->assertResponse(200);
 
     // Revoke the personal contact permission for the anonymous user.
     user_role_revoke_permissions(DRUPAL_ANONYMOUS_RID, array('access user contact forms'));
-    $this->drupalGet('user/' . $this->contact_user->id() . '/contact');
+    $this->drupalGet('user/' . $this->contact_user->uid . '/contact');
     $this->assertResponse(403);
-    $this->drupalGet('user/' . $this->admin_user->id() . '/contact');
+    $this->drupalGet('user/' . $this->admin_user->uid . '/contact');
     $this->assertResponse(403);
 
     // Disable the personal contact form.
@@ -144,12 +144,12 @@ function testPersonalContactAccess() {
 
     // Test denied access to a user with contact form disabled.
     $this->drupalLogin($this->web_user);
-    $this->drupalGet('user/' . $this->contact_user->id() . '/contact');
+    $this->drupalGet('user/' . $this->contact_user->uid . '/contact');
     $this->assertResponse(403);
 
     // Test allowed access for admin user to a user with contact form disabled.
     $this->drupalLogin($this->admin_user);
-    $this->drupalGet('user/' . $this->contact_user->id() . '/contact');
+    $this->drupalGet('user/' . $this->contact_user->uid . '/contact');
     $this->assertResponse(200);
 
     // Re-create our contacted user as a blocked user.
@@ -158,12 +158,12 @@ function testPersonalContactAccess() {
     $this->contact_user->save();
 
     // Test that blocked users can still be contacted by admin.
-    $this->drupalGet('user/' . $this->contact_user->id() . '/contact');
+    $this->drupalGet('user/' . $this->contact_user->uid . '/contact');
     $this->assertResponse(200);
 
     // Test that blocked users cannot be contacted by non-admins.
     $this->drupalLogin($this->web_user);
-    $this->drupalGet('user/' . $this->contact_user->id() . '/contact');
+    $this->drupalGet('user/' . $this->contact_user->uid . '/contact');
     $this->assertResponse(403);
   }
 
@@ -188,7 +188,7 @@ function testPersonalContactFlood() {
     }
 
     // Submit contact form one over limit.
-    $this->drupalGet('user/' . $this->contact_user->id(). '/contact');
+    $this->drupalGet('user/' . $this->contact_user->uid. '/contact');
     $this->assertRaw(t('You cannot send more than %number messages in @interval. Try again later.', array('%number' => $flood_limit, '@interval' => format_interval(config('contact.settings')->get('flood.interval')))), 'Normal user denied access to flooded contact form.');
 
     // Test that the admin user can still access the contact form even though
@@ -211,7 +211,7 @@ protected function submitPersonalContact($account, array $message = array()) {
       'subject' => $this->randomName(16),
       'message' => $this->randomName(64),
     );
-    $this->drupalPost('user/' . $account->id() . '/contact', $message, t('Send message'));
+    $this->drupalPost('user/' . $account->uid . '/contact', $message, t('Send message'));
     return $message;
   }
 }
diff --git a/core/modules/content_translation/content_translation.admin.inc b/core/modules/content_translation/content_translation.admin.inc
index 63e71fc..01c271f 100644
--- a/core/modules/content_translation/content_translation.admin.inc
+++ b/core/modules/content_translation/content_translation.admin.inc
@@ -367,6 +367,87 @@ function _content_translation_update_field_translatability($settings) {
 }
 
 /**
+ * Form constructor for the confirmation of translatability switching.
+ */
+function content_translation_translatable_form(array $form, array &$form_state, $field_name) {
+  $field = field_info_field($field_name);
+  $t_args = array('%name' => $field_name);
+
+  $warning = t('By submitting this form these changes will apply to the %name field everywhere it is used.', $t_args);
+  if ($field['translatable']) {
+    $title = t('Are you sure you want to disable translation for the %name field?', $t_args);
+    $warning .= "<br>" . t("<strong>All the existing translations of this field will be deleted.</strong><br>This action cannot be undone.");
+  }
+  else {
+    $title = t('Are you sure you want to enable translation for the %name field?', $t_args);
+  }
+
+  // We need to keep some information for later processing.
+  $form_state['field'] = $field;
+
+  // Store the 'translatable' status on the client side to prevent outdated form
+  // submits from toggling translatability.
+  $form['translatable'] = array(
+    '#type' => 'hidden',
+    '#default_value' => $field['translatable'],
+  );
+
+  return confirm_form($form, $title, '', $warning);
+}
+
+/**
+ * Form submission handler for content_translation_translatable_form().
+ *
+ * This submit handler maintains consistency between the translatability of an
+ * entity and the language under which the field data is stored. When a field is
+ * marked as translatable, all the data in
+ * $entity->{field_name}[Language::LANGCODE_NOT_SPECIFIED] is moved to
+ * $entity->{field_name}[$entity_language]. When a field is marked as
+ * untranslatable the opposite process occurs. Note that marking a field as
+ * untranslatable will cause all of its translations to be permanently removed,
+ * with the exception of the one corresponding to the entity language.
+ */
+function content_translation_translatable_form_submit(array $form, array $form_state) {
+  // This is the current state that we want to reverse.
+  $translatable = $form_state['values']['translatable'];
+  $field_name = $form_state['field']['field_name'];
+  $field = field_info_field($field_name);
+
+  if ($field['translatable'] !== $translatable) {
+    // Field translatability has changed since form creation, abort.
+    $t_args = array('%field_name');
+    $msg = $translatable ?
+      t('The field %field_name is already translatable. No change was performed.', $t_args):
+      t('The field %field_name is already untranslatable. No change was performed.', $t_args);
+    drupal_set_message($msg, 'warning');
+    return;
+  }
+
+  // If a field is untranslatable, it can have no data except under
+  // Language::LANGCODE_NOT_SPECIFIED. Thus we need a field to be translatable before we
+  // convert data to the entity language. Conversely we need to switch data back
+  // to Language::LANGCODE_NOT_SPECIFIED before making a field untranslatable lest we lose
+  // information.
+  $operations = array(
+    array('content_translation_translatable_batch', array(!$translatable, $field_name)),
+    array('content_translation_translatable_switch', array(!$translatable, $field_name)),
+  );
+  $operations = $translatable ? $operations : array_reverse($operations);
+
+  $t_args = array('%field' => $field_name);
+  $title = !$translatable ? t('Enabling translation for the %field field', $t_args) : t('Disabling translation for the %field field', $t_args);
+
+  $batch = array(
+    'title' => $title,
+    'operations' => $operations,
+    'finished' => 'content_translation_translatable_batch_done',
+    'file' => drupal_get_path('module', 'content_translation') . '/content_translation.admin.inc',
+  );
+
+  batch_set($batch);
+}
+
+/**
  * Toggles translatability of the given field.
  *
  * This is called from a batch operation, but should only run once per field.
diff --git a/core/modules/content_translation/content_translation.module b/core/modules/content_translation/content_translation.module
index a6988cf..cbd33e8 100644
--- a/core/modules/content_translation/content_translation.module
+++ b/core/modules/content_translation/content_translation.module
@@ -64,9 +64,8 @@ function content_translation_module_implements_alter(&$implementations, $hook) {
  * Implements hook_language_type_info_alter().
  */
 function content_translation_language_types_info_alter(array &$language_types) {
-  // Make content language negotiation configurable by removing the 'locked'
-  // flag.
-  $language_types[Language::TYPE_CONTENT]['locked'] = FALSE;
+  // Make content language negotiation configurable by removing its predefined
+  // configuration.
   unset($language_types[Language::TYPE_CONTENT]['fixed']);
 }
 
@@ -203,7 +202,10 @@ function content_translation_menu() {
   $items['admin/config/regional/content_translation/translatable/%'] = array(
     'title' => 'Confirm change in translatability.',
     'description' => 'Confirm page for changing field translatability.',
-    'route_name' => 'content_translation_translatable',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('content_translation_translatable_form', 5),
+    'access arguments' => array('administer content translation'),
+    'file' => 'content_translation.admin.inc',
   );
 
   return $items;
@@ -730,7 +732,7 @@ function content_translation_entity_insert(EntityInterface $entity) {
 
     $translation += array(
       'source' => '',
-      'uid' => $GLOBALS['user']->id(),
+      'uid' => $GLOBALS['user']->uid,
       'outdated' => FALSE,
       'status' => TRUE,
       'created' => REQUEST_TIME,
diff --git a/core/modules/content_translation/content_translation.routing.yml b/core/modules/content_translation/content_translation.routing.yml
deleted file mode 100644
index d7d55a1..0000000
--- a/core/modules/content_translation/content_translation.routing.yml
+++ /dev/null
@@ -1,6 +0,0 @@
-content_translation_translatable:
-  pattern: 'admin/config/regional/content_translation/translatable/{field_name}'
-  defaults:
-    _form: 'Drupal\content_translation\Form\TranslatableForm'
-  requirements:
-    _permission: 'administer content translation'
diff --git a/core/modules/content_translation/lib/Drupal/content_translation/ContentTranslationController.php b/core/modules/content_translation/lib/Drupal/content_translation/ContentTranslationController.php
index 6948642..2386f1f 100644
--- a/core/modules/content_translation/lib/Drupal/content_translation/ContentTranslationController.php
+++ b/core/modules/content_translation/lib/Drupal/content_translation/ContentTranslationController.php
@@ -410,7 +410,7 @@ public function entityFormEntityBuild($entity_type, EntityInterface $entity, arr
 
     // @todo Use the entity setter when all entities support multilingual
     // properties.
-    $translation['uid'] = !empty($values['name']) && ($account = user_load_by_name($values['name'])) ? $account->id() : 0;
+    $translation['uid'] = !empty($values['name']) && ($account = user_load_by_name($values['name'])) ? $account->uid : 0;
     $translation['status'] = !empty($values['status']);
     $translation['created'] = !empty($values['created']) ? strtotime($values['created']) : REQUEST_TIME;
     $translation['changed'] = REQUEST_TIME;
diff --git a/core/modules/content_translation/lib/Drupal/content_translation/Form/TranslatableForm.php b/core/modules/content_translation/lib/Drupal/content_translation/Form/TranslatableForm.php
deleted file mode 100644
index bdeb983..0000000
--- a/core/modules/content_translation/lib/Drupal/content_translation/Form/TranslatableForm.php
+++ /dev/null
@@ -1,150 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\content_translation\Form\TranslatableForm.
- */
-
-namespace Drupal\content_translation\Form;
-
-use Drupal\Core\Form\ConfirmFormBase;
-use Drupal\field\Field;
-
-/**
- * Provides a confirm form for changing translatable status on translation
- * fields.
- */
-class TranslatableForm extends ConfirmFormBase {
-
-  /**
-   * The field info we are changing translatable status on.
-   *
-   * @var array.
-   */
-  protected $fieldInfo;
-
-  /**
-   * The field name we are changing translatable
-   * status on.
-   *
-   * @var string.
-   */
-  protected $fieldName;
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getFormID() {
-    return 'content_translation_translatable_form';
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getQuestion() {
-    if ($field['translatable']) {
-      $question = t('Are you sure you want to disable translation for the %name field?', array('%name' => $this->fieldName));
-    }
-    else {
-      $question = t('Are you sure you want to enable translation for the %name field?', array('%name' => $this->fieldName));
-    }
-    return $question;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getDescription() {
-    $description = t('By submitting this form these changes will apply to the %name field everywhere it is used.',
-      array('%name' => $this->fieldName)
-    );
-    $description .= $this->fieldInfo['translatable'] ? "<br>" . t("<strong>All the existing translations of this field will be deleted.</strong><br>This action cannot be undone.") : '';
-    return $description;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getCancelPath() {
-    return '';
-  }
-
-  /**
-   * {@inheritdoc}
-   * @param string $field_name
-   *   The field name.
-   */
-  public function buildForm(array $form, array &$form_state, $field_name = NULL) {
-    $this->fieldName = $field_name;
-    $this->fieldInfo = Field::fieldInfo($field_name);
-
-    return parent::buildForm($form, $form_state);
-  }
-
-  /**
-   * Form submission handler.
-   *
-   * This submit handler maintains consistency between the translatability of an
-   * entity and the language under which the field data is stored. When a field
-   * is marked as translatable, all the data in
-   * $entity->{field_name}[Language::LANGCODE_NOT_SPECIFIED] is moved to
-   * $entity->{field_name}[$entity_language]. When a field is marked as
-   * untranslatable the opposite process occurs. Note that marking a field as
-   * untranslatable will cause all of its translations to be permanently
-   * removed, with the exception of the one corresponding to the entity
-   * language.
-   *
-   * @param array $form
-   *   An associative array containing the structure of the form.
-   * @param array $form_state
-   *   An associative array containing the current state of the form.
-   */
-  public function submitForm(array &$form, array &$form_state) {
-    // This is the current state that we want to reverse.
-    $translatable = $form_state['values']['translatable'];
-    if ($this->field['translatable'] !== $translatable) {
-      // Field translatability has changed since form creation, abort.
-      $t_args = array('%field_name');
-      $msg = $translatable ?
-        t('The field %field_name is already translatable. No change was performed.', $t_args):
-        t('The field %field_name is already untranslatable. No change was performed.', $t_args);
-      drupal_set_message($msg, 'warning');
-      return;
-    }
-
-    // If a field is untranslatable, it can have no data except under
-    // Language::LANGCODE_NOT_SPECIFIED. Thus we need a field to be translatable
-    // before we convert data to the entity language. Conversely we need to
-    // switch data back to Language::LANGCODE_NOT_SPECIFIED before making a
-    // field untranslatable lest we lose information.
-    $operations = array(
-      array(
-        'content_translation_translatable_batch', array(
-          !$translatable,
-          $this->fieldName,
-        ),
-      ),
-      array(
-        'content_translation_translatable_switch', array(
-          !$translatable,
-          $this->fieldName,
-        ),
-      ),
-    );
-    $operations = $translatable ? $operations : array_reverse($operations);
-
-    $t_args = array('%field' => $this->fieldName);
-    $title = !$translatable ? t('Enabling translation for the %field field', $t_args) : t('Disabling translation for the %field field', $t_args);
-
-    $batch = array(
-      'title' => $title,
-      'operations' => $operations,
-      'finished' => 'content_translation_translatable_batch_done',
-      'file' => drupal_get_path('module', 'content_translation') . '/content_translation.admin.inc',
-    );
-
-    batch_set($batch);
-
-  }
-
-}
diff --git a/core/modules/content_translation/lib/Drupal/content_translation/Plugin/views/field/TranslationLink.php b/core/modules/content_translation/lib/Drupal/content_translation/Plugin/views/field/TranslationLink.php
index 6a9d5a7..2abd160 100644
--- a/core/modules/content_translation/lib/Drupal/content_translation/Plugin/views/field/TranslationLink.php
+++ b/core/modules/content_translation/lib/Drupal/content_translation/Plugin/views/field/TranslationLink.php
@@ -44,7 +44,7 @@ public function buildOptionsForm(&$form, &$form_state) {
   /**
    * Overrides \Drupal\views\Plugin\views\field\FieldPluginBase::render().
    */
-  public function render($values) {
+  function render($values) {
     return $this->render_link($this->getEntity($values), $values);
   }
 
diff --git a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ConfigTestTranslationUITest.php b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ConfigTestTranslationUITest.php
index bb3c3fe..5765cd4 100644
--- a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ConfigTestTranslationUITest.php
+++ b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ConfigTestTranslationUITest.php
@@ -65,7 +65,7 @@ function testTranslationUI() {
     $values[$default_langcode] = $this->getNewEntityValues($default_langcode);
     $id = $this->createEntity($values[$default_langcode], $default_langcode);
     $entity = entity_load($this->entityType, $id, TRUE);
-    $this->assertTrue($entity, 'Entity found in the database.');
+    $this->assertTrue($entity, t('Entity found in the database.'));
 
     $translation = $this->getTranslation($entity, $default_langcode);
     foreach ($values[$default_langcode] as $property => $value) {
diff --git a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationSyncImageTest.php b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationSyncImageTest.php
index 54d234e..c9bf33d 100644
--- a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationSyncImageTest.php
+++ b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationSyncImageTest.php
@@ -107,7 +107,7 @@ function testImageFieldSync() {
       // identifier.
       $field_values = array(
         'uri' => $this->files[$index]->uri,
-        'uid' => $GLOBALS['user']->id(),
+        'uid' => $GLOBALS['user']->uid,
         'status' => FILE_STATUS_PERMANENT,
       );
       $file = entity_create('file', $field_values);
diff --git a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationUITest.php b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationUITest.php
index 1e21d53..94006ea 100644
--- a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationUITest.php
+++ b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationUITest.php
@@ -50,7 +50,7 @@ protected function assertBasicTranslation() {
     $values[$default_langcode] = $this->getNewEntityValues($default_langcode);
     $this->entityId = $this->createEntity($values[$default_langcode], $default_langcode);
     $entity = entity_load($this->entityType, $this->entityId, TRUE);
-    $this->assertTrue($entity, 'Entity found in the database.');
+    $this->assertTrue($entity, t('Entity found in the database.'));
 
     $translation = $this->getTranslation($entity, $default_langcode);
     foreach ($values[$default_langcode] as $property => $value) {
@@ -165,7 +165,7 @@ protected function assertAuthoringInfo() {
     foreach ($this->langcodes as $index => $langcode) {
       $user = $this->drupalCreateUser();
       $values[$langcode] = array(
-        'uid' => $user->id(),
+        'uid' => $user->uid,
         'created' => REQUEST_TIME - mt_rand(0, 1000),
       );
       $edit = array(
diff --git a/core/modules/content_translation/lib/Drupal/content_translation/Tests/Views/TranslationLinkTest.php b/core/modules/content_translation/lib/Drupal/content_translation/Tests/Views/TranslationLinkTest.php
index b26b0a5..1f5e457 100644
--- a/core/modules/content_translation/lib/Drupal/content_translation/Tests/Views/TranslationLinkTest.php
+++ b/core/modules/content_translation/lib/Drupal/content_translation/Tests/Views/TranslationLinkTest.php
@@ -46,11 +46,6 @@ function setUp() {
 
     parent::setUp();
 
-    // Assign user 1  a language code so that the entity can be translated.
-    $user = user_load(1);
-    $user->langcode = 'en';
-    $user->save();
-
     ViewTestData::importTestViews(get_class($this), array('content_translation_test_views'));
   }
 
diff --git a/core/modules/content_translation/tests/modules/content_translation_test_views/test_views/views.view.test_entity_translations_link.yml b/core/modules/content_translation/tests/modules/content_translation_test_views/test_views/views.view.test_entity_translations_link.yml
index 8d530cc..ac1f7a2 100644
--- a/core/modules/content_translation/tests/modules/content_translation_test_views/test_views/views.view.test_entity_translations_link.yml
+++ b/core/modules/content_translation/tests/modules/content_translation_test_views/test_views/views.view.test_entity_translations_link.yml
@@ -44,7 +44,6 @@ display:
           link_to_user: '1'
           format_username: '1'
           plugin_id: user_name
-          provider: user
         translation_link:
           id: translation_link
           table: users
@@ -72,7 +71,6 @@ display:
           group: '1'
           exposed: '0'
           plugin_id: numeric
-          provider: views
       sorts:
         created:
           id: created
@@ -80,7 +78,6 @@ display:
           field: created
           order: DESC
           plugin_id: date
-          provider: views
       title: People
       empty:
         area:
@@ -91,7 +88,6 @@ display:
           content: 'No people available.'
           format: plain_text
           plugin_id: text
-          provider: views
   page_1:
     display_plugin: page
     id: page_1
diff --git a/core/modules/contextual/contextual.module b/core/modules/contextual/contextual.module
index 03cd17e..9280a7b 100644
--- a/core/modules/contextual/contextual.module
+++ b/core/modules/contextual/contextual.module
@@ -34,7 +34,7 @@ function contextual_toolbar() {
       '#tag' => 'button',
       '#value' => t('Edit'),
       '#attributes' => array(
-        'class' => array('toolbar-icon', 'toolbar-icon-edit'),
+        'class' => array('icon', 'icon-edit'),
         'role' => 'button',
         'aria-pressed' => 'false',
       ),
diff --git a/core/modules/contextual/contextual.toolbar.js b/core/modules/contextual/contextual.toolbar.js
index f4a37f5..ecd19d92 100644
--- a/core/modules/contextual/contextual.toolbar.js
+++ b/core/modules/contextual/contextual.toolbar.js
@@ -26,7 +26,7 @@ function initContextualToolbar (context) {
   var model = contextualToolbar.model = new contextualToolbar.Model();
 
   var viewOptions = $.extend({
-    el: $('.toolbar .toolbar-bar .contextual-toolbar-tab'),
+    el: $('.js .toolbar .bar .contextual-toolbar-tab'),
     model: model
   }, options);
   new contextualToolbar.VisualView(viewOptions);
diff --git a/core/modules/contextual/css/contextual.toolbar.css b/core/modules/contextual/css/contextual.toolbar.css
index f540349..809f6a3 100644
--- a/core/modules/contextual/css/contextual.toolbar.css
+++ b/core/modules/contextual/css/contextual.toolbar.css
@@ -4,22 +4,22 @@
  */
 
 /* Tab icon. */
-.toolbar-icon-edit:before {
+.icon-edit:before {
   background-image: url(../../../misc/edit.png);
 }
-.toolbar-icon-edit:active:before,
-.active.toolbar-icon-edit:before {
+.icon-edit:active:before,
+.active.icon-edit:before {
   background-image: url(../../../misc/edit-active.png);
 }
 
 /* Tab appearance. */
-.toolbar .toolbar-bar .contextual-toolbar-tab.toolbar-tab {
+.js .toolbar .bar .contextual-toolbar-tab.tab {
   float: right; /* LTR */
 }
-[dir="rtl"] .toolbar .toolbar-bar .contextual-toolbar-tab.toolbar-tab {
+.js[dir="rtl"] .toolbar .bar .contextual-toolbar-tab.tab {
   float: left;
 }
-.toolbar .toolbar-bar .contextual-toolbar-tab button {
+.js .toolbar .bar .contextual-toolbar-tab button {
   padding-bottom: 1em;
   padding-top: 1em;
   /* Hide tab text. */
@@ -27,10 +27,10 @@
   text-indent: -9999px;
   line-height: 1em;
 }
-[dir="rtl"] .toolbar .toolbar-bar .contextual-toolbar-tab button {
+.js[dir="rtl"] .toolbar .bar .contextual-toolbar-tab button {
   padding-right: 1.3333em;
 }
-.toolbar .toolbar-bar .contextual-toolbar-tab button.active {
+.js .toolbar .bar .contextual-toolbar-tab button.active {
   background-image:-moz-linear-gradient(rgb(78,159,234) 0%,rgb(69,132,221) 100%);
   background-image:-webkit-gradient(linear,color-stop(0, rgb(78,159,234)),color-stop(1, rgb(69,132,221)));
   background-image: -webkit-linear-gradient(top,  rgb(78,159,234) 0%, rgb(69,132,221) 100%);
@@ -38,6 +38,6 @@
 }
 
 /* @todo get rid of this declaration by making toolbar.module's CSS less specific */
-.toolbar .toolbar-bar .contextual-toolbar-tab.toolbar-tab.hidden {
+.js .toolbar .bar .contextual-toolbar-tab.tab.hidden {
   display: none;
 }
diff --git a/core/modules/contextual/lib/Drupal/contextual/Plugin/views/field/ContextualLinks.php b/core/modules/contextual/lib/Drupal/contextual/Plugin/views/field/ContextualLinks.php
index bc4a34d..7409dbb 100644
--- a/core/modules/contextual/lib/Drupal/contextual/Plugin/views/field/ContextualLinks.php
+++ b/core/modules/contextual/lib/Drupal/contextual/Plugin/views/field/ContextualLinks.php
@@ -68,7 +68,7 @@ public function preRender(&$values) {
    * @see contextual_preprocess()
    * @see contextual_contextual_links_view_alter()
    */
-  public function render($values) {
+  function render($values) {
     $links = array();
     foreach ($this->options['fields'] as $field) {
       $rendered_field = $this->view->style_plugin->getField($this->view->row_index, $field);
diff --git a/core/modules/datetime/datetime.module b/core/modules/datetime/datetime.module
index 856162c..d2c35db 100644
--- a/core/modules/datetime/datetime.module
+++ b/core/modules/datetime/datetime.module
@@ -32,27 +32,16 @@
 function datetime_element_info() {
   $format_type = datetime_default_format_type();
 
-  $date_format = '';
-  $time_format = '';
-  // Date formats cannot be loaded during install or update.
-  if (!defined('MAINTENANCE_MODE')) {
-    if ($date_format_entity = entity_load('date_format', 'html_date')) {
-      $date_format = $date_format_entity->getPattern($format_type);
-    }
-    if ($time_format_entity = entity_load('date_format', 'html_time')) {
-      $time_format = $time_format_entity->getPattern($format_type);
-    }
-  }
   $types['datetime'] = array(
     '#input' => TRUE,
     '#element_validate' => array('datetime_datetime_validate'),
     '#process' => array('datetime_datetime_form_process'),
     '#theme' => 'datetime_form',
     '#theme_wrappers' => array('datetime_wrapper'),
-    '#date_date_format' => $date_format,
+    '#date_date_format' => config('system.date')->get('formats.html_date.pattern.' . $format_type),
     '#date_date_element' => 'date',
     '#date_date_callbacks' => array(),
-    '#date_time_format' => $time_format,
+    '#date_time_format' => config('system.date')->get('formats.html_time.pattern.' . $format_type),
     '#date_time_element' => 'time',
     '#date_time_callbacks' => array(),
     '#date_year_range' => '1900:2050',
@@ -440,7 +429,7 @@ function theme_datetime_wrapper($variables) {
  *     list of the possible formats and HTML5 standards for the HTML5
  *     requirements. Defaults to the right HTML5 format for the chosen element
  *     if a HTML5 element is used, otherwise defaults to
- *     entity_load('date_format', 'html_date')->getPattern().
+ *     config('system.date')->get('formats.html_date.pattern.php').
  *   - #date_date_element: The date element. Options are:
  *     - datetime: Use the HTML5 datetime element type.
  *     - datetime-local: Use the HTML5 datetime-local element type.
@@ -460,7 +449,7 @@ function theme_datetime_wrapper($variables) {
  *     a list of the possible formats and HTML5 standards for the HTML5
  *     requirements. Defaults to the right HTML5 format for the chosen element
  *     if a HTML5 element is used, otherwise defaults to
- *     entity_load('date_format', 'html_time')->getPattern().
+ *     config('system.date')->get('formats.html_time.pattern.php').
  *   - #date_time_callbacks: An array of optional callbacks for the time
  *     element. Can be used to add a jQuery timepicker or an 'All day' checkbox.
  *   - #date_year_range: A description of the range of years to allow, like
@@ -721,11 +710,11 @@ function datetime_html5_format($part, $element) {
     case 'date':
       switch ($element['#date_date_element']) {
         case 'date':
-          return entity_load('date_format', 'html_date')->getPattern($format_type);
+          return config('system.date')->get('formats.html_date.pattern.' . $format_type);
 
         case 'datetime':
         case 'datetime-local':
-          return entity_load('date_format', 'html_datetime')->getPattern($format_type);
+          return config('system.date')->get('formats.html_datetime.pattern.' . $format_type);
 
         default:
           return $element['#date_date_format'];
@@ -735,7 +724,7 @@ function datetime_html5_format($part, $element) {
     case 'time':
       switch ($element['#date_time_element']) {
         case 'time':
-          return entity_load('date_format', 'html_time')->getPattern($format_type);
+          return config('system.date')->get('formats.html_time.pattern.' . $format_type);
 
         default:
           return $element['#date_time_format'];
@@ -1151,9 +1140,9 @@ function datetime_form_node_form_alter(&$form, &$form_state, $form_id) {
 
   // Alter the 'Authored on' date to use datetime.
   $form['author']['date']['#type'] = 'datetime';
-  $date_format = entity_load('date_format', 'html_date')->getPattern($format_type);
-  $time_format = entity_load('date_format', 'html_time')->getPattern($format_type);
-  $form['author']['date']['#description'] = t('Format: %format. Leave blank to use the time of form submission.', array('%format' => datetime_format_example($date_format . ' ' . $time_format)));
+  $config = Drupal::config('system.date');
+  $format = $config->get('formats.html_date.pattern.' . $format_type) . ' ' . $config->get('formats.html_time.pattern.' . $format_type);
+  $form['author']['date']['#description'] = t('Format: %format. Leave blank to use the time of form submission.', array('%format' => datetime_format_example($format)));
   unset($form['author']['date']['#maxlength']);
 }
 
diff --git a/core/modules/datetime/lib/Drupal/datetime/Plugin/field/formatter/DatetimeDefaultFormatter.php b/core/modules/datetime/lib/Drupal/datetime/Plugin/field/formatter/DatetimeDefaultFormatter.php
index 88a2184..729c44e 100644
--- a/core/modules/datetime/lib/Drupal/datetime/Plugin/field/formatter/DatetimeDefaultFormatter.php
+++ b/core/modules/datetime/lib/Drupal/datetime/Plugin/field/formatter/DatetimeDefaultFormatter.php
@@ -9,14 +9,10 @@
 
 use Drupal\field\Annotation\FieldFormatter;
 use Drupal\Core\Annotation\Translation;
-use Drupal\Core\Datetime\Date;
-use Drupal\Core\Datetime\DrupalDateTime;
-use Drupal\Core\Entity\EntityInterface;
-use Drupal\Core\Entity\EntityStorageControllerInterface;
-use Drupal\Core\Entity\Field\FieldDefinitionInterface;
-use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
 use Drupal\field\Plugin\Type\Formatter\FormatterBase;
-use Symfony\Component\DependencyInjection\ContainerInterface;
+use Drupal\Core\Entity\EntityInterface;
+use Drupal\Core\Datetime\DrupalDateTime;
+use Drupal\Core\Template\Attribute;
 
 /**
  * Plugin implementation of the 'datetime_default' formatter.
@@ -33,64 +29,7 @@
  *   }
  * )
  */
-class DateTimeDefaultFormatter extends FormatterBase implements ContainerFactoryPluginInterface {
-
-  /**
-   * The date service.
-   *
-   * @var \Drupal\Core\Datetime\Date
-   */
-  protected $dateService;
-
-  /**
-   * The date storage controller.
-   *
-   * @var \Drupal\Core\Entity\EntityStorageControllerInterface
-   */
-  protected $dateStorage;
-
-  /**
-   * Constructs a new DateTimeDefaultFormatter.
-   *
-   * @param string $plugin_id
-   *   The plugin_id for the formatter.
-   * @param array $plugin_definition
-   *   The plugin implementation definition.
-   * @param \Drupal\Core\Entity\Field\FieldDefinitionInterface $field_definition
-   *   The definition of the field to which the formatter is associated.
-   * @param array $settings
-   *   The formatter settings.
-   * @param string $label
-   *   The formatter label display setting.
-   * @param string $view_mode
-   *   The view mode.
-   * @param \Drupal\Core\Datetime\Date $date_service
-   *   The date service.
-   * @param \Drupal\Core\Entity\EntityStorageControllerInterface $date_storage
-   *   The date storage controller.
-   */
-  public function __construct($plugin_id, array $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, $label, $view_mode, Date $date_service, EntityStorageControllerInterface $date_storage) {
-    parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $label, $view_mode);
-
-    $this->dateService = $date_service;
-    $this->dateStorage = $date_storage;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, array $plugin_definition) {
-    return new static(
-      $plugin_id,
-      $plugin_definition,
-      $configuration['field_definition'],
-      $configuration['settings'],
-      $configuration['label'],
-      $configuration['view_mode'],
-      $container->get('date'),
-      $container->get('plugin.manager.entity')->getStorageController('date_format')
-    );
-  }
+class DateTimeDefaultFormatter extends FormatterBase {
 
   /**
    * {@inheritdoc}
@@ -150,18 +89,22 @@ public function viewElements(EntityInterface $entity, $langcode, array $items) {
    */
   function dateFormat($date) {
     $format_type = $this->getSetting('format_type');
-    return $this->dateService->format($date->getTimestamp(), $format_type);
+    return format_date($date->getTimestamp(), $format_type);
   }
 
   /**
    * {@inheritdoc}
    */
   public function settingsForm(array $form, array &$form_state) {
+
+    $element = array();
+
     $time = new DrupalDateTime();
-    $format_types = $this->dateStorage->loadMultiple();
-    foreach ($format_types as $type => $type_info) {
-      $format = $this->dateService->format($time->format('U'), $type);
-      $options[$type] = $type_info->label() . ' (' . $format . ')';
+    $format_types = system_get_date_formats();
+    if (!empty($format_types)) {
+      foreach ($format_types as $type => $type_info) {
+        $options[$type] = $type_info['name'] . ' (' . format_date($time->format('U'), $type) . ')';
+      }
     }
 
     $elements['format_type'] = array(
diff --git a/core/modules/datetime/lib/Drupal/datetime/Plugin/field/widget/DatetimeDefaultWidget.php b/core/modules/datetime/lib/Drupal/datetime/Plugin/field/widget/DatetimeDefaultWidget.php
index 5fd0a1e..79f12bc 100644
--- a/core/modules/datetime/lib/Drupal/datetime/Plugin/field/widget/DatetimeDefaultWidget.php
+++ b/core/modules/datetime/lib/Drupal/datetime/Plugin/field/widget/DatetimeDefaultWidget.php
@@ -31,13 +31,6 @@
 class DateTimeDefaultWidget extends WidgetBase {
 
   /**
-   * The date format storage.
-   *
-   * @var \Drupal\Core\Entity\EntityStorageControllerInterface
-   */
-  protected $dateStorage;
-
-  /**
    * {@inheritdoc}
    */
   public function __construct($plugin_id, array $plugin_definition, FieldDefinitionInterface $field_definition, array $settings) {
@@ -48,9 +41,6 @@ public function __construct($plugin_id, array $plugin_definition, FieldDefinitio
       $field_definition->default_value_function = $this->defaultValueFunction();
     }
     parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings);
-
-    // @todo Inject this once https://drupal.org/node/2035317 is in.
-    $this->dateStorage = \Drupal::entityManager()->getStorageController('date_format');
   }
 
   /**
@@ -84,7 +74,7 @@ public function formElement(array $items, $delta, array $element, $langcode, arr
       case 'date':
         $date_type = 'date';
         $time_type = 'none';
-        $date_format = $this->dateStorage->load('html_date')->getPattern($format_type);
+        $date_format = config('system.date')->get('formats.html_date.pattern.' . $format_type);
         $time_format = '';
         $element_format = $date_format;
         $storage_format = DATETIME_DATE_STORAGE_FORMAT;
@@ -93,8 +83,8 @@ public function formElement(array $items, $delta, array $element, $langcode, arr
       default:
         $date_type = 'date';
         $time_type = 'time';
-        $date_format = $this->dateStorage->load('html_date')->getPattern($format_type);
-        $time_format = $this->dateStorage->load('html_time')->getPattern($format_type);
+        $date_format = config('system.date')->get('formats.html_date.pattern.' . $format_type);
+        $time_format = config('system.date')->get('formats.html_time.pattern.' . $format_type);
         $element_format = $date_format . ' ' . $time_format;
         $storage_format = DATETIME_DATETIME_STORAGE_FORMAT;
         break;
diff --git a/core/modules/datetime/lib/Drupal/datetime/Tests/DatetimeFieldTest.php b/core/modules/datetime/lib/Drupal/datetime/Tests/DatetimeFieldTest.php
index af66e0d..a0538d7 100644
--- a/core/modules/datetime/lib/Drupal/datetime/Tests/DatetimeFieldTest.php
+++ b/core/modules/datetime/lib/Drupal/datetime/Tests/DatetimeFieldTest.php
@@ -104,8 +104,8 @@ function testDateField() {
     $value = '2012-12-31 00:00:00';
     $date = new DrupalDateTime($value);
     $format_type = $date->canUseIntl() ? DrupalDateTime::INTL : DrupalDateTime::PHP;
-    $date_format = entity_load('date_format', 'html_date')->getPattern($format_type);
-    $time_format = entity_load('date_format', 'html_time')->getPattern($format_type);
+    $date_format = config('system.date')->get('formats.html_date.pattern.' . $format_type);
+    $time_format = config('system.date')->get('formats.html_time.pattern.' . $format_type);
 
     $edit = array(
       'user_id' => 1,
@@ -175,8 +175,8 @@ function testDatetimeField() {
     $value = '2012-12-31 00:00:00';
     $date = new DrupalDateTime($value);
     $format_type = $date->canUseIntl() ? DrupalDateTime::INTL : DrupalDateTime::PHP;
-    $date_format = entity_load('date_format', 'html_date')->getPattern($format_type);
-    $time_format = entity_load('date_format', 'html_time')->getPattern($format_type);
+    $date_format = config('system.date')->get('formats.html_date.pattern.' . $format_type);
+    $time_format = config('system.date')->get('formats.html_time.pattern.' . $format_type);
 
     $edit = array(
       'user_id' => 1,
diff --git a/core/modules/dblog/dblog.admin.inc b/core/modules/dblog/dblog.admin.inc
index d67712a..d3cc328 100644
--- a/core/modules/dblog/dblog.admin.inc
+++ b/core/modules/dblog/dblog.admin.inc
@@ -99,7 +99,7 @@ function dblog_event($id) {
     }
     $username = array(
       '#theme' => 'username',
-      '#account' => user_load($dblog->uid),
+      '#account' => $dblog,
     );
     $rows = array(
       array(
diff --git a/core/modules/dblog/lib/Drupal/dblog/Controller/DbLogController.php b/core/modules/dblog/lib/Drupal/dblog/Controller/DbLogController.php
index 3119a1b..f416c41 100644
--- a/core/modules/dblog/lib/Drupal/dblog/Controller/DbLogController.php
+++ b/core/modules/dblog/lib/Drupal/dblog/Controller/DbLogController.php
@@ -124,6 +124,7 @@ public function overview() {
     $query = $this->database->select('watchdog', 'w')
       ->extend('Drupal\Core\Database\Query\PagerSelectExtender')
       ->extend('Drupal\Core\Database\Query\TableSortExtender');
+    $query->leftJoin('users', 'u', 'w.uid = u.uid');
     $query->fields('w', array(
       'wid',
       'uid',
@@ -133,7 +134,8 @@ public function overview() {
       'message',
       'variables',
       'link',
-    ));
+      ));
+    $query->addField('u', 'name');
 
     if (!empty($filter['where'])) {
       $query->where($filter['where'], $filter['args']);
@@ -162,7 +164,7 @@ public function overview() {
       }
       $username = array(
         '#theme' => 'username',
-        '#account' => user_load($dblog->uid),
+        '#account' => $dblog,
       );
       $rows[] = array(
         'data' => array(
diff --git a/core/modules/dblog/lib/Drupal/dblog/Tests/DbLogTest.php b/core/modules/dblog/lib/Drupal/dblog/Tests/DbLogTest.php
index 5e3f663..e619fff 100644
--- a/core/modules/dblog/lib/Drupal/dblog/Tests/DbLogTest.php
+++ b/core/modules/dblog/lib/Drupal/dblog/Tests/DbLogTest.php
@@ -136,7 +136,7 @@ private function generateLogEntries($count, $type = 'custom', $severity = WATCHD
       'severity'    => $severity,
       'link'        => NULL,
       'user'        => $this->big_user,
-      'uid'         => $this->big_user->id(),
+      'uid'         => isset($this->big_user->uid) ? $this->big_user->uid : 0,
       'request_uri' => $base_root . request_uri(),
       'referer'     => $_SERVER['HTTP_REFERER'],
       'ip'          => '127.0.0.1',
@@ -238,7 +238,7 @@ private function doUser() {
     // Logout user.
     $this->drupalLogout();
     // Fetch the row IDs in watchdog that relate to the user.
-    $result = db_query('SELECT wid FROM {watchdog} WHERE uid = :uid', array(':uid' => $user->id()));
+    $result = db_query('SELECT wid FROM {watchdog} WHERE uid = :uid', array(':uid' => $user->uid));
     foreach ($result as $row) {
       $ids[] = $row->wid;
     }
@@ -249,7 +249,7 @@ private function doUser() {
     $this->drupalLogin($this->big_user);
     // Delete the user created at the start of this test.
     // We need to POST here to invoke batch_process() in the internal browser.
-    $this->drupalPost('user/' . $user->id() . '/cancel', array('user_cancel_method' => 'user_cancel_reassign'), t('Cancel account'));
+    $this->drupalPost('user/' . $user->uid . '/cancel', array('user_cancel_method' => 'user_cancel_reassign'), t('Cancel account'));
 
     // View the database log report.
     $this->drupalGet('admin/reports/dblog');
@@ -423,7 +423,7 @@ protected function testDBLogAddAndClear() {
       'severity'    => WATCHDOG_NOTICE,
       'link'        => NULL,
       'user'        => $this->big_user,
-      'uid'         => $this->big_user->id(),
+      'uid'         => isset($this->big_user->uid) ? $this->big_user->uid : 0,
       'request_uri' => $base_root . request_uri(),
       'referer'     => $_SERVER['HTTP_REFERER'],
       'ip'          => '127.0.0.1',
diff --git a/core/modules/edit/lib/Drupal/edit/Access/EditEntityAccessCheck.php b/core/modules/edit/lib/Drupal/edit/Access/EditEntityAccessCheck.php
index 495c234..9dfbfd1 100644
--- a/core/modules/edit/lib/Drupal/edit/Access/EditEntityAccessCheck.php
+++ b/core/modules/edit/lib/Drupal/edit/Access/EditEntityAccessCheck.php
@@ -7,7 +7,7 @@
 
 namespace Drupal\edit\Access;
 
-use Drupal\Core\Access\StaticAccessCheckInterface;
+use Drupal\Core\Access\AccessCheckInterface;
 use Symfony\Component\Routing\Route;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
@@ -16,14 +16,14 @@
 /**
  * Access check for editing entities.
  */
-class EditEntityAccessCheck implements StaticAccessCheckInterface, EditEntityAccessCheckInterface {
+class EditEntityAccessCheck implements AccessCheckInterface, EditEntityAccessCheckInterface {
 
   /**
    * {@inheritdoc}
    */
-  public function appliesTo() {
+  public function applies(Route $route) {
     // @see edit.routing.yml
-    return array('_access_edit_entity');
+    return array_key_exists('_access_edit_entity', $route->getRequirements());
   }
 
   /**
diff --git a/core/modules/edit/lib/Drupal/edit/Access/EditEntityFieldAccessCheck.php b/core/modules/edit/lib/Drupal/edit/Access/EditEntityFieldAccessCheck.php
index 9ec569a..46b62ff 100644
--- a/core/modules/edit/lib/Drupal/edit/Access/EditEntityFieldAccessCheck.php
+++ b/core/modules/edit/lib/Drupal/edit/Access/EditEntityFieldAccessCheck.php
@@ -7,7 +7,7 @@
 
 namespace Drupal\edit\Access;
 
-use Drupal\Core\Access\StaticAccessCheckInterface;
+use Drupal\Core\Access\AccessCheckInterface;
 use Symfony\Component\Routing\Route;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
@@ -16,13 +16,14 @@
 /**
  * Access check for editing entity fields.
  */
-class EditEntityFieldAccessCheck implements StaticAccessCheckInterface, EditEntityFieldAccessCheckInterface {
+class EditEntityFieldAccessCheck implements AccessCheckInterface, EditEntityFieldAccessCheckInterface {
 
   /**
-   * {@inheritdoc}
+   * Implements AccessCheckInterface::applies().
    */
-  public function appliesTo() {
-    return array('_access_edit_entity_field');
+  public function applies(Route $route) {
+    // @see edit.routing.yml
+    return array_key_exists('_access_edit_entity_field', $route->getRequirements());
   }
 
   /**
diff --git a/core/modules/edit/lib/Drupal/edit/EditPluginInterface.php b/core/modules/edit/lib/Drupal/edit/EditPluginInterface.php
index 1dcc642..a568278 100644
--- a/core/modules/edit/lib/Drupal/edit/EditPluginInterface.php
+++ b/core/modules/edit/lib/Drupal/edit/EditPluginInterface.php
@@ -8,7 +8,7 @@
 namespace Drupal\edit;
 
 use Drupal\Component\Plugin\PluginInspectionInterface;
-use Drupal\Core\Entity\Field\FieldDefinitionInterface;
+use Drupal\field\Plugin\Core\Entity\FieldInstance;
 
 /**
  * Defines an interface for in-place editors (Create.js PropertyEditor widgets).
@@ -21,15 +21,15 @@
   /**
    * Checks whether this editor is compatible with a given field instance.
    *
-   * @param \Drupal\Core\Entity\Field\FieldDefinitionInterface $field_definition
-   *   The field definition of the field being edited.
+   * @param \Drupal\field\Plugin\Core\Entity\FieldInstance $instance
+   *   The field instance of the field being edited.
    * @param array $items
    *   The field's item values.
    *
    * @return bool
    *   TRUE if it is compatible, FALSE otherwise.
    */
-  public function isCompatible(FieldDefinitionInterface $field_definition, array $items);
+  public function isCompatible(FieldInstance $instance, array $items);
 
   /**
    * Generates metadata that is needed specifically for this editor.
@@ -37,8 +37,8 @@ public function isCompatible(FieldDefinitionInterface $field_definition, array $
    * Will only be called by \Drupal\edit\MetadataGeneratorInterface::generate()
    * when the passed in field instance & item values will use this editor.
    *
-   * @param \Drupal\Core\Entity\Field\FieldDefinitionInterface $field_definition
-   *   The field definition of the field being edited.
+   * @param \Drupal\field\Plugin\Core\Entity\FieldInstance $instance
+   *   The field instance of the field being edited.
    * @param array $items
    *   The field's item values.
    *
@@ -46,7 +46,7 @@ public function isCompatible(FieldDefinitionInterface $field_definition, array $
    *   A keyed array with metadata. Each key should be prefixed with the plugin
    *   ID of the editor.
    */
-  public function getMetadata(FieldDefinitionInterface $field_definition, array $items);
+  public function getMetadata(FieldInstance $instance, array $items);
 
   /**
    * Returns the attachments for this editor.
diff --git a/core/modules/edit/lib/Drupal/edit/EditorBase.php b/core/modules/edit/lib/Drupal/edit/EditorBase.php
index 10b2f02..39abaee 100644
--- a/core/modules/edit/lib/Drupal/edit/EditorBase.php
+++ b/core/modules/edit/lib/Drupal/edit/EditorBase.php
@@ -9,7 +9,7 @@
 
 use Drupal\Component\Plugin\PluginBase;
 use Drupal\edit\EditPluginInterface;
-use Drupal\Core\Entity\Field\FieldDefinitionInterface;
+use Drupal\field\Plugin\Core\Entity\FieldInstance;
 
 /**
  * Defines a base editor implementation.
@@ -17,9 +17,9 @@
 abstract class EditorBase extends PluginBase implements EditPluginInterface {
 
   /**
-   * {@inheritdoc}
+   * Implements \Drupal\edit\EditPluginInterface::getMetadata().
    */
-  function getMetadata(FieldDefinitionInterface $field_definition, array $items) {
+  function getMetadata(FieldInstance $instance, array $items) {
     return array();
   }
 
diff --git a/core/modules/edit/lib/Drupal/edit/EditorSelector.php b/core/modules/edit/lib/Drupal/edit/EditorSelector.php
index 2636f38..232a52f 100644
--- a/core/modules/edit/lib/Drupal/edit/EditorSelector.php
+++ b/core/modules/edit/lib/Drupal/edit/EditorSelector.php
@@ -9,7 +9,7 @@
 
 use Drupal\Component\Plugin\PluginManagerInterface;
 use Drupal\Component\Utility\NestedArray;
-use Drupal\Core\Entity\Field\FieldDefinitionInterface;
+use Drupal\field\Plugin\Core\Entity\FieldInstance;
 
 /**
  * Selects an in-place editor (an Editor plugin) for a field.
@@ -43,7 +43,7 @@ public function __construct(PluginManagerInterface $editor_manager) {
   /**
    * {@inheritdoc}
    */
-  public function getEditor($formatter_type, FieldDefinitionInterface $field_definition, array $items) {
+  public function getEditor($formatter_type, FieldInstance $instance, array $items) {
     // Build a static cache of the editors that have registered themselves as
     // alternatives to a certain editor.
     if (!isset($this->alternatives)) {
@@ -80,7 +80,7 @@ public function getEditor($formatter_type, FieldDefinitionInterface $field_defin
     // Make a choice.
     foreach ($editor_choices as $editor_id) {
       $editor = $this->editorManager->createInstance($editor_id);
-      if ($editor->isCompatible($field_definition, $items)) {
+      if ($editor->isCompatible($instance, $items)) {
         return $editor_id;
       }
     }
diff --git a/core/modules/edit/lib/Drupal/edit/EditorSelectorInterface.php b/core/modules/edit/lib/Drupal/edit/EditorSelectorInterface.php
index d36083a..990c207 100644
--- a/core/modules/edit/lib/Drupal/edit/EditorSelectorInterface.php
+++ b/core/modules/edit/lib/Drupal/edit/EditorSelectorInterface.php
@@ -7,7 +7,7 @@
 
 namespace Drupal\edit;
 
-use Drupal\Core\Entity\Field\FieldDefinitionInterface;
+use Drupal\field\Plugin\Core\Entity\FieldInstance;
 
 /**
  * Interface for selecting an in-place editor (an Editor plugin) for a field.
@@ -19,15 +19,15 @@
    *
    * @param string $formatter_type
    *   The field's formatter type name.
-   * @param \Drupal\Core\Entity\Field\FieldDefinitionInterface $field_definition
-   *   The field definition.
+   * @param \Drupal\field\Plugin\Core\Entity\FieldInstance $instance
+   *   The field's instance info.
    * @param array $items
    *   The field's item values.
    *
    * @return string|NULL
    *   The editor to use, or NULL to not enable in-place editing.
    */
-  public function getEditor($formatter_type, FieldDefinitionInterface $instance, array $items);
+  public function getEditor($formatter_type, FieldInstance $instance, array $items);
 
   /**
    * Returns the attachments for all editors.
diff --git a/core/modules/edit/lib/Drupal/edit/MetadataGenerator.php b/core/modules/edit/lib/Drupal/edit/MetadataGenerator.php
index 74d13f9..8347c00 100644
--- a/core/modules/edit/lib/Drupal/edit/MetadataGenerator.php
+++ b/core/modules/edit/lib/Drupal/edit/MetadataGenerator.php
@@ -9,9 +9,9 @@
 
 use Drupal\Core\Entity\EntityInterface;
 use Drupal\Component\Plugin\PluginManagerInterface;
-use Drupal\Core\Entity\Field\FieldDefinitionInterface;
+use Drupal\field\Plugin\Core\Entity\FieldInstance;
 use Drupal\edit\Access\EditEntityFieldAccessCheckInterface;
-use Drupal\field\FieldInstanceInterface;
+
 
 /**
  * Generates in-place editing metadata for an entity field.
@@ -67,8 +67,8 @@ public function generateEntity(EntityInterface $entity, $langcode) {
   /**
    * {@inheritdoc}
    */
-  public function generateField(EntityInterface $entity, FieldDefinitionInterface $field_definition, $langcode, $view_mode) {
-    $field_name = $field_definition->getFieldName();
+  public function generateField(EntityInterface $entity, FieldInstance $instance, $langcode, $view_mode) {
+    $field_name = $instance['field_name'];
 
     // Early-return if user does not have access.
     $access = $this->accessChecker->accessEditEntityField($entity, $field_name);
@@ -77,15 +77,15 @@ public function generateField(EntityInterface $entity, FieldDefinitionInterface
     }
 
     // Early-return if no editor is available.
-    $formatter_id = entity_get_render_display($entity, $view_mode)->getRenderer($field_name)->getPluginId();
+    $formatter_id = entity_get_render_display($entity, $view_mode)->getRenderer($instance['field_name'])->getPluginId();
     $items = $entity->getTranslation($langcode)->get($field_name)->getValue();
-    $editor_id = $this->editorSelector->getEditor($formatter_id, $field_definition, $items);
+    $editor_id = $this->editorSelector->getEditor($formatter_id, $instance, $items);
     if (!isset($editor_id)) {
       return array('access' => FALSE);
     }
 
     // Gather metadata, allow the editor to add additional metadata of its own.
-    $label = $field_definition->getFieldLabel();
+    $label = $instance['label'];
     $editor = $this->editorManager->createInstance($editor_id);
     $metadata = array(
       'label' => check_plain($label),
@@ -93,7 +93,7 @@ public function generateField(EntityInterface $entity, FieldDefinitionInterface
       'editor' => $editor_id,
       'aria' => t('Entity @type @id, field @field', array('@type' => $entity->entityType(), '@id' => $entity->id(), '@field' => $label)),
     );
-    $custom_metadata = $editor->getMetadata($field_definition, $items);
+    $custom_metadata = $editor->getMetadata($instance, $items);
     if (count($custom_metadata)) {
       $metadata['custom'] = $custom_metadata;
     }
diff --git a/core/modules/edit/lib/Drupal/edit/MetadataGeneratorInterface.php b/core/modules/edit/lib/Drupal/edit/MetadataGeneratorInterface.php
index 3566cf8..7baaf5b 100644
--- a/core/modules/edit/lib/Drupal/edit/MetadataGeneratorInterface.php
+++ b/core/modules/edit/lib/Drupal/edit/MetadataGeneratorInterface.php
@@ -8,7 +8,7 @@
 namespace Drupal\edit;
 
 use Drupal\Core\Entity\EntityInterface;
-use Drupal\Core\Entity\Field\FieldDefinitionInterface;
+use Drupal\field\Plugin\Core\Entity\FieldInstance;
 
 /**
  * Interface for generating in-place editing metadata.
@@ -33,8 +33,8 @@ public function generateEntity(EntityInterface $entity, $langcode);
    *
    * @param \Drupal\Core\Entity\EntityInterface $entity
    *   The entity being edited.
-   * @param \Drupal\Core\Entity\Field\FieldDefinitionInterface $field_definition
-   *   The field definition of the field being edited.
+   * @param \Drupal\field\Plugin\Core\Entity\FieldInstance $instance
+   *   The field instance of the field being edited.
    * @param string $langcode
    *   The name of the language for which the field is being edited.
    * @param string $view_mode
@@ -47,6 +47,6 @@ public function generateEntity(EntityInterface $entity, $langcode);
    *   - aria: the ARIA label.
    *   - custom: (optional) any additional metadata that the editor provides.
    */
-  public function generateField(EntityInterface $entity, FieldDefinitionInterface $field_definition, $langcode, $view_mode);
+  public function generateField(EntityInterface $entity, FieldInstance $instance, $langcode, $view_mode);
 
 }
diff --git a/core/modules/edit/lib/Drupal/edit/Plugin/InPlaceEditor/DirectEditor.php b/core/modules/edit/lib/Drupal/edit/Plugin/InPlaceEditor/DirectEditor.php
index 6a8f16b..39176d1 100644
--- a/core/modules/edit/lib/Drupal/edit/Plugin/InPlaceEditor/DirectEditor.php
+++ b/core/modules/edit/lib/Drupal/edit/Plugin/InPlaceEditor/DirectEditor.php
@@ -9,7 +9,7 @@
 
 use Drupal\edit\EditorBase;
 use Drupal\edit\Annotation\InPlaceEditor;
-use Drupal\Core\Entity\Field\FieldDefinitionInterface;
+use Drupal\field\Plugin\Core\Entity\FieldInstance;
 
 /**
  * Defines the direct editor.
@@ -21,18 +21,20 @@
 class DirectEditor extends EditorBase {
 
   /**
-   * {@inheritdoc}
+   * Implements \Drupal\edit\EditPluginInterface::isCompatible().
    *
    * @todo The processed text logic is too coupled to text fields. Figure out
    *   how to generalize to other textual field types.
    */
-  function isCompatible(FieldDefinitionInterface $field_definition, array $items) {
+  function isCompatible(FieldInstance $instance, array $items) {
+    $field = field_info_field($instance['field_name']);
+
     // This editor is incompatible with multivalued fields.
-    if ($field_definition->getFieldCardinality() != 1) {
+    if ($field['cardinality'] != 1) {
       return FALSE;
     }
     // This editor is incompatible with processed ("rich") text fields.
-    elseif ($field_definition->getFieldSetting('text_processing')) {
+    elseif (!empty($instance['settings']['text_processing'])) {
       return FALSE;
     }
     else {
diff --git a/core/modules/edit/lib/Drupal/edit/Plugin/InPlaceEditor/FormEditor.php b/core/modules/edit/lib/Drupal/edit/Plugin/InPlaceEditor/FormEditor.php
index 4c71db2..ec8d406 100644
--- a/core/modules/edit/lib/Drupal/edit/Plugin/InPlaceEditor/FormEditor.php
+++ b/core/modules/edit/lib/Drupal/edit/Plugin/InPlaceEditor/FormEditor.php
@@ -9,7 +9,7 @@
 
 use Drupal\edit\EditorBase;
 use Drupal\edit\Annotation\InPlaceEditor;
-use Drupal\Core\Entity\Field\FieldDefinitionInterface;
+use Drupal\field\Plugin\Core\Entity\FieldInstance;
 
 /**
  * Defines the form editor.
@@ -21,9 +21,9 @@
 class FormEditor extends EditorBase {
 
   /**
-   * {@inheritdoc}
+   * Implements \Drupal\edit\EditPluginInterface::isCompatible().
    */
-  function isCompatible(FieldDefinitionInterface $field_definition, array $items) {
+  function isCompatible(FieldInstance $instance, array $items) {
     return TRUE;
   }
 
diff --git a/core/modules/edit/tests/modules/lib/Drupal/edit_test/Plugin/InPlaceEditor/WysiwygEditor.php b/core/modules/edit/tests/modules/lib/Drupal/edit_test/Plugin/InPlaceEditor/WysiwygEditor.php
index 61be894..59fe895 100644
--- a/core/modules/edit/tests/modules/lib/Drupal/edit_test/Plugin/InPlaceEditor/WysiwygEditor.php
+++ b/core/modules/edit/tests/modules/lib/Drupal/edit_test/Plugin/InPlaceEditor/WysiwygEditor.php
@@ -9,7 +9,7 @@
 
 use Drupal\edit\EditorBase;
 use Drupal\edit\Annotation\InPlaceEditor;
-use Drupal\Core\Entity\Field\FieldDefinitionInterface;
+use Drupal\field\Plugin\Core\Entity\FieldInstance;
 
 /**
  * Defines the wysiwyg editor.
@@ -22,17 +22,19 @@
 class WysiwygEditor extends EditorBase {
 
   /**
-   * {@inheritdoc}
+   * Implements \Drupal\edit\EditPluginInterface::isCompatible().
    */
-  function isCompatible(FieldDefinitionInterface $field_definition, array $items) {
+  function isCompatible(FieldInstance $instance, array $items) {
+    $field = field_info_field($instance['field_name']);
+
     // This editor is incompatible with multivalued fields.
-    if ($field_definition->getFieldCardinality() != 1) {
+    if ($field['cardinality'] != 1) {
       return FALSE;
     }
     // This editor is compatible with processed ("rich") text fields; but only
     // if there is a currently active text format and that text format is the
     // 'full_html' text format.
-    elseif ($field_definition->getFieldSetting('text_processing')) {
+    elseif (!empty($instance['settings']['text_processing'])) {
       $format_id = $items[0]['format'];
       if (isset($format_id) && $format_id === 'full_html') {
         return TRUE;
@@ -42,9 +44,9 @@ function isCompatible(FieldDefinitionInterface $field_definition, array $items)
   }
 
   /**
-   * {@inheritdoc}
+   * Implements \Drupal\edit\EditPluginInterface::getMetadata().
    */
-  function getMetadata(FieldDefinitionInterface $field_definition, array $items) {
+  function getMetadata(FieldInstance $instance, array $items) {
     $format_id = $items[0]['format'];
     $metadata['format'] = $format_id;
     return $metadata;
diff --git a/core/modules/editor/editor.info.yml b/core/modules/editor/editor.info.yml
index b8e4820..6286660 100644
--- a/core/modules/editor/editor.info.yml
+++ b/core/modules/editor/editor.info.yml
@@ -1,6 +1,6 @@
 name: 'Text Editor'
 type: module
-description: 'Provides a means to associate text formats with text editor libraries such as WYSIWYGs or toolbars.'
+description: 'Allows to associate text formats with text editor libraries such as WYSIWYGs or toolbars.'
 package: Core
 version: VERSION
 core: 8.x
diff --git a/core/modules/editor/editor.routing.yml b/core/modules/editor/editor.routing.yml
index 26aa16c..f4ae496 100644
--- a/core/modules/editor/editor.routing.yml
+++ b/core/modules/editor/editor.routing.yml
@@ -1,5 +1,5 @@
 editor_field_untransformed_text:
-  pattern: '/editor/{entity_type}/{entity}/{field_name}/{langcode}/{view_mode_id}'
+  pattern: '/editor/{entity_type}/{entity}/{field_name}/{langcode}/{view_mode}'
   defaults:
     _controller: '\Drupal\editor\EditorController::getUntransformedText'
   requirements:
diff --git a/core/modules/editor/js/editor.js b/core/modules/editor/js/editor.js
index 5893e11..9bbce1d 100644
--- a/core/modules/editor/js/editor.js
+++ b/core/modules/editor/js/editor.js
@@ -106,14 +106,7 @@ Drupal.editorAttach = function (field, format) {
       field.removeAttribute('required');
     }
 
-    // Attach the text editor.
     Drupal.editors[format.editor].attach(field, format);
-
-    // Ensures form.js' 'formUpdated' event is triggered even for changes that
-    // happen within the text editor.
-    Drupal.editors[format.editor].onChange(field, function () {
-      $(field).trigger('formUpdated');
-    });
   }
 };
 
diff --git a/core/modules/editor/lib/Drupal/editor/EditorController.php b/core/modules/editor/lib/Drupal/editor/EditorController.php
index e53a4c2..6be24b6 100644
--- a/core/modules/editor/lib/Drupal/editor/EditorController.php
+++ b/core/modules/editor/lib/Drupal/editor/EditorController.php
@@ -32,13 +32,13 @@ class EditorController extends ContainerAware {
    * @param string $langcode
    *   The name of the language for which the processed text field is being
    *   rererendered.
-   * @param string $view_mode_id
+   * @param string $view_mode
    *   The view mode the processed text field should be rerendered in.
    *
    * @return \Drupal\Core\Ajax\AjaxResponse
    *   The Ajax response.
    */
-  public function getUntransformedText(EntityInterface $entity, $field_name, $langcode, $view_mode_id) {
+  public function getUntransformedText(EntityInterface $entity, $field_name, $langcode, $view_mode) {
     $response = new AjaxResponse();
 
     // Direct text editing is only supported for single-valued fields.
diff --git a/core/modules/editor/lib/Drupal/editor/Plugin/InPlaceEditor/Editor.php b/core/modules/editor/lib/Drupal/editor/Plugin/InPlaceEditor/Editor.php
index 1a4981a..7c281c0 100644
--- a/core/modules/editor/lib/Drupal/editor/Plugin/InPlaceEditor/Editor.php
+++ b/core/modules/editor/lib/Drupal/editor/Plugin/InPlaceEditor/Editor.php
@@ -11,7 +11,7 @@
 use Drupal\edit\Annotation\InPlaceEditor;
 use Drupal\Core\Annotation\Translation;
 use Drupal\edit\EditPluginInterface;
-use Drupal\Core\Entity\Field\FieldDefinitionInterface;
+use Drupal\field\Plugin\Core\Entity\FieldInstance;
 
 /**
  * Defines the formatted text editor.
@@ -24,17 +24,19 @@
 class Editor extends PluginBase implements EditPluginInterface {
 
   /**
-   * {@inheritdoc}
+   * Implements \Drupal\edit\Plugin\EditPluginInterface::isCompatible().
    */
-  function isCompatible(FieldDefinitionInterface $field_definition, array $items) {
+  function isCompatible(FieldInstance $instance, array $items) {
+    $field = field_info_field($instance['field_name']);
+
     // This editor is incompatible with multivalued fields.
-    if ($field_definition->getFieldCardinality() != 1) {
+    if ($field['cardinality'] != 1) {
       return FALSE;
     }
     // This editor is compatible with processed ("rich") text fields; but only
     // if there is a currently active text format, that text format has an
     // associated editor and that editor supports inline editing.
-    elseif ($field_definition->getFieldSetting('text_processing')) {
+    elseif (!empty($instance['settings']['text_processing'])) {
       $format_id = $items[0]['format'];
       if (isset($format_id) && $editor = editor_load($format_id)) {
         $definition = \Drupal::service('plugin.manager.editor')->getDefinition($editor->editor);
@@ -48,9 +50,9 @@ function isCompatible(FieldDefinitionInterface $field_definition, array $items)
   }
 
   /**
-   * {@inheritdoc}
+   * Implements \Drupal\edit\Plugin\EditPluginInterface::getMetadata().
    */
-  function getMetadata(FieldDefinitionInterface $field_definition, array $items) {
+  function getMetadata(FieldInstance $instance, array $items) {
     $format_id = $items[0]['format'];
     $metadata['format'] = $format_id;
     $metadata['formatHasTransformations'] = $this->textFormatHasTransformationFilters($format_id);
diff --git a/core/modules/entity/entity.module b/core/modules/entity/entity.module
index a88a10a..ad9d17b 100644
--- a/core/modules/entity/entity.module
+++ b/core/modules/entity/entity.module
@@ -11,102 +11,6 @@
 use Drupal\Core\Config\Entity\ConfigStorageController;
 
 /**
- * Implements hook_permission().
- */
-function entity_permission() {
-  return array(
-    'administer display modes' => array(
-      'title' => t('Add, edit, and delete custom display modes.'),
-    ),
-  );
-}
-
-/**
- * Implements hook_menu().
- */
-function entity_menu() {
-  $items = array();
-
-  $items['admin/structure/display-modes'] = array(
-    'title' => 'Display modes',
-    'description' => 'Configure what displays are available for your content and forms.',
-    'page callback' => 'system_admin_menu_block_page',
-    'access arguments' => array('administer display modes'),
-    'file' => 'system.admin.inc',
-    'file path' => drupal_get_path('module', 'system'),
-  );
-
-  // View modes.
-  $items['admin/structure/display-modes/view'] = array(
-    'title' => 'View modes',
-    'description' => 'Manage custom view modes.',
-    'route_name' => 'entity_view_mode.list',
-  );
-  $items['admin/structure/display-modes/view/list'] = array(
-    'title' => 'List',
-    'type' => MENU_DEFAULT_LOCAL_TASK,
-  );
-  $items['admin/structure/display-modes/view/add'] = array(
-    'title' => 'Add view mode',
-    'route_name' => 'entity_view_mode.add',
-    'type' => MENU_SIBLING_LOCAL_TASK,
-  );
-  $items['admin/structure/display-modes/view/add/%'] = array(
-    'route_name' => 'entity_view_mode.add_type',
-  );
-  $items['admin/structure/display-modes/view/manage/%'] = array(
-    'title' => 'Edit view mode',
-    'route_name' => 'entity_view_mode.edit',
-  );
-  $items['admin/structure/display-modes/view/manage/%/delete'] = array(
-    'route_name' => 'entity_view_mode.delete',
-  );
-
-  // Form modes.
-  $items['admin/structure/display-modes/form'] = array(
-    'title' => 'Form modes',
-    'description' => 'Manage custom form modes.',
-    'route_name' => 'entity_form_mode.list',
-  );
-  $items['admin/structure/display-modes/form/list'] = array(
-    'title' => 'List',
-    'type' => MENU_DEFAULT_LOCAL_TASK,
-  );
-  $items['admin/structure/display-modes/form/add'] = array(
-    'title' => 'Add form mode',
-    'route_name' => 'entity_form_mode.add',
-    'type' => MENU_SIBLING_LOCAL_TASK,
-  );
-  $items['admin/structure/display-modes/form/add/%'] = array(
-    'route_name' => 'entity_form_mode.add_type',
-  );
-  $items['admin/structure/display-modes/form/manage/%'] = array(
-    'title' => 'Edit form mode',
-    'route_name' => 'entity_form_mode.edit',
-  );
-  $items['admin/structure/display-modes/form/manage/%/delete'] = array(
-    'route_name' => 'entity_form_mode.delete',
-  );
-
-  return $items;
-}
-
-/**
- * Implements hook_local_actions().
- */
-function entity_local_actions() {
-  return array(
-    array(
-      'route_name' => 'entity_view_mode.add',
-      'title' => t('Add view mode'),
-      'appears_on' => array(
-        'entity_view_mode.list',
-      ),
-    ),
-  );
-}
-
-/**
  * Implements hook_entity_bundle_rename().
  */
 function entity_entity_bundle_rename($entity_type, $bundle_old, $bundle_new) {
diff --git a/core/modules/entity/entity.routing.yml b/core/modules/entity/entity.routing.yml
deleted file mode 100644
index 05d7092..0000000
--- a/core/modules/entity/entity.routing.yml
+++ /dev/null
@@ -1,69 +0,0 @@
-entity_view_mode.list:
-  pattern: '/admin/structure/display-modes/view'
-  defaults:
-    _entity_list: 'view_mode'
-  requirements:
-    _permission: 'administer display modes'
-
-entity_view_mode.add:
-  pattern: '/admin/structure/display-modes/view/add'
-  defaults:
-    _content: '\Drupal\entity\Controller\EntityDisplayModeController::viewModeTypeSelection'
-  requirements:
-    _permission: 'administer display modes'
-
-entity_view_mode.add_type:
-  pattern: '/admin/structure/display-modes/view/add/{entity_type}'
-  defaults:
-    _entity_form: 'view_mode.add'
-  requirements:
-    _permission: 'administer display modes'
-
-entity_view_mode.edit:
-  pattern: '/admin/structure/display-modes/view/manage/{view_mode}'
-  defaults:
-    _entity_form: 'view_mode.edit'
-  requirements:
-    _entity_access: 'view_mode.update'
-
-entity_view_mode.delete:
-  pattern: '/admin/structure/display-modes/view/manage/{view_mode}/delete'
-  defaults:
-    _entity_form: 'view_mode.delete'
-  requirements:
-    _entity_access: 'view_mode.delete'
-
-entity_form_mode.list:
-  pattern: '/admin/structure/display-modes/form'
-  defaults:
-    _entity_list: 'form_mode'
-  requirements:
-    _permission: 'administer display modes'
-
-entity_form_mode.add:
-  pattern: '/admin/structure/display-modes/form/add'
-  defaults:
-    _content: '\Drupal\entity\Controller\EntityDisplayModeController::formModeTypeSelection'
-  requirements:
-    _permission: 'administer display modes'
-
-entity_form_mode.add_type:
-  pattern: '/admin/structure/display-modes/form/add/{entity_type}'
-  defaults:
-    _entity_form: 'form_mode.add'
-  requirements:
-    _permission: 'administer display modes'
-
-entity_form_mode.edit:
-  pattern: '/admin/structure/display-modes/form/manage/{form_mode}'
-  defaults:
-    _entity_form: 'form_mode.edit'
-  requirements:
-    _entity_access: 'form_mode.update'
-
-entity_form_mode.delete:
-  pattern: '/admin/structure/display-modes/form/manage/{form_mode}/delete'
-  defaults:
-    _entity_form: 'form_mode.delete'
-  requirements:
-    _entity_access: 'form_mode.delete'
diff --git a/core/modules/entity/lib/Drupal/entity/Controller/EntityDisplayModeController.php b/core/modules/entity/lib/Drupal/entity/Controller/EntityDisplayModeController.php
deleted file mode 100644
index 81a684f..0000000
--- a/core/modules/entity/lib/Drupal/entity/Controller/EntityDisplayModeController.php
+++ /dev/null
@@ -1,93 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\entity\Controller\EntityDisplayModeController.
- */
-
-namespace Drupal\entity\Controller;
-
-use Drupal\Component\Plugin\PluginManagerInterface;
-use Drupal\Core\Controller\ControllerInterface;
-use Symfony\Component\DependencyInjection\ContainerInterface;
-
-/**
- * Provides methods for entity display mode routes.
- */
-class EntityDisplayModeController implements ControllerInterface {
-
-  /**
-   * The entity manager.
-   *
-   * @var \Drupal\Component\Plugin\PluginManagerInterface
-   */
-  protected $entityManager;
-
-  /**
-   * Constructs a new EntityDisplayModeFormBase.
-   *
-   * @param \Drupal\Component\Plugin\PluginManagerInterface $entity_manager
-   *   The entity manager.
-   */
-  public function __construct(PluginManagerInterface $entity_manager) {
-    $this->entityManager = $entity_manager;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function create(ContainerInterface $container) {
-    return new static(
-      $container->get('plugin.manager.entity')
-    );
-  }
-
-  /**
-   * Provides a list of eligible entity types for adding view modes.
-   *
-   * @return array
-   *   A list of entity types to add a view mode for.
-   */
-  public function viewModeTypeSelection() {
-    drupal_set_title(t('Choose view mode entity type'));
-    $entity_types = array();
-    foreach ($this->entityManager->getDefinitions() as $entity_type => $entity_info) {
-      if ($entity_info['fieldable'] && isset($entity_info['controllers']['render'])) {
-        $entity_types[$entity_type] = array(
-          'title' => $entity_info['label'],
-          'href' => 'admin/structure/display-modes/view/add/' . $entity_type,
-          'localized_options' => array(),
-        );
-      }
-    }
-    return array(
-      '#theme' => 'admin_block_content',
-      '#content' => $entity_types,
-    );
-  }
-
-  /**
-   * Provides a list of eligible entity types for adding form modes.
-   *
-   * @return array
-   *   A list of entity types to add a form mode for.
-   */
-  public function formModeTypeSelection() {
-    drupal_set_title(t('Choose form mode entity type'));
-    $entity_types = array();
-    foreach ($this->entityManager->getDefinitions() as $entity_type => $entity_info) {
-      if ($entity_info['fieldable'] && isset($entity_info['controllers']['form'])) {
-        $entity_types[$entity_type] = array(
-          'title' => $entity_info['label'],
-          'href' => 'admin/structure/display-modes/form/add/' . $entity_type,
-          'localized_options' => array(),
-        );
-      }
-    }
-    return array(
-      '#theme' => 'admin_block_content',
-      '#content' => $entity_types,
-    );
-  }
-
-}
diff --git a/core/modules/entity/lib/Drupal/entity/EntityDisplayModeAccessController.php b/core/modules/entity/lib/Drupal/entity/EntityDisplayModeAccessController.php
deleted file mode 100644
index 8c3e194..0000000
--- a/core/modules/entity/lib/Drupal/entity/EntityDisplayModeAccessController.php
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\entity\EntityDisplayModeAccessController.
- */
-
-namespace Drupal\entity;
-
-use Drupal\Core\Entity\EntityAccessController;
-use Drupal\Core\Entity\EntityInterface;
-use Drupal\Core\Session\AccountInterface;
-
-/**
- * Provides the access controller for entity display modes.
- */
-class EntityDisplayModeAccessController extends EntityAccessController {
-
-  /**
-   * {@inheritdoc}
-   */
-  protected function checkAccess(EntityInterface $entity, $operation, $langcode, AccountInterface $account) {
-    if ($operation === 'view') {
-      return TRUE;
-    }
-    elseif (in_array($operation, array('create', 'update', 'delete'))) {
-      return user_access('administer display modes', $account);
-    }
-  }
-
-}
diff --git a/core/modules/entity/lib/Drupal/entity/EntityDisplayModeBase.php b/core/modules/entity/lib/Drupal/entity/EntityDisplayModeBase.php
index 8fe73cb..4fe2c12 100644
--- a/core/modules/entity/lib/Drupal/entity/EntityDisplayModeBase.php
+++ b/core/modules/entity/lib/Drupal/entity/EntityDisplayModeBase.php
@@ -12,7 +12,7 @@
 /**
  * Base class for config entity types that hold settings for form and view modes.
  */
-abstract class EntityDisplayModeBase extends ConfigEntityBase implements EntityDisplayModeInterface {
+abstract class EntityDisplayModeBase extends ConfigEntityBase {
 
   /**
    * The ID of the form or view mode.
@@ -38,8 +38,8 @@
   /**
    * The entity type this form or view mode is used for.
    *
-   * This is not to be confused with EntityDisplayModeBase::$entityType which is
-   * inherited from Entity::$entityType.
+   * This is not to be confused with EntityViewMode::entityType which is
+   * inherited from Entity::entityType.
    *
    * @var string
    */
@@ -55,24 +55,6 @@
    *
    * @var bool
    */
-  public $status = TRUE;
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function sort($a, $b) {
-    // Sort by the type of entity the view mode is used for.
-    $a_type = $a->getTargetType();
-    $b_type = $b->getTargetType();
-    $type_order = strnatcasecmp($a_type, $b_type);
-    return $type_order != 0 ? $type_order : parent::sort($a, $b);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getTargetType() {
-    return $this->targetEntityType;
-  }
+  public $status = FALSE;
 
 }
diff --git a/core/modules/entity/lib/Drupal/entity/EntityDisplayModeInterface.php b/core/modules/entity/lib/Drupal/entity/EntityDisplayModeInterface.php
deleted file mode 100644
index 178df61..0000000
--- a/core/modules/entity/lib/Drupal/entity/EntityDisplayModeInterface.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\entity\EntityDisplayModeInterface.
- */
-
-namespace Drupal\entity;
-
-use Drupal\Core\Config\Entity\ConfigEntityInterface;
-
-/**
- * Provides an interface for entity types that hold form and view mode settings.
- */
-interface EntityDisplayModeInterface extends ConfigEntityInterface {
-
-  /**
-   * Returns the entity type this display mode is used for.
-   *
-   * @return string
-   *   The entity type name.
-   */
-  public function getTargetType();
-
-}
diff --git a/core/modules/entity/lib/Drupal/entity/EntityDisplayModeListController.php b/core/modules/entity/lib/Drupal/entity/EntityDisplayModeListController.php
deleted file mode 100644
index b0f8f6e..0000000
--- a/core/modules/entity/lib/Drupal/entity/EntityDisplayModeListController.php
+++ /dev/null
@@ -1,155 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\entity\EntityDisplayModeListController.
- */
-
-namespace Drupal\entity;
-
-use Drupal\Component\Utility\String;
-use Drupal\Core\Config\Entity\ConfigEntityListController;
-use Drupal\Core\Entity\EntityInterface;
-use Drupal\Core\Entity\EntityStorageControllerInterface;
-use Drupal\Core\Extension\ModuleHandlerInterface;
-use Symfony\Component\DependencyInjection\ContainerInterface;
-
-/**
- * Provides the listing for entity display modes.
- */
-class EntityDisplayModeListController extends ConfigEntityListController {
-
-  /**
-   * The entity info for all entity types.
-   *
-   * @var array
-   */
-  protected $entityInfoComplete;
-
-  /**
-   * Constructs a new EntityListController object.
-   *
-   * @param string $entity_type
-   *   The type of entity to be listed.
-   * @param array $entity_info
-   *   An array of entity info for the entity type.
-   * @param \Drupal\Core\Entity\EntityStorageControllerInterface $storage
-   *   The entity storage controller class.
-   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
-   *   The module handler to invoke hooks on.
-   * @param array $entity_info_complete
-   *   The entity info for all entity types.
-   */
-  public function __construct($entity_type, array $entity_info, EntityStorageControllerInterface $storage, ModuleHandlerInterface $module_handler, array $entity_info_complete) {
-    parent::__construct($entity_type, $entity_info, $storage, $module_handler);
-
-    $this->entityInfoComplete = $entity_info_complete;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function createInstance(ContainerInterface $container, $entity_type, array $entity_info) {
-    $entity_manager = $container->get('plugin.manager.entity');
-    return new static(
-      $entity_type,
-      $entity_info,
-      $entity_manager->getStorageController($entity_type),
-      $container->get('module_handler'),
-      $entity_manager->getDefinitions()
-    );
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function buildHeader() {
-    $header = parent::buildHeader();
-    unset($header['id']);
-    return $header;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function buildRow(EntityInterface $entity) {
-    $row = parent::buildRow($entity);
-    unset($row['id']);
-    return $row;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function load() {
-    $entities = array();
-    foreach (parent::load() as $entity) {
-      $entities[$entity->getTargetType()][] = $entity;
-    }
-    return $entities;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function render() {
-    $build = array();
-    foreach ($this->load() as $entity_type => $entities) {
-      if (!isset($this->entityInfoComplete[$entity_type])) {
-        continue;
-      }
-
-      // Filter entities
-      if ($this->entityInfoComplete[$entity_type]['fieldable'] && !$this->isValidEntity($entity_type)) {
-        continue;
-      }
-
-      $table = array(
-        '#prefix' => '<h2>' . $this->entityInfoComplete[$entity_type]['label'] . '</h2>',
-        '#type' => 'table',
-        '#header' => $this->buildHeader(),
-        '#rows' => array(),
-      );
-      foreach ($entities as $entity) {
-        if ($row = $this->buildRow($entity)) {
-          $table['#rows'][$entity->id()] = $row;
-        }
-      }
-
-      // Move content at the top.
-      if ($entity_type == 'node') {
-        $table['#weight'] = -10;
-      }
-
-      $short_type = str_replace('_mode', '', $this->entityType);
-      $table['#rows']['_add_new'][] = array(
-        'data' => array(
-          '#type' => 'link',
-          '#href' => "admin/structure/display-modes/$short_type/add/$entity_type",
-          '#title' => t('Add new %label @entity-type', array('%label' => $this->entityInfoComplete[$entity_type]['label'], '@entity-type' => strtolower($this->entityInfo['label']))),
-          '#options' => array(
-            'html' => TRUE,
-          ),
-        ),
-        'colspan' => count($table['#header']),
-      );
-      $build[$entity_type] = $table;
-    }
-    return $build;
-  }
-
-  /**
-   * Filters entities based on their controllers.
-   *
-   * @param $entity_type
-   *   The entity type of the entity that needs to be validated.
-   *
-   * @return bool
-   *   TRUE if the entity has the correct controller, FALSE if the entity
-   *   doesn't has the correct controller.
-   */
-  protected function isValidEntity($entity_type) {
-    return isset($this->entityInfoComplete[$entity_type]['controllers']['render']);
-  }
-
-}
diff --git a/core/modules/entity/lib/Drupal/entity/EntityFormModeInterface.php b/core/modules/entity/lib/Drupal/entity/EntityFormModeInterface.php
index e298e11..9a0a199 100644
--- a/core/modules/entity/lib/Drupal/entity/EntityFormModeInterface.php
+++ b/core/modules/entity/lib/Drupal/entity/EntityFormModeInterface.php
@@ -7,9 +7,11 @@
 
 namespace Drupal\entity;
 
+use Drupal\Core\Config\Entity\ConfigEntityInterface;
+
 /**
  * Provides an interface defining an entity form mode entity type.
  */
-interface EntityFormModeInterface extends EntityDisplayModeInterface {
+interface EntityFormModeInterface extends ConfigEntityInterface {
 
 }
diff --git a/core/modules/entity/lib/Drupal/entity/EntityFormModeListController.php b/core/modules/entity/lib/Drupal/entity/EntityFormModeListController.php
deleted file mode 100644
index 79417ff..0000000
--- a/core/modules/entity/lib/Drupal/entity/EntityFormModeListController.php
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\entity\EntityFormModeListController.
- */
-
-namespace Drupal\entity;
-
-/**
- * Provides the listing for entity display modes.
- */
-class EntityFormModeListController extends EntityDisplayModeListController {
-
-  /**
-   * Filters entities based on their controllers.
-   *
-   * @param $entity_type
-   *   The entity type of the entity that needs to be validated.
-   *
-   * @return bool
-   *   TRUE if the entity has the correct controller, FALSE if the entity
-   *   doesn't has the correct controller.
-   */
-  protected function isValidEntity($entity_type) {
-    return isset($this->entityInfoComplete[$entity_type]['controllers']['form']);
-  }
-
-}
diff --git a/core/modules/entity/lib/Drupal/entity/EntityViewModeInterface.php b/core/modules/entity/lib/Drupal/entity/EntityViewModeInterface.php
index 7ff4e51..f43c2df 100644
--- a/core/modules/entity/lib/Drupal/entity/EntityViewModeInterface.php
+++ b/core/modules/entity/lib/Drupal/entity/EntityViewModeInterface.php
@@ -7,9 +7,11 @@
 
 namespace Drupal\entity;
 
+use Drupal\Core\Config\Entity\ConfigEntityInterface;
+
 /**
  * Provides an interface defining an entity view mode entity type.
  */
-interface EntityViewModeInterface extends EntityDisplayModeInterface {
+interface EntityViewModeInterface extends ConfigEntityInterface {
 
 }
diff --git a/core/modules/entity/lib/Drupal/entity/Form/EntityDisplayModeAddForm.php b/core/modules/entity/lib/Drupal/entity/Form/EntityDisplayModeAddForm.php
deleted file mode 100644
index ad67f5a..0000000
--- a/core/modules/entity/lib/Drupal/entity/Form/EntityDisplayModeAddForm.php
+++ /dev/null
@@ -1,93 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\entity\Form\EntityDisplayModeAddForm.
- */
-
-namespace Drupal\entity\Form;
-
-use Drupal\Component\Plugin\PluginManagerInterface;
-use Drupal\Core\Entity\Query\QueryFactory;
-use Drupal\Core\Extension\ModuleHandlerInterface;
-use Symfony\Component\DependencyInjection\ContainerInterface;
-use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
-
-/**
- * Provides the add form for entity display modes.
- */
-class EntityDisplayModeAddForm extends EntityDisplayModeFormBase {
-
-  /**
-   * @var string
-   */
-  protected $entityType;
-
-  /**
-   * The entity manager.
-   *
-   * @var \Drupal\Component\Plugin\PluginManagerInterface
-   */
-  protected $entityManager;
-
-  /**
-   * Constructs a new EntityDisplayModeAddForm.
-   *
-   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
-   *   The module handler.
-   * @param \Drupal\Core\Entity\Query\QueryFactory $query_factory
-   *   The entity query factory.
-   * @param array $entity_info
-   *   The entity type definition.
-   * @param \Drupal\Component\Plugin\PluginManagerInterface $entity_manager
-   *   The entity manager.
-   */
-  public function __construct(ModuleHandlerInterface $module_handler, QueryFactory $query_factory, array $entity_info, PluginManagerInterface $entity_manager) {
-    parent::__construct($module_handler, $query_factory, $entity_info);
-
-    $this->entityManager = $entity_manager;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function createInstance(ContainerInterface $container, $entity_type, array $entity_info) {
-    return new static(
-      $container->get('module_handler'),
-      $container->get('entity.query'),
-      $entity_info,
-      $container->get('plugin.manager.entity')
-    );
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function buildForm(array $form, array &$form_state, $entity_type = NULL) {
-    $this->entityType = $entity_type;
-    return parent::buildForm($form, $form_state);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function validate(array $form, array &$form_state) {
-    parent::validate($form, $form_state);
-
-    form_set_value($form['id'], $this->entityType . '.' . $form_state['values']['id'], $form_state);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  protected function prepareEntity() {
-    $definition = $this->entityManager->getDefinition($this->entityType);
-    if (!$definition['fieldable'] || !isset($definition['controllers']['render'])) {
-      throw new NotFoundHttpException();
-    }
-
-    drupal_set_title(t('Add new %label @entity-type', array('%label' => $definition['label'], '@entity-type' => strtolower($this->entityInfo['label']))), PASS_THROUGH);
-    $this->entity->targetEntityType = $this->entityType;
-  }
-
-}
diff --git a/core/modules/entity/lib/Drupal/entity/Form/EntityDisplayModeDeleteForm.php b/core/modules/entity/lib/Drupal/entity/Form/EntityDisplayModeDeleteForm.php
deleted file mode 100644
index 1de637a..0000000
--- a/core/modules/entity/lib/Drupal/entity/Form/EntityDisplayModeDeleteForm.php
+++ /dev/null
@@ -1,62 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\entity\Form\EntityDisplayModeDeleteForm.
- */
-
-namespace Drupal\entity\Form;
-
-use Drupal\Core\Entity\EntityConfirmFormBase;
-
-/**
- * Provides the delete form for entity display modes.
- */
-class EntityDisplayModeDeleteForm extends EntityConfirmFormBase {
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getCancelPath() {
-    $short_type = str_replace('_mode', '', $this->entity->entityType());
-    return "admin/structure/display-modes/$short_type";
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getQuestion() {
-    $entity_info = $this->entity->entityInfo();
-    return t('Are you sure you want to delete the %label @entity-type?', array('%label' => $this->entity->label(), '@entity-type' => strtolower($entity_info['label'])));
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getDescription() {
-    $entity_info = $this->entity->entityInfo();
-    return t('Deleting a @entity-type will cause any output still requesting to use that @entity-type to use the default display settings.', array('@entity-type' => strtolower($entity_info['label'])));
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getConfirmText() {
-    return t('Delete');
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function submit(array $form, array &$form_state) {
-    parent::submit($form, $form_state);
-
-    $entity_info = $this->entity->entityInfo();
-    drupal_set_message(t('Deleted the %label @entity-type.', array('%label' => $this->entity->label(), '@entity-type' => strtolower($entity_info['label']))));
-    $this->entity->delete();
-    entity_info_cache_clear();
-    $short_type = str_replace('_mode', '', $this->entity->entityType());
-    $form_state['redirect'] = "admin/structure/display-modes/$short_type";
-  }
-
-}
diff --git a/core/modules/entity/lib/Drupal/entity/Form/EntityDisplayModeEditForm.php b/core/modules/entity/lib/Drupal/entity/Form/EntityDisplayModeEditForm.php
deleted file mode 100644
index f413fe4..0000000
--- a/core/modules/entity/lib/Drupal/entity/Form/EntityDisplayModeEditForm.php
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\entity\Form\EntityDisplayModeEditForm.
- */
-
-namespace Drupal\entity\Form;
-
-/**
- * Provides the edit form for entity display modes.
- */
-class EntityDisplayModeEditForm extends EntityDisplayModeFormBase {
-
-  /**
-   * {@inheritdoc}
-   */
-  public function delete(array $form, array &$form_state) {
-    $short_type = str_replace('_mode', '', $this->entity->entityType());
-    $form_state['redirect'] = "admin/structure/display-modes/$short_type/manage/" . $this->entity->id() . '/delete';
-  }
-
-}
diff --git a/core/modules/entity/lib/Drupal/entity/Form/EntityDisplayModeFormBase.php b/core/modules/entity/lib/Drupal/entity/Form/EntityDisplayModeFormBase.php
deleted file mode 100644
index 787432a..0000000
--- a/core/modules/entity/lib/Drupal/entity/Form/EntityDisplayModeFormBase.php
+++ /dev/null
@@ -1,121 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\entity\Form\EntityDisplayModeFormBase.
- */
-
-namespace Drupal\entity\Form;
-
-use Drupal\Core\Entity\EntityControllerInterface;
-use Drupal\Core\Entity\EntityFormController;
-use Drupal\Core\Entity\Query\QueryFactory;
-use Drupal\Core\Extension\ModuleHandlerInterface;
-use Symfony\Component\DependencyInjection\ContainerInterface;
-
-/**
- * Provides the generic base class for entity display mode forms.
- */
-abstract class EntityDisplayModeFormBase extends EntityFormController implements EntityControllerInterface {
-
-  /**
-   * The entity query factory.
-   *
-   * @var \Drupal\Core\Entity\Query\QueryFactory
-   */
-  protected $queryFactory;
-
-  /**
-   * The entity type definition.
-   *
-   * @var array
-   */
-  protected $entityInfo;
-
-  /**
-   * Constructs a new EntityDisplayModeFormBase.
-   *
-   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
-   *   The module handler.
-   * @param \Drupal\Core\Entity\Query\QueryFactory $query_factory
-   *   The entity query factory.
-   * @param array $entity_info
-   *   The entity type definition.
-   */
-  public function __construct(ModuleHandlerInterface $module_handler, QueryFactory $query_factory, array $entity_info) {
-    parent::__construct($module_handler);
-
-    $this->queryFactory = $query_factory;
-    $this->entityInfo = $entity_info;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function createInstance(ContainerInterface $container, $entity_type, array $entity_info) {
-    return new static(
-      $container->get('module_handler'),
-      $container->get('entity.query'),
-      $entity_info
-    );
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function form(array $form, array &$form_state) {
-    $form['label'] = array(
-      '#type' => 'textfield',
-      '#title' => t('Label'),
-      '#maxlength' => 100,
-      '#default_value' => $this->entity->label(),
-    );
-
-    $form['id'] = array(
-      '#type' => 'machine_name',
-      '#title' => t('Machine-readable name'),
-      '#description' => t('A unique machine-readable name. Can only contain lowercase letters, numbers, and underscores.'),
-      '#disabled' => !$this->entity->isNew(),
-      '#default_value' => $this->entity->id(),
-      '#field_prefix' => $this->entity->isNew() ? $this->entity->getTargetType() . '.' : '',
-      '#machine_name' => array(
-        'exists' => array($this, 'exists'),
-        'replace_pattern' => '[^a-z0-9_.]+',
-      ),
-    );
-
-    return $form;
-  }
-
-  /**
-   * Determines if the display mode already exists.
-   *
-   * @param string|int $entity_id
-   *   The entity ID.
-   * @param array $element
-   *   The form element.
-   * @param array $form_state
-   *   The form state.
-   *
-   * @return bool
-   *   TRUE if the display mode exists, FALSE otherwise.
-   */
-  public function exists($entity_id, array $element, array $form_state) {
-    return (bool) $this->queryFactory
-      ->get($this->entity->entityType())
-      ->condition('id', $element['#field_prefix'] . $entity_id)
-      ->execute();
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function save(array $form, array &$form_state) {
-    drupal_set_message(t('Saved the %label @entity-type.', array('%label' => $this->entity->label(), '@entity-type' => strtolower($this->entityInfo['label']))));
-    $this->entity->save();
-    entity_info_cache_clear();
-    $short_type = str_replace('_mode', '', $this->entity->entityType());
-    $form_state['redirect'] = "admin/structure/display-modes/$short_type";
-  }
-
-}
diff --git a/core/modules/entity/lib/Drupal/entity/Form/EntityFormModeAddForm.php b/core/modules/entity/lib/Drupal/entity/Form/EntityFormModeAddForm.php
deleted file mode 100644
index 307baa6..0000000
--- a/core/modules/entity/lib/Drupal/entity/Form/EntityFormModeAddForm.php
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\entity\Form\EntityFormModeAddForm.
- */
-
-namespace Drupal\entity\Form;
-
-use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
-
-/**
- * Provides the add form for entity display modes.
- */
-class EntityFormModeAddForm extends EntityDisplayModeAddForm {
-
-  /**
-   * {@inheritdoc}
-   */
-  protected function prepareEntity() {
-    $definition = $this->entityManager->getDefinition($this->entityType);
-    if (!$definition['fieldable'] || !isset($definition['controllers']['form'])) {
-      throw new NotFoundHttpException();
-    }
-
-    drupal_set_title(t('Add new %label @entity-type', array('%label' => $definition['label'], '@entity-type' => strtolower($this->entityInfo['label']))), PASS_THROUGH);
-    $this->entity->targetEntityType = $this->entityType;
-  }
-
-}
diff --git a/core/modules/entity/lib/Drupal/entity/Plugin/Core/Entity/EntityFormMode.php b/core/modules/entity/lib/Drupal/entity/Plugin/Core/Entity/EntityFormMode.php
index 9d96994..c539d5e 100644
--- a/core/modules/entity/lib/Drupal/entity/Plugin/Core/Entity/EntityFormMode.php
+++ b/core/modules/entity/lib/Drupal/entity/Plugin/Core/Entity/EntityFormMode.php
@@ -34,13 +34,6 @@
  *   label = @Translation("Form mode"),
  *   module = "entity",
  *   controllers = {
- *     "list" = "Drupal\entity\EntityFormModeListController",
- *     "access" = "Drupal\entity\EntityDisplayModeAccessController",
- *     "form" = {
- *       "add" = "Drupal\entity\Form\EntityFormModeAddForm",
- *       "edit" = "Drupal\entity\Form\EntityDisplayModeEditForm",
- *       "delete" = "Drupal\entity\Form\EntityDisplayModeDeleteForm"
- *     },
  *     "storage" = "Drupal\entity\EntityDisplayModeStorageController"
  *   },
  *   config_prefix = "entity.form_mode",
@@ -53,17 +46,4 @@
  */
 class EntityFormMode extends EntityDisplayModeBase implements EntityFormModeInterface {
 
-  /**
-   * {@inheritdoc}
-   */
-  public function uri() {
-    return array(
-      'path' => 'admin/structure/display-modes/form/manage/' . $this->id(),
-      'options' => array(
-        'entity_type' => $this->entityType,
-        'entity' => $this,
-      ),
-    );
-  }
-
 }
diff --git a/core/modules/entity/lib/Drupal/entity/Plugin/Core/Entity/EntityViewMode.php b/core/modules/entity/lib/Drupal/entity/Plugin/Core/Entity/EntityViewMode.php
index fb94589..b0d1efe 100644
--- a/core/modules/entity/lib/Drupal/entity/Plugin/Core/Entity/EntityViewMode.php
+++ b/core/modules/entity/lib/Drupal/entity/Plugin/Core/Entity/EntityViewMode.php
@@ -35,13 +35,6 @@
  *   label = @Translation("View mode"),
  *   module = "entity",
  *   controllers = {
- *     "list" = "Drupal\entity\EntityDisplayModeListController",
- *     "access" = "Drupal\entity\EntityDisplayModeAccessController",
- *     "form" = {
- *       "add" = "Drupal\entity\Form\EntityDisplayModeAddForm",
- *       "edit" = "Drupal\entity\Form\EntityDisplayModeEditForm",
- *       "delete" = "Drupal\entity\Form\EntityDisplayModeDeleteForm"
- *     },
  *     "storage" = "Drupal\entity\EntityDisplayModeStorageController"
  *   },
  *   config_prefix = "entity.view_mode",
@@ -54,17 +47,4 @@
  */
 class EntityViewMode extends EntityDisplayModeBase implements EntityViewModeInterface {
 
-  /**
-   * {@inheritdoc}
-   */
-  public function uri() {
-    return array(
-      'path' => 'admin/structure/display-modes/view/manage/' . $this->id(),
-      'options' => array(
-        'entity_type' => $this->entityType,
-        'entity' => $this,
-      ),
-    );
-  }
-
 }
diff --git a/core/modules/entity/lib/Drupal/entity/Tests/EntityDisplayModeTest.php b/core/modules/entity/lib/Drupal/entity/Tests/EntityDisplayModeTest.php
deleted file mode 100644
index ba73fdb..0000000
--- a/core/modules/entity/lib/Drupal/entity/Tests/EntityDisplayModeTest.php
+++ /dev/null
@@ -1,104 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\entity\Tests\EntityDisplayModeTest.
- */
-
-namespace Drupal\entity\Tests;
-
-use Drupal\simpletest\WebTestBase;
-
-/**
- * Tests the entity display mode configuration entities.
- */
-class EntityDisplayModeTest extends WebTestBase {
-
-  /**
-   * Modules to enable.
-   *
-   * @var array
-   */
-  public static $modules = array('entity_test');
-
-  public static function getInfo() {
-    return array(
-      'name' => 'Entity display modes UI',
-      'description' => 'Tests the entity display modes UI.',
-      'group' => 'Entity',
-    );
-  }
-
-  /**
-   * Tests the EntityViewMode user interface.
-   */
-  public function testEntityViewModeUI() {
-    // Test the listing page.
-    $this->drupalGet('admin/structure/display-modes/view');
-    $this->assertResponse(403);
-    $this->drupalLogin($this->drupalCreateUser(array('administer display modes')));
-    $this->drupalGet('admin/structure/display-modes/view');
-    $this->assertResponse(200);
-
-    $this->drupalGet('admin/structure/display-modes/view/add/entity_test');
-    $this->assertResponse(404);
-
-    $this->drupalGet('admin/structure/display-modes/view/add');
-    $this->assertNoLink(t('Test entity'), 'An entity type with no render controller cannot have view modes.');
-
-    // Test adding a view mode.
-    $this->clickLink(t('Test render entity'));
-    $edit = array(
-      'id' => strtolower($this->randomName()),
-      'label' => $this->randomString(),
-    );
-    $this->drupalPost(NULL, $edit, t('Save'));
-    $this->assertRaw(t('Saved the %label view mode.', array('%label' => $edit['label'])));
-
-    // Test editing the view mode.
-    $this->drupalGet('admin/structure/display-modes/view/manage/entity_test_render.' . $edit['id']);
-
-    // Test deleting the view mode.
-    $this->drupalPost(NULL, NULL, t('Delete'));
-    $this->assertRaw(t('Are you sure you want to delete the %label view mode?', array('%label' => $edit['label'])));
-    $this->drupalPost(NULL, NULL, t('Delete'));
-    $this->assertRaw(t('Deleted the %label view mode.', array('%label' => $edit['label'])));
-  }
-
-  /**
-   * Tests the EntityFormMode user interface.
-   */
-  public function testEntityFormModeUI() {
-    // Test the listing page.
-    $this->drupalGet('admin/structure/display-modes/form');
-    $this->assertResponse(403);
-    $this->drupalLogin($this->drupalCreateUser(array('administer display modes')));
-    $this->drupalGet('admin/structure/display-modes/form');
-    $this->assertResponse(200);
-
-    $this->drupalGet('admin/structure/display-modes/form/add/entity_test_render');
-    $this->assertResponse(404);
-
-    $this->drupalGet('admin/structure/display-modes/form/add');
-    $this->assertNoLink(t('Test render entity'), 'An entity type with no form controller cannot have form modes.');
-
-    // Test adding a form mode.
-    $this->clickLink(t('Test entity'));
-    $edit = array(
-      'id' => strtolower($this->randomName()),
-      'label' => $this->randomString(),
-    );
-    $this->drupalPost(NULL, $edit, t('Save'));
-    $this->assertRaw(t('Saved the %label form mode.', array('%label' => $edit['label'])));
-
-    // Test editing the form mode.
-    $this->drupalGet('admin/structure/display-modes/form/manage/entity_test.' . $edit['id']);
-
-    // Test deleting the form mode.
-    $this->drupalPost(NULL, NULL, t('Delete'));
-    $this->assertRaw(t('Are you sure you want to delete the %label form mode?', array('%label' => $edit['label'])));
-    $this->drupalPost(NULL, NULL, t('Delete'));
-    $this->assertRaw(t('Deleted the %label form mode.', array('%label' => $edit['label'])));
-  }
-
-}
diff --git a/core/modules/entity_reference/entity_reference.module b/core/modules/entity_reference/entity_reference.module
index 54a7bac..5e438e6 100644
--- a/core/modules/entity_reference/entity_reference.module
+++ b/core/modules/entity_reference/entity_reference.module
@@ -139,7 +139,7 @@ function entity_reference_field_settings_form($field, $instance) {
     // @todo As the database schema can currently only store numeric IDs of
     // referenced entities and configuration entities have string IDs, prevent
     // configuration entities from being referenced.
-    if (!is_subclass_of($entity_info['class'], '\Drupal\Core\Config\Entity\ConfigEntityInterface')) {
+    if (!in_array('\Drupal\Core\Config\Entity\ConfigEntityInterface', class_implements($entity_info['class']))) {
       $entity_type_options[$entity_type] = $entity_info['label'];
     }
   }
@@ -206,8 +206,8 @@ function entity_reference_field_instance_settings_form($field, $instance, $form_
   $handlers = Drupal::service('plugin.manager.entity_reference.selection')->getDefinitions();
   $handlers_options = array();
   foreach ($handlers as $plugin_id => $plugin) {
-    // We only display base plugins (e.g. 'default', 'views', ..) and not entity
-    // type specific plugins (e.g. 'default_node', 'default_user', ...).
+    // We only display base plugins (e.g. 'base', 'views', ..) and not entity
+    // type specific plugins (e.g. 'base_node', 'base_user', ...).
     if (in_array($plugin_id, $handler_groups)) {
       $handlers_options[$plugin_id] = check_plain($plugin['label']);
     }
diff --git a/core/modules/entity_reference/entity_reference.services.yml b/core/modules/entity_reference/entity_reference.services.yml
index 91842ca..02c3106 100644
--- a/core/modules/entity_reference/entity_reference.services.yml
+++ b/core/modules/entity_reference/entity_reference.services.yml
@@ -1,7 +1,7 @@
 services:
   plugin.manager.entity_reference.selection:
     class: Drupal\entity_reference\Plugin\Type\SelectionPluginManager
-    arguments: ['@container.namespaces', '@cache.cache', '@language_manager', '@module_handler']
+    arguments: ['@container.namespaces']
   entity_reference.autocomplete:
     class: Drupal\entity_reference\EntityReferenceAutocomplete
     arguments: ['@plugin.manager.entity']
diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Annotation/EntityReferenceSelection.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Annotation/EntityReferenceSelection.php
deleted file mode 100644
index afc6036..0000000
--- a/core/modules/entity_reference/lib/Drupal/entity_reference/Annotation/EntityReferenceSelection.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\entity_reference\Annotation\EntityReferenceSelection.
- */
-
-namespace Drupal\entity_reference\Annotation;
-
-use Drupal\Component\Annotation\Plugin;
-
-/**
- * Defines a EntityReferenceSelection annotation object.
- *
- * @Annotation
- */
-class EntityReferenceSelection extends Plugin {
-
-  /**
-   * The plugin ID.
-   *
-   * @var string
-   */
-  public $id;
-
-  /**
-   * The human-readable name of the selection plugin.
-   *
-   * @ingroup plugin_translatable
-   *
-   * @var \Drupal\Core\Annotation\Translation
-   */
-  public $label;
-
-  /**
-   * The selection plugin group.
-   *
-   * This property is used to allow selection plugins to target a specific
-   * entity type while also inheriting the code of an existing selection plugin.
-   * For example, if we want to override the NodeSelection from the 'default'
-   * selection type, we can define the annotation of a new plugin as follows:
-   * @code
-   * id = "node_advanced",
-   * entity_types = {"node"},
-   * group = "default",
-   * weight = 5
-   * @endcode
-   *
-   * @var string
-   */
-  public $group;
-
-  /**
-   * An array of entity types that can be referenced by this plugin. Defaults to
-   * all entity types.
-   *
-   * @var array (optional)
-   */
-  public $entity_types = array();
-
-  /**
-   * The weight of the plugin in it's group.
-   *
-   * @var int
-   */
-  public $weight;
-
-}
diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Type/SelectionPluginManager.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Type/SelectionPluginManager.php
index c5ecb8f..d51544d 100644
--- a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Type/SelectionPluginManager.php
+++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Type/SelectionPluginManager.php
@@ -9,34 +9,28 @@
 
 use Drupal\Component\Plugin\Exception\PluginException;
 use Drupal\Component\Plugin\Factory\ReflectionFactory;
-use Drupal\Core\Cache\CacheBackendInterface;
-use Drupal\Core\Extension\ModuleHandlerInterface;
-use Drupal\Core\Language\LanguageManager;
-use Drupal\Core\Plugin\DefaultPluginManager;
+use Drupal\Component\Plugin\PluginManagerBase;
+use Drupal\Core\Plugin\Discovery\AlterDecorator;
 use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
+use Drupal\Core\Plugin\Discovery\CacheDecorator;
 use Drupal\entity_reference\Plugin\Type\Selection\SelectionBroken;
 
 /**
  * Plugin type manager for the Entity Reference Selection plugin.
  */
-class SelectionPluginManager extends DefaultPluginManager {
+class SelectionPluginManager extends PluginManagerBase {
 
   /**
-   * {@inheritdoc}
+   * Constructs a SelectionPluginManager object.
+   *
+   * @param \Traversable $namespaces
+   *   An object that implements \Traversable which contains the root paths
+   *   keyed by the corresponding namespace to look for plugin implementations,
    */
-  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, LanguageManager $language_manager, ModuleHandlerInterface $module_handler) {
-    $this->subdir = 'entity_reference/selection';
-    $annotation_namespaces = array(
-      'Drupal\entity_reference\Annotation' => $namespaces['Drupal\entity_reference']
-    );
-    $this->discovery = new AnnotatedClassDiscovery($this->subdir, $namespaces, $annotation_namespaces, 'Drupal\entity_reference\Annotation\EntityReferenceSelection');
-
-    // We're not using the parent constructor because we use a different factory
-    // method and don't need the derivative discovery decorator.
+  public function __construct(\Traversable $namespaces) {
+    $this->baseDiscovery = new AlterDecorator(new AnnotatedClassDiscovery('entity_reference/selection', $namespaces), 'entity_reference_selection');
+    $this->discovery = new CacheDecorator($this->baseDiscovery, 'entity_reference_selection');
     $this->factory = new ReflectionFactory($this);
-
-    $this->alterInfo($module_handler, 'entity_reference_selection');
-    $this->setCacheBackend($cache_backend, $language_manager, 'entity_reference_selection');
   }
 
   /**
@@ -84,7 +78,7 @@ public function getSelectionGroups($entity_type) {
     $plugins = array();
 
     foreach ($this->getDefinitions() as $plugin_id => $plugin) {
-      if (empty($plugin['entity_types']) || in_array($entity_type, $plugin['entity_types'])) {
+      if (!isset($plugin['entity_types']) || in_array($entity_type, $plugin['entity_types'])) {
         $plugins[$plugin['group']][$plugin_id] = $plugin;
       }
     }
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 de4729c..94faf22 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
@@ -7,20 +7,21 @@
 
 namespace Drupal\entity_reference\Plugin\entity_reference\selection;
 
+use Drupal\Component\Annotation\Plugin;
 use Drupal\Core\Annotation\Translation;
 use Drupal\Core\Database\Query\AlterableInterface;
 use Drupal\Core\Database\Query\SelectInterface;
 use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Entity\Field\FieldDefinitionInterface;
 use Drupal\Component\Utility\NestedArray;
-use Drupal\entity_reference\Annotation\EntityReferenceSelection;
 use Drupal\entity_reference\Plugin\Type\Selection\SelectionInterface;
 
 /**
  * Plugin implementation of the 'selection' entity_reference.
  *
- * @EntityReferenceSelection(
+ * @Plugin(
  *   id = "default",
+ *   module = "entity_reference",
  *   label = @Translation("Default"),
  *   group = "default",
  *   weight = 0,
@@ -52,7 +53,7 @@ public function __construct(FieldDefinitionInterface $field_definition, EntityIn
   }
 
   /**
-   * {@inheritdoc}
+   * Implements SelectionInterface::settingsForm().
    */
   public static function settingsForm(&$field, &$instance) {
     $entity_info = entity_get_info($field['settings']['target_type']);
@@ -154,7 +155,7 @@ public static function settingsForm(&$field, &$instance) {
   }
 
   /**
-   * {@inheritdoc}
+   * Implements SelectionInterface::getReferenceableEntities().
    */
   public function getReferenceableEntities($match = NULL, $match_operator = 'CONTAINS', $limit = 0) {
     $target_type = $this->fieldDefinition->getFieldSetting('target_type');
@@ -181,7 +182,7 @@ public function getReferenceableEntities($match = NULL, $match_operator = 'CONTA
   }
 
   /**
-   * {@inheritdoc}
+   * Implements SelectionInterface::countReferenceableEntities().
    */
   public function countReferenceableEntities($match = NULL, $match_operator = 'CONTAINS') {
     $query = $this->buildEntityQuery($match, $match_operator);
@@ -191,7 +192,7 @@ public function countReferenceableEntities($match = NULL, $match_operator = 'CON
   }
 
   /**
-   * {@inheritdoc}
+   * Implements SelectionInterface::validateReferenceableEntities().
    */
   public function validateReferenceableEntities(array $ids) {
     $result = array();
@@ -208,7 +209,7 @@ public function validateReferenceableEntities(array $ids) {
   }
 
   /**
-   * {@inheritdoc}
+   * Implements SelectionInterface::validateAutocompleteInput().
    */
   public function validateAutocompleteInput($input, &$element, &$form_state, $form, $strict = TRUE) {
     $entities = $this->getReferenceableEntities($input, '=', 6);
@@ -291,7 +292,7 @@ public function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS') {
   }
 
   /**
-   * {@inheritdoc}
+   * Implements SelectionInterface::entityQueryAlter().
    */
   public function entityQueryAlter(SelectInterface $query) { }
 
diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/formatter/EntityReferenceEntityFormatter.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/formatter/EntityReferenceEntityFormatter.php
index 4b8df9c..51d48b9 100644
--- a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/formatter/EntityReferenceEntityFormatter.php
+++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/formatter/EntityReferenceEntityFormatter.php
@@ -25,7 +25,7 @@
  *     "entity_reference"
  *   },
  *   settings = {
- *     "view_mode" = "default",
+ *     "view_mode" = "",
  *     "link" = FALSE
  *   }
  * )
@@ -37,7 +37,7 @@ class EntityReferenceEntityFormatter extends EntityReferenceFormatterBase {
    */
   public function settingsForm(array $form, array &$form_state) {
     $view_modes = entity_get_view_modes($this->getFieldSetting('target_type'));
-    $options = array('default' => t('Default'));
+    $options = array();
     foreach ($view_modes as $view_mode => $view_mode_settings) {
       $options[$view_mode] = $view_mode_settings['label'];
     }
@@ -67,9 +67,6 @@ public function settingsSummary() {
 
     $view_modes = entity_get_view_modes($this->getFieldSetting('target_type'));
     $view_mode = $this->getSetting('view_mode');
-    if ($view_mode == 'default') {
-      $view_mode = t('Default');
-    }
     $summary[] = t('Rendered as @mode', array('@mode' => isset($view_modes[$view_mode]['label']) ? $view_modes[$view_mode]['label'] : $view_mode));
     $summary[] = $this->getSetting('links') ? t('Display links') : t('Do not display links');
 
diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/widget/AutocompleteWidgetBase.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/widget/AutocompleteWidgetBase.php
index 9798a53..909b780 100644
--- a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/widget/AutocompleteWidgetBase.php
+++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/widget/AutocompleteWidgetBase.php
@@ -94,7 +94,7 @@ public function formElement(array $items, $delta, array $element, $langcode, arr
       '#placeholder' => $this->getSetting('placeholder'),
       '#element_validate' => array(array($this, 'elementValidate')),
       // @todo: Use wrapper to get the user if exists or needed.
-      '#autocreate_uid' => isset($entity->uid) ? $entity->uid : $user->id(),
+      '#autocreate_uid' => isset($entity->uid) ? $entity->uid : $user->uid,
     );
 
     return array('target_id' => $element);
diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceAdminTest.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceAdminTest.php
index 932f55f..db74267 100644
--- a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceAdminTest.php
+++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceAdminTest.php
@@ -104,6 +104,6 @@ public function testFieldAdminHandler() {
     ), t('Save settings'));
 
     // Check that the field appears in the overview form.
-    $this->assertFieldByXPath('//table[@id="field-overview"]//td[1]', 'Test label', 'Field was created and appears in the overview page.');
+    $this->assertFieldByXPath('//table[@id="field-overview"]//td[1]', 'Test label', t('Field was created and appears in the overview page.'));
   }
 }
diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceSelectionAccessTest.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceSelectionAccessTest.php
index f064b77..9a611d4 100644
--- a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceSelectionAccessTest.php
+++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceSelectionAccessTest.php
@@ -272,8 +272,8 @@ public function testUserHandler() {
         ),
         'result' => array(
           'user' => array(
-            $users['admin']->id() => $user_labels['admin'],
-            $users['non_admin']->id() => $user_labels['non_admin'],
+            $users['admin']->uid => $user_labels['admin'],
+            $users['non_admin']->uid => $user_labels['non_admin'],
           ),
         ),
       ),
@@ -284,7 +284,7 @@ public function testUserHandler() {
         ),
         'result' => array(
           'user' => array(
-            $users['non_admin']->id() => $user_labels['non_admin'],
+            $users['non_admin']->uid => $user_labels['non_admin'],
           ),
         ),
       ),
@@ -311,10 +311,10 @@ public function testUserHandler() {
         ),
         'result' => array(
           'user' => array(
-            $users['anonymous']->id() => $user_labels['anonymous'],
-            $users['admin']->id() => $user_labels['admin'],
-            $users['non_admin']->id() => $user_labels['non_admin'],
-            $users['blocked']->id() => $user_labels['blocked'],
+            $users['anonymous']->uid => $user_labels['anonymous'],
+            $users['admin']->uid => $user_labels['admin'],
+            $users['non_admin']->uid => $user_labels['non_admin'],
+            $users['blocked']->uid => $user_labels['blocked'],
           ),
         ),
       ),
@@ -324,7 +324,7 @@ public function testUserHandler() {
         ),
         'result' => array(
           'user' => array(
-            $users['blocked']->id() => $user_labels['blocked'],
+            $users['blocked']->uid => $user_labels['blocked'],
           ),
         ),
       ),
@@ -335,7 +335,7 @@ public function testUserHandler() {
         ),
         'result' => array(
           'user' => array(
-            $users['anonymous']->id() => $user_labels['anonymous'],
+            $users['anonymous']->uid => $user_labels['anonymous'],
           ),
         ),
       ),
diff --git a/core/modules/entity_reference/tests/modules/entity_reference_test/config/views.view.test_entity_reference.yml b/core/modules/entity_reference/tests/modules/entity_reference_test/config/views.view.test_entity_reference.yml
index c3f265a..94d1329 100644
--- a/core/modules/entity_reference/tests/modules/entity_reference_test/config/views.view.test_entity_reference.yml
+++ b/core/modules/entity_reference/tests/modules/entity_reference_test/config/views.view.test_entity_reference.yml
@@ -1,3 +1,4 @@
+api_version: '3.0'
 base_field: nid
 base_table: node
 core: 8.x
@@ -46,7 +47,6 @@ display:
           hide_empty: '0'
           empty_zero: '0'
           link_to_node: '1'
-          provider: node
       filters:
         status:
           value: '1'
@@ -56,14 +56,12 @@ display:
           expose:
             operator: '0'
           group: '1'
-          provider: views
       sorts:
         created:
           id: created
           table: node_field_data
           field: created
           order: DESC
-          provider: views
   entity_reference_1:
     display_plugin: entity_reference
     id: entity_reference_1
diff --git a/core/modules/field/field.form.inc b/core/modules/field/field.form.inc
index 461e20d..f819c42 100644
--- a/core/modules/field/field.form.inc
+++ b/core/modules/field/field.form.inc
@@ -35,7 +35,7 @@ function theme_field_multiple_value_form($variables) {
         'colspan' => 2,
         'class' => array('field-label'),
       ),
-      t('Order', array(), array('context' => 'Sort order')),
+      t('Order'),
     );
     $rows = array();
 
diff --git a/core/modules/field/field.module b/core/modules/field/field.module
index 92a2c45..7a18b9e 100644
--- a/core/modules/field/field.module
+++ b/core/modules/field/field.module
@@ -403,7 +403,7 @@ function field_sync_field_status() {
 
   // Get both deleted and non-deleted field definitions.
   $fields = array();
-  foreach (config_get_storage_names_with_prefix('field.field.') as $name) {
+  foreach (config_get_storage_names_with_prefix('field.field') as $name) {
     $field = Drupal::config($name)->get();
     $fields[$field['uuid']] = $field;
   }
@@ -984,18 +984,24 @@ function template_preprocess_field(&$variables, $hook) {
     'field__' . $element['#bundle'],
     'field__' . $element['#field_name'] . '__' . $element['#bundle'],
   );
+}
 
+/**
+ * Theme process function for theme_field() and field.html.twig.
+ *
+ * @see theme_field()
+ * @see field.html.twig
+ */
+function template_process_field(&$variables, $hook) {
   static $default_attributes;
+  // The default theme implementation is a function, so template_process() does
+  // not automatically run, so we need to flatten the classes and attributes
+  // here. For best performance, only instantiate Drupal\Core\Template\Attribute
+  // when needed, and note that template_preprocess_field() does not initialize
+  // the *_attributes variables.
   if (!isset($default_attributes)) {
     $default_attributes = new Attribute;
   }
-  // The default theme implementation for fields is a function.
-  // template_preprocess() (which initializes the attributes, title_attributes,
-  // and content_attributes arrays) does not run for theme function
-  // implementations. Additionally, Attribute objects for the three variables
-  // below only get instantiated for template file implementations, and we need
-  // Attribute objects for printing in both theme functions and template files.
-  // For best performance, we only instantiate Attribute objects when needed.
   $variables['attributes'] = isset($variables['attributes']) ? new Attribute($variables['attributes']) : clone $default_attributes;
   $variables['title_attributes'] = isset($variables['title_attributes']) ? new Attribute($variables['title_attributes']) : clone($default_attributes);
   $variables['content_attributes'] = isset($variables['content_attributes']) ? new Attribute($variables['content_attributes']) : clone($default_attributes);
@@ -1064,6 +1070,7 @@ function template_preprocess_field(&$variables, $hook) {
  *   - attributes: A string containing the attributes for the wrapping div.
  *
  * @see template_preprocess_field()
+ * @see template_process_field()
  * @see field.html.twig
  *
  * @ingroup themeable
diff --git a/core/modules/field/field.services.yml b/core/modules/field/field.services.yml
index 6b8c4b8..f4c28db 100644
--- a/core/modules/field/field.services.yml
+++ b/core/modules/field/field.services.yml
@@ -1,10 +1,10 @@
 services:
   plugin.manager.field.widget:
     class: Drupal\field\Plugin\Type\Widget\WidgetPluginManager
-    arguments: ['@container.namespaces', '@cache.field', '@module_handler', '@language_manager']
+    arguments: ['@container.namespaces']
   plugin.manager.field.formatter:
     class: Drupal\field\Plugin\Type\Formatter\FormatterPluginManager
-    arguments: ['@container.namespaces', '@cache.field', '@module_handler', '@language_manager']
+    arguments: ['@container.namespaces']
   field.info:
     class: Drupal\field\FieldInfo
     arguments: ['@cache.field', '@config.factory', '@module_handler']
diff --git a/core/modules/field/lib/Drupal/field/FieldInfo.php b/core/modules/field/lib/Drupal/field/FieldInfo.php
index e7e46b9..349872e 100644
--- a/core/modules/field/lib/Drupal/field/FieldInfo.php
+++ b/core/modules/field/lib/Drupal/field/FieldInfo.php
@@ -178,14 +178,14 @@ public function getFieldMap() {
     $map = array();
 
     // Get active fields.
-    foreach (config_get_storage_names_with_prefix('field.field.') as $config_id) {
+    foreach (config_get_storage_names_with_prefix('field.field') as $config_id) {
       $field_config = $this->config->get($config_id)->get();
       if ($field_config['active'] && $field_config['storage']['active']) {
         $fields[$field_config['uuid']] = $field_config;
       }
     }
     // Get field instances.
-    foreach (config_get_storage_names_with_prefix('field.instance.') as $config_id) {
+    foreach (config_get_storage_names_with_prefix('field.instance') as $config_id) {
       $instance_config = $this->config->get($config_id)->get();
       $field_uuid = $instance_config['field_uuid'];
       // Filter out instances of inactive fields, and instances on unknown
diff --git a/core/modules/field/lib/Drupal/field/Plugin/Type/FieldType/ConfigEntityReferenceItemBase.php b/core/modules/field/lib/Drupal/field/Plugin/Type/FieldType/ConfigEntityReferenceItemBase.php
index ff4472f..7229a9a 100644
--- a/core/modules/field/lib/Drupal/field/Plugin/Type/FieldType/ConfigEntityReferenceItemBase.php
+++ b/core/modules/field/lib/Drupal/field/Plugin/Type/FieldType/ConfigEntityReferenceItemBase.php
@@ -57,15 +57,14 @@ public function getInstance() {
    * {@inheritdoc}
    */
   public function getPropertyDefinitions() {
-    // Definitions vary by entity type and bundle, so key them accordingly.
-    $key = $this->definition['settings']['target_type'] . ':';
-    $key .= isset($this->definition['settings']['target_bundle']) ? $this->definition['settings']['target_bundle'] : '';
+    // Definitions vary by entity type, so key them by entity type.
+    $target_type = $this->definition['settings']['target_type'];
 
-    if (!isset(static::$propertyDefinitions[$key])) {
+    if (!isset(self::$propertyDefinitions[$target_type])) {
       // Call the parent to define the target_id and entity properties.
       parent::getPropertyDefinitions();
 
-      static::$propertyDefinitions[$key]['revision_id'] = array(
+      static::$propertyDefinitions[$target_type]['revision_id'] = array(
         // @todo: Lookup the entity type's ID data type and use it here.
         'type' => 'integer',
         'label' => t('Revision ID'),
@@ -73,18 +72,18 @@ public function getPropertyDefinitions() {
           'Range' => array('min' => 0),
         ),
       );
-      static::$propertyDefinitions[$key]['label'] = array(
+      static::$propertyDefinitions[$target_type]['label'] = array(
         'type' => 'string',
         'label' => t('Label (auto-create)'),
         'computed' => TRUE,
       );
-      static::$propertyDefinitions[$key]['access'] = array(
+      static::$propertyDefinitions[$target_type]['access'] = array(
         'type' => 'boolean',
         'label' => t('Access'),
         'computed' => TRUE,
       );
     }
-    return static::$propertyDefinitions[$key];
+    return static::$propertyDefinitions[$target_type];
   }
 
   /**
diff --git a/core/modules/field/lib/Drupal/field/Plugin/Type/FieldType/ConfigField.php b/core/modules/field/lib/Drupal/field/Plugin/Type/FieldType/ConfigField.php
index 29ce028..dfc4fba 100644
--- a/core/modules/field/lib/Drupal/field/Plugin/Type/FieldType/ConfigField.php
+++ b/core/modules/field/lib/Drupal/field/Plugin/Type/FieldType/ConfigField.php
@@ -47,25 +47,18 @@ public function getInstance() {
   /**
    * {@inheritdoc}
    */
-  public function getFieldDefinition() {
-    return $this->getInstance();
-  }
-
-  /**
-   * {@inheritdoc}
-   */
   public function getConstraints() {
     $constraints = array();
     // Check that the number of values doesn't exceed the field cardinality. For
     // form submitted values, this can only happen with 'multiple value'
     // widgets.
-    $cardinality = $this->getFieldDefinition()->getFieldCardinality();
+    $cardinality = $this->getInstance()->getField()->cardinality;
     if ($cardinality != FIELD_CARDINALITY_UNLIMITED) {
       $constraints[] = \Drupal::typedData()
         ->getValidationConstraintManager()
         ->create('Count', array(
           'max' => $cardinality,
-          'maxMessage' => t('%name: this field cannot hold more than @count values.', array('%name' => $this->getFieldDefinition()->getFieldLabel(), '@count' => $cardinality)),
+          'maxMessage' => t('%name: this field cannot hold more than @count values.', array('%name' => $this->getInstance()->label, '@count' => $cardinality)),
         ));
     }
 
diff --git a/core/modules/field/lib/Drupal/field/Plugin/Type/Formatter/FormatterPluginManager.php b/core/modules/field/lib/Drupal/field/Plugin/Type/Formatter/FormatterPluginManager.php
index 6eb0c9a..39deee9 100644
--- a/core/modules/field/lib/Drupal/field/Plugin/Type/Formatter/FormatterPluginManager.php
+++ b/core/modules/field/lib/Drupal/field/Plugin/Type/Formatter/FormatterPluginManager.php
@@ -9,10 +9,6 @@
 
 use Drupal\Component\Plugin\PluginManagerBase;
 use Drupal\Component\Plugin\Factory\DefaultFactory;
-use Drupal\Core\Cache\CacheBackendInterface;
-use Drupal\Core\Extension\ModuleHandlerInterface;
-use Drupal\Core\Language\LanguageManager;
-use Drupal\Core\Plugin\DefaultPluginManager;
 use Drupal\Core\Plugin\Discovery\CacheDecorator;
 use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
 use Drupal\Core\Plugin\Discovery\AlterDecorator;
@@ -21,7 +17,7 @@
 /**
  * Plugin type manager for field formatters.
  */
-class FormatterPluginManager extends DefaultPluginManager {
+class FormatterPluginManager extends PluginManagerBase {
 
   /**
    * An array of formatter options for each field type.
@@ -35,21 +31,13 @@ class FormatterPluginManager extends DefaultPluginManager {
    *
    * @param \Traversable $namespaces
    *   An object that implements \Traversable which contains the root paths
-   *   keyed by the corresponding namespace to look for plugin implementations.
-   * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend
-   *   Cache backend instance to use.
-   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
-   *   The module handler.
-   * @param \Drupal\Core\Language\LanguageManager $language_manager
-   *   The language manager.
+   *   keyed by the corresponding namespace to look for plugin implementations,
    */
-  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, LanguageManager $language_manager) {
+  public function __construct(\Traversable $namespaces) {
     $annotation_namespaces = array('Drupal\field\Annotation' => $namespaces['Drupal\field']);
-
-    parent::__construct('field/formatter', $namespaces, $annotation_namespaces, 'Drupal\field\Annotation\FieldFormatter');
-
-    $this->setCacheBackend($cache_backend, $language_manager, 'field_formatter_types');
-    $this->alterInfo($module_handler, 'field_formatter_info');
+    $this->discovery = new AnnotatedClassDiscovery('field/formatter', $namespaces, $annotation_namespaces, 'Drupal\field\Annotation\FieldFormatter');
+    $this->discovery = new AlterDecorator($this->discovery, 'field_formatter_info');
+    $this->discovery = new CacheDecorator($this->discovery, 'field_formatter_types', 'field');
   }
 
   /**
@@ -58,15 +46,6 @@ public function __construct(\Traversable $namespaces, CacheBackendInterface $cac
   public function createInstance($plugin_id, array $configuration) {
     $plugin_definition = $this->discovery->getDefinition($plugin_id);
     $plugin_class = DefaultFactory::getPluginClass($plugin_id, $plugin_definition);
-
-    // @todo This is copied from \Drupal\Core\Plugin\Factory\ContainerFactory.
-    //   Find a way to restore sanity to
-    //   \Drupal\field\Plugin\Type\Formatter\FormatterBase::__construct().
-    // If the plugin provides a factory method, pass the container to it.
-    if (is_subclass_of($plugin_class, 'Drupal\Core\Plugin\ContainerFactoryPluginInterface')) {
-      return $plugin_class::create(\Drupal::getContainer(), $configuration, $plugin_id, $plugin_definition);
-    }
-
     return new $plugin_class($plugin_id, $plugin_definition, $configuration['field_definition'], $configuration['settings'], $configuration['label'], $configuration['view_mode']);
   }
 
diff --git a/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetPluginManager.php b/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetPluginManager.php
index 673f4c1..b8213ca 100644
--- a/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetPluginManager.php
+++ b/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetPluginManager.php
@@ -9,10 +9,6 @@
 
 use Drupal\Component\Plugin\PluginManagerBase;
 use Drupal\Component\Plugin\Discovery\ProcessDecorator;
-use Drupal\Core\Cache\CacheBackendInterface;
-use Drupal\Core\Extension\ModuleHandlerInterface;
-use Drupal\Core\Language\LanguageManager;
-use Drupal\Core\Plugin\DefaultPluginManager;
 use Drupal\Core\Plugin\Discovery\CacheDecorator;
 use Drupal\Core\Plugin\Discovery\AlterDecorator;
 use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
@@ -20,7 +16,7 @@
 /**
  * Plugin type manager for field widgets.
  */
-class WidgetPluginManager extends DefaultPluginManager {
+class WidgetPluginManager extends PluginManagerBase {
 
   /**
    * An array of widget options for each field type.
@@ -44,21 +40,15 @@ class WidgetPluginManager extends DefaultPluginManager {
    *
    * @param \Traversable $namespaces
    *   An object that implements \Traversable which contains the root paths
-   *   keyed by the corresponding namespace to look for plugin implementations.
-   * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend
-   *   Cache backend instance to use.
-   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
-   *   The module handler.
-   * @param \Drupal\Core\Language\LanguageManager $language_manager
-   *   The language manager.
+   *   keyed by the corresponding namespace to look for plugin implementations,
    */
-  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, LanguageManager $language_manager) {
-    parent::__construct('field/widget', $namespaces);
+  public function __construct(\Traversable $namespaces) {
+    $this->discovery = new AnnotatedClassDiscovery('field/widget', $namespaces);
+    $this->discovery = new ProcessDecorator($this->discovery, array($this, 'processDefinition'));
+    $this->discovery = new AlterDecorator($this->discovery, 'field_widget_info');
+    $this->discovery = new CacheDecorator($this->discovery, 'field_widget_types',  'field');
 
-    $this->setCacheBackend($cache_backend, $language_manager, 'field_widget_types');
-    $this->alterInfo($module_handler, 'field_widget_info');
-
-    $this->factory = new WidgetFactory($this);
+    $this->factory = new WidgetFactory($this->discovery);
   }
 
   /**
diff --git a/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php b/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php
index 2346271..3604142 100644
--- a/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php
+++ b/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php
@@ -393,6 +393,7 @@ public function buildOptionsForm(&$form, &$form_state) {
         '#options' => drupal_map_assoc($column_names),
         '#default_value' => $this->options['click_sort_column'],
         '#description' => t('Used by Style: Table to determine the actual column to click sort the field on. The default is usually fine.'),
+        '#fieldset' => 'more',
       );
     }
 
diff --git a/core/modules/field/tests/modules/field_test_views/test_views/views.view.test_view_fieldapi.yml b/core/modules/field/tests/modules/field_test_views/test_views/views.view.test_view_fieldapi.yml
index 940848f..8d55b5a 100644
--- a/core/modules/field/tests/modules/field_test_views/test_views/views.view.test_view_fieldapi.yml
+++ b/core/modules/field/tests/modules/field_test_views/test_views/views.view.test_view_fieldapi.yml
@@ -13,13 +13,11 @@ display:
           id: nid
           table: node
           plugin_id: node
-          provider: node
         field_name_0:
           id: field_name_0
           table: field_data_field_name_0
           field: field_name_0
           plugin_id: field
-          provider: field
       cache:
         type: none
       exposed_form:
diff --git a/core/modules/field_sql_storage/lib/Drupal/field_sql_storage/Tests/FieldSqlStorageTest.php b/core/modules/field_sql_storage/lib/Drupal/field_sql_storage/Tests/FieldSqlStorageTest.php
index fce0a52..e62b777 100644
--- a/core/modules/field_sql_storage/lib/Drupal/field_sql_storage/Tests/FieldSqlStorageTest.php
+++ b/core/modules/field_sql_storage/lib/Drupal/field_sql_storage/Tests/FieldSqlStorageTest.php
@@ -523,8 +523,8 @@ function testFieldSqlStorageForeignKeys() {
 
     // Retrieve the field definition and check that the foreign key is in place.
     $field = field_info_field($field_name);
-    $this->assertEqual($schema['foreign keys'][$foreign_key_name]['table'], $foreign_key_name, 'Foreign key table name modified after update');
-    $this->assertEqual($schema['foreign keys'][$foreign_key_name]['columns'][$foreign_key_name], 'id', 'Foreign key column name modified after update');
+    $this->assertEqual($schema['foreign keys'][$foreign_key_name]['table'], $foreign_key_name, t('Foreign key table name modified after update'));
+    $this->assertEqual($schema['foreign keys'][$foreign_key_name]['columns'][$foreign_key_name], 'id', t('Foreign key column name modified after update'));
 
     // Verify the SQL schema.
     $schemas = _field_sql_storage_schema($field);
diff --git a/core/modules/field_ui/lib/Drupal/field_ui/Access/FormModeAccessCheck.php b/core/modules/field_ui/lib/Drupal/field_ui/Access/FormModeAccessCheck.php
index 871db1f..dfbefe7 100644
--- a/core/modules/field_ui/lib/Drupal/field_ui/Access/FormModeAccessCheck.php
+++ b/core/modules/field_ui/lib/Drupal/field_ui/Access/FormModeAccessCheck.php
@@ -7,20 +7,20 @@
 
 namespace Drupal\field_ui\Access;
 
-use Drupal\Core\Access\StaticAccessCheckInterface;
+use Drupal\Core\Access\AccessCheckInterface;
 use Symfony\Component\Routing\Route;
 use Symfony\Component\HttpFoundation\Request;
 
 /**
  * Allows access to routes to be controlled by an '_access' boolean parameter.
  */
-class FormModeAccessCheck implements StaticAccessCheckInterface {
+class FormModeAccessCheck implements AccessCheckInterface {
 
   /**
    * {@inheritdoc}
    */
-  public function appliesTo() {
-    return array('_field_ui_form_mode_access');
+  public function applies(Route $route) {
+    return array_key_exists('_field_ui_form_mode_access', $route->getRequirements());
   }
 
   /**
diff --git a/core/modules/field_ui/lib/Drupal/field_ui/Access/ViewModeAccessCheck.php b/core/modules/field_ui/lib/Drupal/field_ui/Access/ViewModeAccessCheck.php
index e0c3c92..f82ede6 100644
--- a/core/modules/field_ui/lib/Drupal/field_ui/Access/ViewModeAccessCheck.php
+++ b/core/modules/field_ui/lib/Drupal/field_ui/Access/ViewModeAccessCheck.php
@@ -7,20 +7,20 @@
 
 namespace Drupal\field_ui\Access;
 
-use Drupal\Core\Access\StaticAccessCheckInterface;
+use Drupal\Core\Access\AccessCheckInterface;
 use Symfony\Component\Routing\Route;
 use Symfony\Component\HttpFoundation\Request;
 
 /**
  * Allows access to routes to be controlled by an '_access' boolean parameter.
  */
-class ViewModeAccessCheck implements StaticAccessCheckInterface {
+class ViewModeAccessCheck implements AccessCheckInterface {
 
   /**
    * {@inheritdoc}
    */
-  public function appliesTo() {
-    return array('_field_ui_view_mode_access');
+  public function applies(Route $route) {
+    return array_key_exists('_field_ui_view_mode_access', $route->getRequirements());
   }
 
   /**
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 645ae95..cd7037f 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
@@ -330,7 +330,7 @@ function testDefaultValue() {
       ->save();
 
     $this->drupalGet($admin_path);
-    $this->assertNoFieldById($element_id, '', 'No default value was possible for widget that disables default value.');
+    $this->assertNoFieldById($element_id, '', t('No default value was possible for widget that disables default value.'));
   }
 
   /**
diff --git a/core/modules/file/config/entity.view_mode.file.full.yml b/core/modules/file/config/entity.view_mode.file.full.yml
new file mode 100644
index 0000000..60808f9
--- /dev/null
+++ b/core/modules/file/config/entity.view_mode.file.full.yml
@@ -0,0 +1,4 @@
+id: file.full
+label: File default
+status: '0'
+targetEntityType: file
diff --git a/core/modules/file/file.module b/core/modules/file/file.module
index 0d66adb..bcdb460 100644
--- a/core/modules/file/file.module
+++ b/core/modules/file/file.module
@@ -400,7 +400,7 @@ function file_validate_size(File $file, $file_limit = 0, $user_limit = 0) {
   }
 
   // Save a query by only calling spaceUsed() when a limit is provided.
-  if ($user_limit && (Drupal::entityManager()->getStorageController('file')->spaceUsed($user->id()) + $file->getSize()) > $user_limit) {
+  if ($user_limit && (Drupal::entityManager()->getStorageController('file')->spaceUsed($user->uid) + $file->getSize()) > $user_limit) {
     $errors[] = t('The file is %filesize which would exceed your disk quota of %quota.', array('%filesize' => format_size($file->getSize()), '%quota' => format_size($user_limit)));
   }
 
@@ -525,7 +525,7 @@ function file_save_data($data, $destination = NULL, $replace = FILE_EXISTS_RENAM
     // Create a file entity.
     $file = entity_create('file', array(
       'uri' => $uri,
-      'uid' => $user->id(),
+      'uid' => $user->uid,
       'status' => FILE_STATUS_PERMANENT,
     ));
     // If we are replacing an existing file re-use its database record.
@@ -635,7 +635,7 @@ function file_file_download($uri, $field_type = 'file') {
   // temporary files where the host entity has not yet been saved (for example,
   // an image preview on a node/add form) in which case, allow download by the
   // file's owner.
-  if (empty($references) && ($file->isPermanent() || $file->getOwner()->id() != $user->id())) {
+  if (empty($references) && ($file->isPermanent() || $file->getOwner()->id() != $user->uid)) {
     return;
   }
 
diff --git a/core/modules/file/lib/Drupal/file/Plugin/entity_reference/selection/FileSelection.php b/core/modules/file/lib/Drupal/file/Plugin/entity_reference/selection/FileSelection.php
index 87922a4..0f48e36 100644
--- a/core/modules/file/lib/Drupal/file/Plugin/entity_reference/selection/FileSelection.php
+++ b/core/modules/file/lib/Drupal/file/Plugin/entity_reference/selection/FileSelection.php
@@ -7,15 +7,17 @@
 
 namespace Drupal\file\Plugin\entity_reference\selection;
 
+use Drupal\Component\Annotation\Plugin;
 use Drupal\Core\Annotation\Translation;
-use Drupal\entity_reference\Annotation\EntityReferenceSelection;
+use Drupal\Core\Database\Query\SelectInterface;
 use Drupal\entity_reference\Plugin\entity_reference\selection\SelectionBase;
 
 /**
  * Provides specific access control for the file entity type.
  *
- * @EntityReferenceSelection(
+ * @Plugin(
  *   id = "file_default",
+ *   module = "file",
  *   label = @Translation("File selection"),
  *   entity_types = {"file"},
  *   group = "default",
@@ -25,7 +27,7 @@
 class FileSelection extends SelectionBase {
 
   /**
-   * {@inheritdoc}
+   * Overrides SelectionBase::buildEntityQuery().
    */
   public function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS') {
     $query = parent::buildEntityQuery($match, $match_operator);
diff --git a/core/modules/file/lib/Drupal/file/Plugin/views/field/Extension.php b/core/modules/file/lib/Drupal/file/Plugin/views/field/Extension.php
index ff98cfd..a6e38ce 100644
--- a/core/modules/file/lib/Drupal/file/Plugin/views/field/Extension.php
+++ b/core/modules/file/lib/Drupal/file/Plugin/views/field/Extension.php
@@ -41,7 +41,7 @@ public function buildOptionsForm(&$form, &$form_state) {
     );
   }
 
-  public function render($values) {
+  function render($values) {
     $value = $this->getValue($values);
     if (!$this->options['extension_detect_tar']) {
       if (preg_match('/\.([^\.]+)$/', $value, $match)) {
diff --git a/core/modules/file/lib/Drupal/file/Plugin/views/field/File.php b/core/modules/file/lib/Drupal/file/Plugin/views/field/File.php
index 232fa71..22376c3 100644
--- a/core/modules/file/lib/Drupal/file/Plugin/views/field/File.php
+++ b/core/modules/file/lib/Drupal/file/Plugin/views/field/File.php
@@ -65,7 +65,7 @@ function render_link($data, $values) {
     return $data;
   }
 
-  public function render($values) {
+  function render($values) {
     $value = $this->getValue($values);
     return $this->render_link($this->sanitizeValue($value), $values);
   }
diff --git a/core/modules/file/lib/Drupal/file/Plugin/views/field/FileMime.php b/core/modules/file/lib/Drupal/file/Plugin/views/field/FileMime.php
index 5b69e10..a63c2d6 100644
--- a/core/modules/file/lib/Drupal/file/Plugin/views/field/FileMime.php
+++ b/core/modules/file/lib/Drupal/file/Plugin/views/field/FileMime.php
@@ -33,7 +33,7 @@ public function buildOptionsForm(&$form, &$form_state) {
     parent::buildOptionsForm($form, $form_state);
   }
 
-  public function render($values) {
+  function render($values) {
     $data = $values->{$this->field_alias};
     if (!empty($this->options['filemime_image']) && $data !== NULL && $data !== '') {
       $fake_file = (object) array('filemime' => $data);
diff --git a/core/modules/file/lib/Drupal/file/Plugin/views/field/Status.php b/core/modules/file/lib/Drupal/file/Plugin/views/field/Status.php
index 35179c4..719f4d6 100644
--- a/core/modules/file/lib/Drupal/file/Plugin/views/field/Status.php
+++ b/core/modules/file/lib/Drupal/file/Plugin/views/field/Status.php
@@ -19,7 +19,7 @@
  */
 class Status extends FieldPluginBase {
 
-  public function render($values) {
+  function render($values) {
     $value = $this->getValue($values);
     return _views_file_status($value);
   }
diff --git a/core/modules/file/lib/Drupal/file/Plugin/views/field/Uri.php b/core/modules/file/lib/Drupal/file/Plugin/views/field/Uri.php
index b568b0d..4e5eb5f 100644
--- a/core/modules/file/lib/Drupal/file/Plugin/views/field/Uri.php
+++ b/core/modules/file/lib/Drupal/file/Plugin/views/field/Uri.php
@@ -32,7 +32,7 @@ public function buildOptionsForm(&$form, &$form_state) {
     parent::buildOptionsForm($form, $form_state);
   }
 
-  public function render($values) {
+  function render($values) {
     $data = $values->{$this->field_alias};
     if (!empty($this->options['file_download_path']) && $data !== NULL && $data !== '') {
       $data = file_create_url($data);
diff --git a/core/modules/file/lib/Drupal/file/Plugin/views/wizard/File.php b/core/modules/file/lib/Drupal/file/Plugin/views/wizard/File.php
index da9809c..3b19b56 100644
--- a/core/modules/file/lib/Drupal/file/Plugin/views/wizard/File.php
+++ b/core/modules/file/lib/Drupal/file/Plugin/views/wizard/File.php
@@ -55,7 +55,6 @@ protected function defaultDisplayOptions() {
     $display_options['fields']['filename']['id'] = 'filename';
     $display_options['fields']['filename']['table'] = 'file_managed';
     $display_options['fields']['filename']['field'] = 'filename';
-    $display_options['fields']['filename']['provider'] = 'file';
     $display_options['fields']['filename']['label'] = '';
     $display_options['fields']['filename']['alter']['alter_text'] = 0;
     $display_options['fields']['filename']['alter']['make_link'] = 0;
diff --git a/core/modules/file/lib/Drupal/file/Tests/FileFieldRevisionTest.php b/core/modules/file/lib/Drupal/file/Tests/FileFieldRevisionTest.php
index bfe2414..84e23c3 100644
--- a/core/modules/file/lib/Drupal/file/Tests/FileFieldRevisionTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/FileFieldRevisionTest.php
@@ -99,7 +99,7 @@ function testRevisions() {
     $user->{$field_name}[Language::LANGCODE_NOT_SPECIFIED][0]['target_id'] = $node_file_r3->id();
     $user->{$field_name}[Language::LANGCODE_NOT_SPECIFIED][0]['display'] = 1;
     $user->save();
-    $this->drupalGet('user/' . $user->id() . '/edit');
+    $this->drupalGet('user/' . $user->uid . '/edit');
 
     // Delete the third revision and check that the file is not deleted yet.
     $this->drupalPost('node/' . $nid . '/revisions/' . $node_vid_r3 . '/delete', array(), t('Delete'));
@@ -108,7 +108,7 @@ function testRevisions() {
     $this->assertFileIsPermanent($node_file_r3, 'Second file entry is still permanent after deleting third revision, since it is being used by the user.');
 
     // Delete the user and check that the file is also deleted.
-    $user->delete();
+    user_delete($user->uid);
     // TODO: This seems like a bug in File API. Clearing the stat cache should
     // not be necessary here. The file really is deleted, but stream wrappers
     // doesn't seem to think so unless we clear the PHP file stat() cache.
diff --git a/core/modules/file/lib/Drupal/file/Type/FileItem.php b/core/modules/file/lib/Drupal/file/Type/FileItem.php
index c8f1a9c..9b2cc4c 100644
--- a/core/modules/file/lib/Drupal/file/Type/FileItem.php
+++ b/core/modules/file/lib/Drupal/file/Type/FileItem.php
@@ -28,23 +28,20 @@ class FileItem extends ConfigEntityReferenceItemBase {
    */
   public function getPropertyDefinitions() {
     $this->definition['settings']['target_type'] = 'file';
-    // Definitions vary by entity type and bundle, so key them accordingly.
-    $key = $this->definition['settings']['target_type'] . ':';
-    $key .= isset($this->definition['settings']['target_bundle']) ? $this->definition['settings']['target_bundle'] : '';
 
-    if (!isset(static::$propertyDefinitions[$key])) {
-      static::$propertyDefinitions[$key] = parent::getPropertyDefinitions();
+    if (!isset(static::$propertyDefinitions)) {
+      static::$propertyDefinitions = parent::getPropertyDefinitions();
 
-      static::$propertyDefinitions[$key]['display'] = array(
+      static::$propertyDefinitions['display'] = array(
         'type' => 'boolean',
         'label' => t('Flag to control whether this file should be displayed when viewing content.'),
       );
-      static::$propertyDefinitions[$key]['description'] = array(
+      static::$propertyDefinitions['description'] = array(
         'type' => 'string',
         'label' => t('A description of the file.'),
       );
     }
-    return static::$propertyDefinitions[$key];
+    return static::$propertyDefinitions;
   }
 
 }
diff --git a/core/modules/file/tests/modules/file_test_views/test_views/views.view.file_extension_view.yml b/core/modules/file/tests/modules/file_test_views/test_views/views.view.file_extension_view.yml
index 02cc72c..fac765f 100644
--- a/core/modules/file/tests/modules/file_test_views/test_views/views.view.file_extension_view.yml
+++ b/core/modules/file/tests/modules/file_test_views/test_views/views.view.file_extension_view.yml
@@ -17,21 +17,18 @@ display:
           relationship: none
           table: views_test_data
           plugin_id: numeric
-          provider: views_test_data
         id:
           field: id
           id: id
           relationship: none
           table: views_test_data
           plugin_id: numeric
-          provider: views_test_data
         name:
           field: name
           id: file_extension
           relationship: none
           table: views_test_data
           plugin_id: string
-          provider: views_test_data
       pager:
         options:
           offset: '0'
@@ -45,7 +42,6 @@ display:
           relationship: none
           table: views_test_data
           plugin_id: numeric
-          provider: views_test_data
     display_plugin: default
     display_title: Master
     id: default
diff --git a/core/modules/filter/filter.module b/core/modules/filter/filter.module
index 1a0d9d1..a58d7a2 100644
--- a/core/modules/filter/filter.module
+++ b/core/modules/filter/filter.module
@@ -155,6 +155,21 @@ function filter_menu() {
 }
 
 /**
+ * Implements hook_local_actions().
+ */
+function filter_local_actions() {
+  return array(
+    array(
+      'route_name' => 'filter_format_add',
+      'title' => t('Add text format'),
+      'appears_on' => array(
+        'filter_admin_overview',
+      ),
+    ),
+  );
+}
+
+/**
  * Loads a text format object from the database.
  *
  * @param $format_id
@@ -275,16 +290,16 @@ function filter_formats($account = NULL) {
   }
 
   // Build a list of user-specific formats.
-  if (isset($account) && !isset($formats['user'][$account->id()])) {
-    $formats['user'][$account->id()] = array();
+  if (isset($account) && !isset($formats['user'][$account->uid])) {
+    $formats['user'][$account->uid] = array();
     foreach ($formats['all'] as $format) {
       if (filter_access($format, $account)) {
-        $formats['user'][$account->id()][$format->format] = $format;
+        $formats['user'][$account->uid][$format->format] = $format;
       }
     }
   }
 
-  return isset($account) ? $formats['user'][$account->id()] : $formats['all'];
+  return isset($account) ? $formats['user'][$account->uid] : $formats['all'];
 }
 
 /**
diff --git a/core/modules/filter/lib/Drupal/filter/Access/FilterAccessCheck.php b/core/modules/filter/lib/Drupal/filter/Access/FilterAccessCheck.php
index 25918e8..39363ac 100644
--- a/core/modules/filter/lib/Drupal/filter/Access/FilterAccessCheck.php
+++ b/core/modules/filter/lib/Drupal/filter/Access/FilterAccessCheck.php
@@ -7,20 +7,20 @@
 
 namespace Drupal\filter\Access;
 
-use Drupal\Core\Access\StaticAccessCheckInterface;
+use Drupal\Core\Access\AccessCheckInterface;
 use Symfony\Component\Routing\Route;
 use Symfony\Component\HttpFoundation\Request;
 
 /**
  * Checks access for text formats.
  */
-class FilterAccessCheck implements StaticAccessCheckInterface {
+class FilterAccessCheck implements AccessCheckInterface {
 
   /**
    * {@inheritdoc}
    */
-  public function appliesTo() {
-    return array('_filter_access');
+  public function applies(Route $route) {
+    return array_key_exists('_filter_access', $route->getRequirements());
   }
 
   /**
diff --git a/core/modules/filter/lib/Drupal/filter/Access/FormatDisableCheck.php b/core/modules/filter/lib/Drupal/filter/Access/FormatDisableCheck.php
index 1f905bb..de5acea 100644
--- a/core/modules/filter/lib/Drupal/filter/Access/FormatDisableCheck.php
+++ b/core/modules/filter/lib/Drupal/filter/Access/FormatDisableCheck.php
@@ -7,20 +7,20 @@
 
 namespace Drupal\filter\Access;
 
-use Drupal\Core\Access\StaticAccessCheckInterface;
+use Drupal\Core\Access\AccessCheckInterface;
 use Symfony\Component\Routing\Route;
 use Symfony\Component\HttpFoundation\Request;
 
 /**
  * Checks access for disabling text formats.
  */
-class FormatDisableCheck implements StaticAccessCheckInterface {
+class FormatDisableCheck implements AccessCheckInterface {
 
   /**
-   * {@inheritdoc}
+   * Implements \Drupal\Core\Access\AccessCheckInterface::applies().
    */
-  public function appliesTo() {
-    return array('_filter_disable_format_access');
+  public function applies(Route $route) {
+    return array_key_exists('_filter_disable_format_access', $route->getRequirements());
   }
 
   /**
diff --git a/core/modules/filter/lib/Drupal/filter/FilterFormatAccessController.php b/core/modules/filter/lib/Drupal/filter/FilterFormatAccessController.php
index 1242b94..133c309 100644
--- a/core/modules/filter/lib/Drupal/filter/FilterFormatAccessController.php
+++ b/core/modules/filter/lib/Drupal/filter/FilterFormatAccessController.php
@@ -36,11 +36,4 @@ protected function checkAccess(EntityInterface $entity, $operation, $langcode, A
     return !empty($permission) && user_access($permission, $account);
   }
 
-  /**
-   * {@inheritdoc}
-   */
-  protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) {
-    return user_access('administer filters', $account);
-  }
-
 }
diff --git a/core/modules/filter/lib/Drupal/filter/Plugin/Filter/FilterAutoP.php b/core/modules/filter/lib/Drupal/filter/Plugin/Filter/FilterAutoP.php
index 630e653..62d3649 100644
--- a/core/modules/filter/lib/Drupal/filter/Plugin/Filter/FilterAutoP.php
+++ b/core/modules/filter/lib/Drupal/filter/Plugin/Filter/FilterAutoP.php
@@ -35,7 +35,7 @@ public function process($text, $langcode, $cache, $cache_id) {
    */
   public function tips($long = FALSE) {
     if ($long) {
-      return t('Lines and paragraphs are automatically recognized. The &lt;br /&gt; line break, &lt;p&gt; paragraph and &lt;/p&gt; close paragraph tags are inserted automatically. If paragraphs are not recognized simply add a couple of blank lines.');
+      return t('Lines and paragraphs are automatically recognized. The &lt;br /&gt; line break, &lt;p&gt; paragraph and &lt;/p&gt; close paragraph tags are inserted automatically. If paragraphs are not recognized simply add a couple blank lines.');
     }
     else {
       return t('Lines and paragraphs break automatically.');
diff --git a/core/modules/filter/lib/Drupal/filter/Plugin/Menu/LocalAction/AddFilterFormatLocalAction.php b/core/modules/filter/lib/Drupal/filter/Plugin/Menu/LocalAction/AddFilterFormatLocalAction.php
deleted file mode 100644
index f42bb88..0000000
--- a/core/modules/filter/lib/Drupal/filter/Plugin/Menu/LocalAction/AddFilterFormatLocalAction.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\filter\Plugin\Menu\AddFilterFormatLocalAction.
- */
-
-namespace Drupal\filter\Plugin\Menu\LocalAction;
-
-use Drupal\Core\Annotation\Translation;
-use Drupal\Core\Menu\LocalActionBase;
-use Drupal\Core\Annotation\Menu\LocalAction;
-
-/**
- * @LocalAction(
- *   id = "filter_format_add_local_action",
- *   route_name = "filter_format_add",
- *   title = @Translation("Add text format"),
- *   appears_on = {"filter_admin_overview"}
- * )
- */
-class AddFilterFormatLocalAction extends LocalActionBase {
-
-}
diff --git a/core/modules/forum/config/rdf.mapping.node.forum.yml b/core/modules/forum/config/rdf.mapping.node.forum.yml
index ea86bc5..1b6d1c7 100644
--- a/core/modules/forum/config/rdf.mapping.node.forum.yml
+++ b/core/modules/forum/config/rdf.mapping.node.forum.yml
@@ -2,27 +2,10 @@ id: node.forum
 targetEntityType: node
 bundle: forum
 types:
-  - 'schema:Discussion'
+  - 'sioc:Post'
+  - 'sioct:BoardPost'
 fieldMappings:
-  title:
+  taxonomy_forums:
     properties:
-      - 'schema:name'
-  created:
-    properties:
-      - 'schema:dateCreated'
-    datatype_callback: 'date_iso8601'
-  changed:
-    properties:
-      - 'schema:dateModified'
-    datatype_callback: 'date_iso8601'
-  body:
-    properties:
-      - 'schema:text'
-  uid:
-    properties:
-      - 'schema:author'
+      - 'sioc:has_container'
     mapping_type: 'rel'
-  comment_count:
-    properties:
-      - 'schema:interactionCount'
-    datatype_callback: 'Drupal\rdf\SchemaOrgDataConverter::interactionCount'
diff --git a/core/modules/forum/config/rdf.mapping.taxonomy_term.forums.yml b/core/modules/forum/config/rdf.mapping.taxonomy_term.forums.yml
index aaaf536..f412f6a 100644
--- a/core/modules/forum/config/rdf.mapping.taxonomy_term.forums.yml
+++ b/core/modules/forum/config/rdf.mapping.taxonomy_term.forums.yml
@@ -4,10 +4,3 @@ bundle: forums
 types:
   - 'sioc:Container'
   - 'sioc:Forum'
-fieldMappings:
-  name:
-    properties:
-      - 'schema:name'
-  description:
-    properties:
-      - 'schema:description'
diff --git a/core/modules/forum/forum.admin.inc b/core/modules/forum/forum.admin.inc
index b3accfb..2a8a50d 100644
--- a/core/modules/forum/forum.admin.inc
+++ b/core/modules/forum/forum.admin.inc
@@ -8,6 +8,209 @@
 use Drupal\taxonomy\Plugin\Core\Entity\Term;
 
 /**
+ * Page callback: Returns a form for creating a new forum or container.
+ *
+ * @param $type
+ *   What is being added. Possible values are 'forum' and 'container'.
+ * @param \Drupal\taxonomy\Plugin\Core\Entity\Term $term
+ *   (optional) A forum or container term to be edited. Defaults to NULL.
+ *
+ * @return
+ *   A form for creating a new forum or container.
+ *
+ * @see forum_menu()
+ */
+function forum_form_main($type, Term $term = NULL) {
+  if (!$term) {
+    $term = entity_create('taxonomy_term', array('vid' => config('forum.settings')->get('vocabulary')));
+  }
+
+  switch ($type) {
+    case 'forum':
+      return drupal_get_form('forum_form_forum', $term);
+      break;
+    case 'container':
+      return drupal_get_form('forum_form_container', $term);
+      break;
+  }
+}
+
+/**
+ * Form constructor for adding and editing a forum.
+ *
+ * @param \Drupal\taxonomy\Plugin\Core\Entity\Term $term
+ *   A forum term to be edited.
+ *
+ * @see forum_form_submit()
+ * @ingroup forms
+ */
+function forum_form_forum($form, &$form_state, Term $term) {
+  $form['name'] = array('#type' => 'textfield',
+    '#title' => t('Forum name'),
+    '#default_value' => $term->name->value,
+    '#maxlength' => 255,
+    '#description' => t('Short but meaningful name for this collection of threaded discussions.'),
+    '#required' => TRUE,
+  );
+  $form['description'] = array('#type' => 'textarea',
+    '#title' => t('Description'),
+    '#default_value' => $term->description->value,
+    '#description' => t('Description and guidelines for discussions within this forum.'),
+  );
+  $form['parent']['#tree'] = TRUE;
+  $form['parent'][0] = _forum_parent_select($term->id(), t('Parent'), 'forum');
+  $form['weight'] = array('#type' => 'weight',
+    '#title' => t('Weight'),
+    '#default_value' => $term->weight->value,
+    '#description' => t('Forums are displayed in ascending order by weight (forums with equal weights are displayed alphabetically).'),
+  );
+
+  $form['vid'] = array('#type' => 'hidden', '#value' => config('forum.settings')->get('vocabulary'));
+  $form['actions'] = array('#type' => 'actions');
+  $form['actions']['submit'] = array(
+    '#type' => 'submit',
+    '#value' => t('Save'),
+    '#button_type' => 'primary',
+    '#submit' => array('forum_form_submit')
+  );
+  if (!$term->isNew()) {
+    $form['actions']['delete'] = array(
+      '#type' => 'submit',
+      '#value' => t('Delete'),
+      '#submit' => array('forum_forum_delete'),
+    );
+    $form['tid'] = array('#type' => 'value', '#value' => $term->id());
+  }
+  $form['#theme'] = 'forum_form';
+
+  return $form;
+}
+
+/**
+ * Form submission handler for forum_form_forum() and forum_form_container().
+ */
+function forum_form_submit($form, &$form_state) {
+  $config = config('forum.settings');
+  if ($form['form_id']['#value'] == 'forum_form_container') {
+    $container = TRUE;
+    $type = t('forum container');
+  }
+  else {
+    $container = FALSE;
+    $type = t('forum');
+  }
+
+  // @todo Set explicit entity properties instead of arbitrary form values.
+  form_state_values_clean($form_state);
+  $term = entity_create('taxonomy_term', $form_state['values']);
+  $status = $term->save();
+  switch ($status) {
+    case SAVED_NEW:
+      if ($container) {
+        $containers = $config->get('containers');
+        $containers[] = $term->id();
+        $config->set('containers', $containers)->save();
+      }
+      $form_state['values']['tid'] = $term->id();
+      drupal_set_message(t('Created new @type %term.', array('%term' => $form_state['values']['name'], '@type' => $type)));
+      break;
+    case SAVED_UPDATED:
+      drupal_set_message(t('The @type %term has been updated.', array('%term' => $form_state['values']['name'], '@type' => $type)));
+      // Clear the page and block caches to avoid stale data.
+      cache_invalidate_tags(array('content' => TRUE));
+      break;
+  }
+  $form_state['redirect'] = 'admin/structure/forum';
+}
+
+/**
+ * Returns HTML for a forum form.
+ *
+ * By default this does not alter the appearance of a form at all, but is
+ * provided as a convenience for themers.
+ *
+ * @param $variables
+ *   An associative array containing:
+ *   - form: A render element representing the form.
+ *
+ * @ingroup themeable
+ */
+function theme_forum_form($variables) {
+  return drupal_render_children($variables['form']);
+}
+
+/**
+ * Form constructor for adding and editing forum containers.
+ *
+ * @param \Drupal\taxonomy\Plugin\Core\Entity\Term $term
+ *   A container term to be edited.
+ *
+ * @see forum_form_submit()
+ * @ingroup forms
+ */
+function forum_form_container($form, &$form_state, Term $term) {
+  $config = config('forum.settings');
+  // Handle a delete operation.
+  $form['name'] = array(
+    '#title' => t('Container name'),
+    '#type' => 'textfield',
+    '#default_value' => $term->name->value,
+    '#maxlength' => 255,
+    '#description' => t('Short but meaningful name for this collection of related forums.'),
+    '#required' => TRUE
+  );
+
+  $form['description'] = array(
+    '#type' => 'textarea',
+    '#title' => t('Description'),
+    '#default_value' => $term->description->value,
+    '#description' => t('Description and guidelines for forums within this container.')
+  );
+  $form['parent']['#tree'] = TRUE;
+  $form['parent'][0] = _forum_parent_select($term->id(), t('Parent'), 'container');
+  $form['weight'] = array(
+    '#type' => 'weight',
+    '#title' => t('Weight'),
+    '#default_value' => $term->weight->value,
+    '#description' => t('Containers are displayed in ascending order by weight (containers with equal weights are displayed alphabetically).')
+  );
+
+  $form['vid'] = array(
+    '#type' => 'hidden',
+    '#value' => $config->get('vocabulary'),
+  );
+  $form['actions'] = array('#type' => 'actions');
+  $form['actions']['submit'] = array(
+    '#type' => 'submit',
+    '#value' => t('Save'),
+    '#button_type' => 'primary',
+    '#submit' => array('forum_form_submit'),
+  );
+  if (!$term->isNew()) {
+    $form['actions']['delete'] = array(
+      '#type' => 'submit',
+      '#value' => t('Delete'),
+      '#submit' => array('forum_forum_delete'),
+    );
+    $form['tid'] = array('#type' => 'value', '#value' => $term->id());
+  }
+  $form['#theme'] = 'forum_form';
+
+  return $form;
+}
+
+/**
+ * Form submission handler for forum_form_forum() and forum_form_container().
+ *
+ * Handler for when 'delete' is clicked.
+ *
+ * @see \Drupal\forum\Form\DeleteForm
+ */
+function forum_forum_delete($form, &$form_state) {
+  $form_state['redirect'] = 'admin/structure/forum/delete/forum/' . $form_state['values']['tid'];
+}
+
+/**
  * Form constructor for the forum overview form.
  *
  * Returns a form for controlling the hierarchy of existing forums and
@@ -54,3 +257,55 @@ function forum_overview($form, &$form_state) {
   $form['terms']['#empty'] = t('No containers or forums available. <a href="@container">Add container</a> or <a href="@forum">Add forum</a>.', array('@container' => url('admin/structure/forum/add/container'), '@forum' => url('admin/structure/forum/add/forum')));
   return $form;
 }
+
+/**
+ * Returns a select box for available parent terms.
+ *
+ * @param $tid
+ *   ID of the term that is being added or edited.
+ * @param $title
+ *   Title for the select box.
+ * @param $child_type
+ *   Whether the child is a forum or a container.
+ *
+ * @return
+ *   A select form element.
+ */
+function _forum_parent_select($tid, $title, $child_type) {
+
+  $parents = taxonomy_term_load_parents($tid);
+  if ($parents) {
+    $parent = array_shift($parents);
+    $parent = $parent->id();
+  }
+  else {
+    $parent = 0;
+  }
+
+  $vid = config('forum.settings')->get('vocabulary');
+  $children = taxonomy_get_tree($vid, $tid, NULL, TRUE);
+
+  // A term can't be the child of itself, nor of its children.
+  foreach ($children as $child) {
+    $exclude[] = $child->id();
+  }
+  $exclude[] = $tid;
+
+  $tree = taxonomy_get_tree($vid, 0, NULL, TRUE);
+  $options[0] = '<' . t('root') . '>';
+  if ($tree) {
+    foreach ($tree as $term) {
+      if (!in_array($term->id(), $exclude)) {
+        $options[$term->id()] = str_repeat(' -- ', $term->depth) . $term->label();
+      }
+    }
+  }
+  if ($child_type == 'container') {
+    $description = t('Containers are usually placed at the top (root) level, but may also be placed inside another container or forum.');
+  }
+  elseif ($child_type == 'forum') {
+    $description = t('Forums may be placed at the top (root) level, or inside another container or forum.');
+  }
+
+  return array('#type' => 'select', '#title' => $title, '#default_value' => $parent, '#options' => $options, '#description' => $description, '#required' => TRUE);
+}
diff --git a/core/modules/forum/forum.module b/core/modules/forum/forum.module
index 1cbfa85..5f7c9d2 100644
--- a/core/modules/forum/forum.module
+++ b/core/modules/forum/forum.module
@@ -44,19 +44,7 @@ function forum_help($path, $arg) {
       return $output;
     case 'admin/structure/forum':
       $output = '<p>' . t('Forums contain forum topics. Use containers to group related forums.') . '</p>';
-      $more_help_link = array(
-        '#type' => 'link',
-        '#href' => 'admin/help/forum',
-        '#title' => t('More help'),
-      );
-      $container = array(
-        '#theme' => 'container',
-        '#children' => drupal_render($more_help_link),
-        '#attributes' => array(
-          'class' => array('more-help-link'),
-        ),
-      );
-      $output = drupal_render($container);
+      $output .= theme('more_help_link', array('url' => 'admin/help/forum'));
       return $output;
     case 'admin/structure/forum/add/container':
       return '<p>' . t('Use containers to group related forums.') . '</p>';
@@ -132,13 +120,21 @@ function forum_menu() {
   );
   $items['admin/structure/forum/add/container'] = array(
     'title' => 'Add container',
-    'tab_parent' => 'admin/structure/forum',
-    'route_name' => 'forum_add_container',
+    'page callback' => 'forum_form_main',
+    'page arguments' => array('container'),
+    'access arguments' => array('administer forums'),
+    'type' => MENU_LOCAL_ACTION,
+    'parent' => 'admin/structure/forum',
+    'file' => 'forum.admin.inc',
   );
   $items['admin/structure/forum/add/forum'] = array(
-    'tab_parent' => 'admin/structure/forum',
     'title' => 'Add forum',
-    'route_name' => 'forum_add_forum',
+    'page callback' => 'forum_form_main',
+    'page arguments' => array('forum'),
+    'access arguments' => array('administer forums'),
+    'type' => MENU_LOCAL_ACTION,
+    'parent' => 'admin/structure/forum',
+    'file' => 'forum.admin.inc',
   );
   $items['admin/structure/forum/settings'] = array(
     'title' => 'Settings',
@@ -149,11 +145,17 @@ function forum_menu() {
   );
   $items['admin/structure/forum/edit/container/%taxonomy_term'] = array(
     'title' => 'Edit container',
-    'route_name' => 'forum_edit_container',
+    'page callback' => 'forum_form_main',
+    'page arguments' => array('container', 5),
+    'access arguments' => array('administer forums'),
+    'file' => 'forum.admin.inc',
   );
   $items['admin/structure/forum/edit/forum/%taxonomy_term'] = array(
     'title' => 'Edit forum',
-    'route_name' => 'forum_edit_forum',
+    'page callback' => 'forum_form_main',
+    'page arguments' => array('forum', 5),
+    'access arguments' => array('administer forums'),
+    'file' => 'forum.admin.inc',
   );
   return $items;
 }
@@ -185,7 +187,7 @@ function forum_menu_local_tasks(&$data, $router_item, $root_path) {
       }
       if (empty($links)) {
         // Authenticated user does not have access to create new topics.
-        if ($user->isAuthenticated()) {
+        if ($user->uid) {
           $links['disallowed'] = array(
             '#theme' => 'menu_local_action',
             '#link' => array(
@@ -224,15 +226,6 @@ function forum_menu_local_tasks_alter(&$data, $router_item, $root_path) {
 }
 
 /**
- * Implements hook_entity_info().
- */
-function forum_entity_info(&$info) {
-  // Register forum specific form controllers.
-  $info['taxonomy_term']['controllers']['form']['forum'] = 'Drupal\forum\Form\ForumFormController';
-  $info['taxonomy_term']['controllers']['form']['container'] = 'Drupal\forum\Form\ContainerFormController';
-}
-
-/**
  * Implements hook_entity_bundle_info_alter().
  */
 function forum_entity_bundle_info_alter(&$bundles) {
@@ -245,7 +238,7 @@ function forum_entity_bundle_info_alter(&$bundles) {
 }
 
 /**
- * Entity URI callback used in forum_entity_bundle_info_alter().
+ * Entity URI callback used in forum_entity_info_alter().
  */
 function forum_uri($forum) {
   return array(
@@ -907,7 +900,7 @@ function forum_get_topics($tid, $sortby, $forum_per_page) {
   $topics = array();
   $first_new_found = FALSE;
   foreach ($result as $topic) {
-    if ($user->isAuthenticated()) {
+    if ($user->uid) {
       // A forum is new if the topic is new, or if there are new comments since
       // the user's last visit.
       if ($topic->forum_tid != $tid) {
@@ -1055,8 +1048,8 @@ function template_preprocess_forum_list(&$variables) {
     $variables['forums'][$id]->old_topics = $forum->num_topics;
     $variables['forums'][$id]->icon_class = 'default';
     $variables['forums'][$id]->icon_title = t('No new posts');
-    if ($user->isAuthenticated()) {
-      $variables['forums'][$id]->new_topics = _forum_topics_unread($forum->id(), $user->id());
+    if ($user->uid) {
+      $variables['forums'][$id]->new_topics = _forum_topics_unread($forum->id(), $user->uid);
       if ($variables['forums'][$id]->new_topics) {
         $variables['forums'][$id]->new_text = format_plural($variables['forums'][$id]->new_topics, '1 new post<span class="visually-hidden"> in forum %title</span>', '@count new posts<span class="visually-hidden"> in forum %title</span>', array('%title' => $variables['forums'][$id]->label()));
         $variables['forums'][$id]->new_url = url('forum/' . $forum->id(), array('fragment' => 'new'));
@@ -1206,7 +1199,7 @@ function template_preprocess_forum_icon(&$variables) {
  *   - topic: The topic object.
  */
 function template_preprocess_forum_submitted(&$variables) {
-  $variables['author'] = isset($variables['topic']->uid) ? theme('username', array('account' => user_load($variables['topic']->uid))) : '';
+  $variables['author'] = isset($variables['topic']->uid) ? theme('username', array('account' => $variables['topic'])) : '';
   $variables['time'] = isset($variables['topic']->created) ? format_interval(REQUEST_TIME - $variables['topic']->created) : '';
 }
 
@@ -1225,7 +1218,7 @@ function _forum_user_last_visit($nid) {
   $history = &drupal_static(__FUNCTION__, array());
 
   if (empty($history)) {
-    $result = db_query('SELECT nid, timestamp FROM {history} WHERE uid = :uid', array(':uid' => $user->id()));
+    $result = db_query('SELECT nid, timestamp FROM {history} WHERE uid = :uid', array(':uid' => $user->uid));
     foreach ($result as $t) {
       $history[$t->nid] = $t->timestamp > HISTORY_READ_LIMIT ? $t->timestamp : HISTORY_READ_LIMIT;
     }
@@ -1305,19 +1298,3 @@ function _forum_update_forum_index($nid) {
       ->execute();
   }
 }
-
-/**
- * Returns HTML for a forum form.
- *
- * By default this does not alter the appearance of a form at all, but is
- * provided as a convenience for themers.
- *
- * @param $variables
- *   An associative array containing:
- *   - form: A render element representing the form.
- *
- * @ingroup themeable
- */
-function theme_forum_form(array $variables) {
-  return drupal_render_children($variables['form']);
-}
diff --git a/core/modules/forum/forum.routing.yml b/core/modules/forum/forum.routing.yml
index fe816f0..f7d90f8 100644
--- a/core/modules/forum/forum.routing.yml
+++ b/core/modules/forum/forum.routing.yml
@@ -10,27 +10,3 @@ forum_settings:
     _form: '\Drupal\forum\ForumSettingsForm'
   requirements:
     _permission: 'administer forums'
-forum_add_container:
-  pattern: 'admin/structure/forum/add/container'
-  defaults:
-    _content: 'Drupal\forum\Controller\ForumController::addContainer'
-  requirements:
-    _permission: 'administer forums'
-forum_add_forum:
-  pattern: 'admin/structure/forum/add/forum'
-  defaults:
-    _content: 'Drupal\forum\Controller\ForumController::addForum'
-  requirements:
-    _permission: 'administer forums'
-forum_edit_container:
-  pattern: 'admin/structure/forum/edit/container/{taxonomy_term}'
-  defaults:
-    _entity_form: 'taxonomy_term.container'
-  requirements:
-    _permission: 'administer forums'
-forum_edit_forum:
-  pattern: 'admin/structure/forum/edit/forum/{taxonomy_term}'
-  defaults:
-    _entity_form: 'taxonomy_term.forum'
-  requirements:
-    _permission: 'administer forums'
diff --git a/core/modules/forum/lib/Drupal/forum/Controller/ForumController.php b/core/modules/forum/lib/Drupal/forum/Controller/ForumController.php
deleted file mode 100644
index 51747fd..0000000
--- a/core/modules/forum/lib/Drupal/forum/Controller/ForumController.php
+++ /dev/null
@@ -1,97 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\forum\Controller\ForumController.
- */
-
-namespace Drupal\forum\Controller;
-
-use Drupal\Core\Config\ConfigFactory;
-use Drupal\Core\Controller\ControllerInterface;
-use Drupal\Core\Entity\EntityManager;
-use Drupal\taxonomy\TermStorageControllerInterface;
-use Symfony\Component\DependencyInjection\ContainerInterface;
-
-/**
- * Controller routines for forum routes.
- */
-class ForumController implements ControllerInterface {
-
-  /**
-   * Entity Manager Service.
-   *
-   * @var \Drupal\Core\Entity\EntityManager
-   */
-  protected $entityManager;
-
-  /**
-   * Config object for forum.settings.
-   *
-   * @var \Drupal\Core\Config\Config
-   */
-  protected $config;
-
-  /**
-   * Term storage controller.
-   *
-   * @var \Drupal\taxonomy\TermStorageControllerInterface
-   */
-  protected $storageController;
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function create(ContainerInterface $container) {
-    return new static(
-      $container->get('plugin.manager.entity'),
-      $container->get('config.factory'),
-      $container->get('plugin.manager.entity')->getStorageController('taxonomy_term')
-    );
-  }
-
-  /**
-   * Constructs a ForumController object.
-   *
-   * @param \Drupal\Core\Entity\EntityManager $entity_manager
-   *   The entity manager service.
-   * @param \Drupal\Core\Config\ConfigFactory $config_factory
-   *   The factory for configuration objects.
-   * @param \Drupal\taxonomy\TermStorageControllerInterface $storage_controller
-   *   The term storage controller.
-   */
-  public function __construct(EntityManager $entity_manager, ConfigFactory $config_factory, TermStorageControllerInterface $storage_controller) {
-    $this->entityManager = $entity_manager;
-    $this->config = $config_factory->get('forum.settings');
-    $this->storageController = $storage_controller;
-  }
-
-  /**
-   * Returns add forum entity form.
-   *
-   * @return array
-   *   Render array for the add form.
-   */
-  public function addForum() {
-    $vid = $this->config->get('vocabulary');
-    $taxonomy_term = $this->storageController->create(array(
-      'vid' => $vid,
-    ));
-    return $this->entityManager->getForm($taxonomy_term, 'forum');
-  }
-
-  /**
-   * Returns add container entity form.
-   *
-   * @return array
-   *   Render array for the add form.
-   */
-  public function addContainer() {
-    $vid = $this->config->get('vocabulary');
-    $taxonomy_term = $this->storageController->create(array(
-      'vid' => $vid,
-    ));
-    return $this->entityManager->getForm($taxonomy_term, 'container');
-  }
-
-}
diff --git a/core/modules/forum/lib/Drupal/forum/Form/ContainerFormController.php b/core/modules/forum/lib/Drupal/forum/Form/ContainerFormController.php
deleted file mode 100644
index a40c83b..0000000
--- a/core/modules/forum/lib/Drupal/forum/Form/ContainerFormController.php
+++ /dev/null
@@ -1,54 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\forum\Form\ContainerFormController.
- */
-
-namespace Drupal\forum\Form;
-
-/**
- * Base form controller for container term edit forms.
- */
-class ContainerFormController extends ForumFormController {
-
-  /**
-   * Reusable url stub to use in watchdog messages.
-   *
-   * @var string
-   */
-  protected $urlStub = 'container';
-
-  /**
-   * {@inheritdoc}
-   */
-  public function form(array $form, array &$form_state) {
-    $taxonomy_term = $this->entity;
-    // Build the bulk of the form from the parent forum form.
-    $form = parent::form($form, $form_state, $taxonomy_term);
-
-    // Set the title and description of the name field.
-    $form['name']['#title'] = t('Container name');
-    $form['name']['#description'] = t('Short but meaningful name for this collection of related forums.');
-
-    // Alternate description for the container parent.
-    $form['parent'][0]['#description'] = t('Containers are usually placed at the top (root) level, but may also be placed inside another container or forum.');
-    $this->forumFormType = t('forum container');
-    return $form;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function save(array $form, array &$form_state) {
-    $is_new = $this->entity->isNew();
-    $term = parent::save($form, $form_state);
-    if ($is_new) {
-      // Update config item to track the container terms.
-      $containers = $this->config->get('containers');
-      $containers[] = $term->id();
-      $this->config->set('containers', $containers)->save();
-    }
-  }
-
-}
diff --git a/core/modules/forum/lib/Drupal/forum/Form/ForumFormController.php b/core/modules/forum/lib/Drupal/forum/Form/ForumFormController.php
deleted file mode 100644
index 7d2849c..0000000
--- a/core/modules/forum/lib/Drupal/forum/Form/ForumFormController.php
+++ /dev/null
@@ -1,229 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\forum\Form\ForumFormController.
- */
-
-namespace Drupal\forum\Form;
-
-use Drupal\Core\Cache\Cache;
-use Drupal\Core\Config\ConfigFactory;
-use Drupal\Core\Entity\EntityControllerInterface;
-use Drupal\Core\Extension\ModuleHandlerInterface;
-use Drupal\taxonomy\TermFormController;
-use Drupal\taxonomy\TermStorageControllerInterface;
-use Symfony\Component\DependencyInjection\ContainerInterface;
-use Symfony\Component\HttpFoundation\Request;
-
-/**
- * Base form controller for forum term edit forms.
- */
-class ForumFormController extends TermFormController implements EntityControllerInterface {
-
-  /**
-   * Reusable type field to use in status messages.
-   *
-   * @var string
-   */
-  protected $forumFormType;
-
-  /**
-   * Reusable url stub to use in watchdog messages.
-   *
-   * @var string
-   */
-  protected $urlStub = 'forum';
-
-  /**
-   * The forum config.
-   *
-   * @var \Drupal\Core\Config\Config
-   */
-  protected $config;
-
-  /**
-   * The current request.
-   *
-   * @var \Symfony\Component\HttpFoundation\Request
-   */
-  protected $request;
-
-  /**
-   * Term Storage Controller.
-   *
-   * @var \Drupal\taxonomy\TermStorageControllerInterface
-   */
-  protected $storageController;
-
-  /**
-   * Constructs a new MenuLinkFormController object.
-   *
-   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
-   *   The module handler.
-   * @param \Drupal\Core\Config\ConfigFactory $config_factory
-   *   The config factory service.
-   * @param \Symfony\Component\HttpFoundation\Request $request
-   *   The current request.
-   * @param \Drupal\taxonomy\TermStorageControllerInterface $storage_controller
-   *   The storage controller.
-   */
-  public function __construct(ModuleHandlerInterface $module_handler, ConfigFactory $config_factory, Request $request, TermStorageControllerInterface $storage_controller) {
-    parent::__construct($module_handler);
-    $this->config = $config_factory->get('forum.settings');
-    $this->request = $request;
-    $this->storageController = $storage_controller;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function createInstance(ContainerInterface $container, $entity_type, array $entity_info) {
-    return new static(
-      $container->get('module_handler'),
-      $container->get('config.factory'),
-      $container->get('request'),
-      $container->get('plugin.manager.entity')->getStorageController('taxonomy_term')
-    );
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function form(array $form, array &$form_state) {
-    $taxonomy_term = $this->entity;
-    // Build the bulk of the form from the parent taxonomy term form.
-    $form = parent::form($form, $form_state, $taxonomy_term);
-
-    // Set the title and description of the name field.
-    $form['name']['#title'] = t('Forum name');
-    $form['name']['#description'] = t('Short but meaningful name for this collection of threaded discussions.');
-
-    // Change the description.
-    $form['description']['#description'] = t('Description and guidelines for discussions within this forum.');
-
-    // Re-use the weight field.
-    $form['weight'] = $form['relations']['weight'];
-
-    // Remove the remaining relations fields.
-    unset($form['relations']);
-
-    // Our parent field is different to the taxonomy term.
-    $form['parent']['#tree'] = TRUE;
-    $form['parent'][0] = $this->forumParentSelect($taxonomy_term->id(), t('Parent'));
-
-    $form['#theme'] = 'forum_form';
-    $this->forumFormType = t('forum');
-    return $form;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function buildEntity(array $form, array &$form_state) {
-    $term = parent::buildEntity($form, $form_state);
-
-    // Assign parents from forum parent select field.
-    $term->parent = array($form_state['values']['parent'][0]);
-
-    return $term;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function save(array $form, array &$form_state) {
-    $term = $this->entity;
-
-    $status = $this->storageController->save($term);
-    switch ($status) {
-      case SAVED_NEW:
-        drupal_set_message(t('Created new @type %term.', array('%term' => $term->label(), '@type' => $this->forumFormType)));
-        watchdog('forum', 'Created new @type %term.', array('%term' => $term->label(), '@type' => $this->forumFormType), WATCHDOG_NOTICE, l(t('edit'), 'admin/structure/forum/edit/' . $this->urlStub . '/' . $term->id()));
-        $form_state['values']['tid'] = $term->id();
-        break;
-
-      case SAVED_UPDATED:
-        drupal_set_message(t('The @type %term has been updated.', array('%term' => $term->label(), '@type' => $this->forumFormType)));
-        watchdog('taxonomy', 'Updated @type %term.', array('%term' => $term->label(), '@type' => $this->forumFormType), WATCHDOG_NOTICE, l(t('edit'), 'admin/structure/forum/edit/' . $this->urlStub . '/' . $term->id()));
-        // Clear the page and block caches to avoid stale data.
-        Cache::invalidateTags(array('content' => TRUE));
-        break;
-    }
-
-    $form_state['redirect'] = 'admin/structure/forum';
-    return $term;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function delete(array $form, array &$form_state) {
-    $destination = array();
-    if ($this->request->query->get('destination')) {
-      $destination = drupal_get_destination();
-      $this->request->query->remove('destination');
-    }
-    $term = $this->getEntity($form_state);
-    $form_state['redirect'] = array(
-      'admin/structure/forum/delete/forum/' . $term->id(),
-      array('query' => $destination),
-    );
-  }
-
-  /**
-   * Returns a select box for available parent terms.
-   *
-   * @param int $tid
-   *   ID of the term that is being added or edited.
-   * @param string $title
-   *   Title for the select box.
-   *
-   * @return array
-   *   A select form element.
-   */
-  protected function forumParentSelect($tid, $title) {
-    // @todo Inject a taxonomy service when one exists.
-    $parents = taxonomy_term_load_parents($tid);
-    if ($parents) {
-      $parent = array_shift($parents);
-      $parent = $parent->id();
-    }
-    else {
-      $parent = 0;
-    }
-
-    $vid = $this->config->get('vocabulary');
-    // @todo Inject a taxonomy service when one exists.
-    $children = taxonomy_get_tree($vid, $tid, NULL, TRUE);
-
-    // A term can't be the child of itself, nor of its children.
-    foreach ($children as $child) {
-      $exclude[] = $child->tid;
-    }
-    $exclude[] = $tid;
-
-    // @todo Inject a taxonomy service when one exists.
-    $tree = taxonomy_get_tree($vid, 0, NULL, TRUE);
-    $options[0] = '<' . t('root') . '>';
-    if ($tree) {
-      foreach ($tree as $term) {
-        if (!in_array($term->id(), $exclude)) {
-          $options[$term->id()] = str_repeat(' -- ', $term->depth) . $term->label();
-        }
-      }
-    }
-
-    $description = t('Forums may be placed at the top (root) level, or inside another container or forum.');
-
-    return array(
-      '#type' => 'select',
-      '#title' => $title,
-      '#default_value' => $parent,
-      '#options' => $options,
-      '#description' => $description,
-      '#required' => TRUE,
-    );
-  }
-
-}
diff --git a/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php b/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php
index 8297e80..63f1da3 100644
--- a/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php
+++ b/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php
@@ -190,7 +190,7 @@ function testForum() {
     $this->assertEqual($topics, '6', 'Number of topics found.');
 
     // Verify the number of unread topics.
-    $unread_topics = _forum_topics_unread($this->forum['tid'], $this->edit_any_topics_user->id());
+    $unread_topics = _forum_topics_unread($this->forum['tid'], $this->edit_any_topics_user->uid);
     $unread_topics = format_plural($unread_topics, '1 new post', '@count new posts');
     $xpath = $this->buildXPathQuery('//tr[@id=:forum]//td[@class="topics"]//a', $forum_arg);
     $this->assertFieldByXPath($xpath, $unread_topics, 'Number of unread topics found.');
@@ -388,7 +388,7 @@ function createForum($type, $parent = 0) {
 
     $edit = array(
       'name' => $name,
-      'description[value]' => $description,
+      'description' => $description,
       'parent[0]' => $parent,
       'weight' => '0',
     );
diff --git a/core/modules/forum/tests/modules/forum_test_views/test_views/views.view.test_forum_index.yml b/core/modules/forum/tests/modules/forum_test_views/test_views/views.view.test_forum_index.yml
index ac6dee6..bafdc5f 100644
--- a/core/modules/forum/tests/modules/forum_test_views/test_views/views.view.test_forum_index.yml
+++ b/core/modules/forum/tests/modules/forum_test_views/test_views/views.view.test_forum_index.yml
@@ -29,7 +29,6 @@ display:
           table: forum_index
           field: nid
           id: nid
-          provider: views
         sticky:
           id: sticky
           table: forum_index
@@ -83,7 +82,6 @@ display:
           type_custom_false: ''
           not: '0'
           plugin_id: boolean
-          provider: views
         comment_count:
           id: comment_count
           table: forum_index
@@ -142,7 +140,6 @@ display:
           prefix: ''
           suffix: ''
           plugin_id: numeric
-          provider: views
       filters: {  }
       sorts: {  }
 label: test_forum_index
diff --git a/core/modules/history/history.module b/core/modules/history/history.module
index 2a182c0..84abade 100644
--- a/core/modules/history/history.module
+++ b/core/modules/history/history.module
@@ -34,7 +34,7 @@ function history_read($nid) {
   $history = &drupal_static(__FUNCTION__, array());
 
   if (!isset($history[$nid])) {
-    $history[$nid] = db_query("SELECT timestamp FROM {history} WHERE uid = :uid AND nid = :nid", array(':uid' => $user->id(), ':nid' => $nid))->fetchObject();
+    $history[$nid] = db_query("SELECT timestamp FROM {history} WHERE uid = :uid AND nid = :nid", array(':uid' => $user->uid, ':nid' => $nid))->fetchObject();
   }
 
   return (isset($history[$nid]->timestamp) ? $history[$nid]->timestamp : 0);
@@ -56,10 +56,10 @@ function history_write($nid, $account = NULL) {
     $account = $user;
   }
 
-  if ($account->isAuthenticated()) {
+  if ($account->uid) {
     db_merge('history')
       ->key(array(
-        'uid' => $account->id(),
+        'uid' => $account->uid,
         'nid' => $nid,
       ))
       ->fields(array('timestamp' => REQUEST_TIME))
@@ -92,7 +92,7 @@ function history_user_cancel($edit, $account, $method) {
   switch ($method) {
     case 'user_cancel_reassign':
       db_delete('history')
-        ->condition('uid', $account->id())
+        ->condition('uid', $account->uid)
         ->execute();
       break;
   }
@@ -103,6 +103,6 @@ function history_user_cancel($edit, $account, $method) {
  */
 function history_user_delete($account) {
   db_delete('history')
-    ->condition('uid', $account->id())
+    ->condition('uid', $account->uid)
     ->execute();
 }
diff --git a/core/modules/history/lib/Drupal/history/Plugin/views/field/HistoryUserTimestamp.php b/core/modules/history/lib/Drupal/history/Plugin/views/field/HistoryUserTimestamp.php
index ab81c8e..5d5a697 100644
--- a/core/modules/history/lib/Drupal/history/Plugin/views/field/HistoryUserTimestamp.php
+++ b/core/modules/history/lib/Drupal/history/Plugin/views/field/HistoryUserTimestamp.php
@@ -31,7 +31,7 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o
     parent::init($view, $display, $options);
 
     global $user;
-    if ($user->isAuthenticated()) {
+    if ($user->uid) {
       $this->additional_fields['created'] = array('table' => 'node_field_data', 'field' => 'created');
       $this->additional_fields['changed'] = array('table' => 'node_field_data', 'field' => 'changed');
       if (module_exists('comment') && !empty($this->options['comments'])) {
@@ -55,6 +55,7 @@ public function buildOptionsForm(&$form, &$form_state) {
         '#type' => 'checkbox',
         '#title' => t('Check for new comments as well'),
         '#default_value' => !empty($this->options['comments']),
+        '#fieldset' => 'more',
       );
     }
   }
@@ -62,19 +63,19 @@ public function buildOptionsForm(&$form, &$form_state) {
   public function query() {
     // Only add ourselves to the query if logged in.
     global $user;
-    if ($user->isAnonymous()) {
+    if (!$user->uid) {
       return;
     }
     parent::query();
   }
 
-  public function render($values) {
+  function render($values) {
     // Let's default to 'read' state.
     // This code shadows node_mark, but it reads from the db directly and
     // we already have that info.
     $mark = MARK_READ;
     global $user;
-    if ($user->isAuthenticated()) {
+    if ($user->uid) {
       $last_read = $this->getValue($values);
       $changed = $this->getValue($values, 'changed');
 
diff --git a/core/modules/history/lib/Drupal/history/Plugin/views/filter/HistoryUserTimestamp.php b/core/modules/history/lib/Drupal/history/Plugin/views/filter/HistoryUserTimestamp.php
index beae395..8569329 100644
--- a/core/modules/history/lib/Drupal/history/Plugin/views/filter/HistoryUserTimestamp.php
+++ b/core/modules/history/lib/Drupal/history/Plugin/views/filter/HistoryUserTimestamp.php
@@ -54,8 +54,8 @@ protected function valueForm(&$form, &$form_state) {
 
   public function query() {
     global $user;
-    // This can only work if we're authenticated in.
-    if (!$user->isAuthenticated()) {
+    // This can only work if we're logged in.
+    if (!$user || !$user->uid) {
       return;
     }
 
diff --git a/core/modules/image/image.admin.inc b/core/modules/image/image.admin.inc
index 1cd2155..02af74e 100644
--- a/core/modules/image/image.admin.inc
+++ b/core/modules/image/image.admin.inc
@@ -608,7 +608,7 @@ function theme_image_style_effects($variables) {
  *
  * @param $variables
  *   An associative array containing:
- *   - style: \Drupal\image\ImageStyleInterface image style being previewed.
+ *   - style: The image style array being previewed.
  *
  * @ingroup themeable
  */
@@ -634,9 +634,9 @@ function theme_image_style_preview($variables) {
   $original_attributes['style'] = 'width: ' . $original_width . 'px; height: ' . $original_height . 'px;';
 
   // Set up preview file information.
-  $preview_file = $style->buildUri($original_path);
+  $preview_file = image_style_path($style->id(), $original_path);
   if (!file_exists($preview_file)) {
-    $style->createDerivative($original_path, $preview_file);
+    image_style_create_derivative($style, $original_path, $preview_file);
   }
   $preview_image = image_get_info($preview_file);
   if ($preview_image['width'] > $preview_image['height']) {
diff --git a/core/modules/image/image.api.php b/core/modules/image/image.api.php
index bc7ace8..d2990f5 100644
--- a/core/modules/image/image.api.php
+++ b/core/modules/image/image.api.php
@@ -74,8 +74,8 @@ function hook_image_effect_info_alter(&$effects) {
  * be cleared using this hook. This hook is called whenever a style is updated,
  * deleted, or any effect associated with the style is update or deleted.
  *
- * @param \Drupal\image\ImageStyleInterface $style
- *   The image style object that is being flushed.
+ * @param Drupal\image\Plugin\Core\Entity\ImageStyle $style
+ *   The image style array that is being flushed.
  */
 function hook_image_style_flush($style) {
   // Empty cached data that contains information about the style.
diff --git a/core/modules/image/image.module b/core/modules/image/image.module
index 4e786bd..9a3dd64 100644
--- a/core/modules/image/image.module
+++ b/core/modules/image/image.module
@@ -9,9 +9,13 @@
 use Drupal\Core\Language\Language;
 use Drupal\field\Plugin\Core\Entity\Field;
 use Drupal\field\Plugin\Core\Entity\FieldInstance;
+use Symfony\Component\HttpFoundation\Response;
+use Symfony\Component\HttpFoundation\BinaryFileResponse;
+use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
+use Symfony\Component\HttpKernel\Exception\ServiceUnavailableHttpException;
+use Drupal\Component\Utility\Crypt;
 use Drupal\Component\Uuid\Uuid;
 use Drupal\file\Plugin\Core\Entity\File;
-use Drupal\image\ImageStyleInterface;
 use Drupal\image\Plugin\Core\Entity\ImageStyle;
 use Drupal\field\FieldInterface;
 use Drupal\field\FieldInstanceInterface;
@@ -353,7 +357,10 @@ function image_file_predelete(File $file) {
 function image_path_flush($path) {
   $styles = entity_load_multiple('image_style');
   foreach ($styles as $style) {
-    $style->flush($path);
+    $image_path = image_style_path($style->id(), $path);
+    if (file_exists($image_path)) {
+      file_unmanaged_delete($image_path);
+    }
   }
 }
 
@@ -396,23 +403,304 @@ function image_style_options($include_empty = TRUE) {
  *
  * After generating an image, transfer it to the requesting agent.
  *
- * @param \Drupal\image\ImageStyleInterface $style
- *   The image style.
- * @param string $scheme
- *   The scheme name of the original image file stream wrapper ('public',
- *   'private', 'temporary', etc.).
- *
- * @return \Symfony\Component\HttpFoundation\BinaryFileResponse|\Symfony\Component\HttpFoundation\Response
- *   The image to be delivered.
- *
- * @todo Remove this wrapper in https://drupal.org/node/1987712.
+ * @param $style
+ *   The image style
  */
-function image_style_deliver(ImageStyleInterface $style, $scheme) {
+function image_style_deliver($style, $scheme) {
   $args = func_get_args();
-  // Remove $style and $scheme from the arguments.
-  unset($args[0], $args[1]);
+  array_shift($args);
+  array_shift($args);
   $target = implode('/', $args);
-  return $style->deliver($scheme, $target);
+
+  // Check that the style is defined, the scheme is valid, and the image
+  // derivative token is valid. (Sites which require image derivatives to be
+  // generated without a token can set the
+  // 'image.settings:allow_insecure_derivatives' configuration to TRUE to bypass
+  // the latter check, but this will increase the site's vulnerability to
+  // denial-of-service attacks.)
+  $valid = !empty($style) && file_stream_wrapper_valid_scheme($scheme);
+  if (!config('image.settings')->get('allow_insecure_derivatives')) {
+    $image_derivative_token = Drupal::request()->query->get(IMAGE_DERIVATIVE_TOKEN);
+    $valid = $valid && isset($image_derivative_token) && $image_derivative_token === image_style_path_token($style->name, $scheme . '://' . $target);
+  }
+  if (!$valid) {
+    throw new AccessDeniedHttpException();
+  }
+
+  $image_uri = $scheme . '://' . $target;
+  $derivative_uri = image_style_path($style->id(), $image_uri);
+
+  // If using the private scheme, let other modules provide headers and
+  // control access to the file.
+  if ($scheme == 'private') {
+    if (file_exists($derivative_uri)) {
+      file_download($scheme, file_uri_target($derivative_uri));
+    }
+    else {
+      $headers = module_invoke_all('file_download', $image_uri);
+      if (in_array(-1, $headers) || empty($headers)) {
+        throw new AccessDeniedHttpException();
+      }
+      if (count($headers)) {
+        foreach ($headers as $name => $value) {
+          drupal_add_http_header($name, $value);
+        }
+      }
+    }
+  }
+
+  // Don't try to generate file if source is missing.
+  if (!file_exists($image_uri)) {
+    watchdog('image', 'Source image at %source_image_path not found while trying to generate derivative image at %derivative_path.',  array('%source_image_path' => $image_uri, '%derivative_path' => $derivative_uri));
+    return new Response(t('Error generating image, missing source file.'), 404);
+  }
+
+  // Don't start generating the image if the derivative already exists or if
+  // generation is in progress in another thread.
+  $lock_name = 'image_style_deliver:' . $style->id() . ':' . Crypt::hashBase64($image_uri);
+  if (!file_exists($derivative_uri)) {
+    $lock_acquired = lock()->acquire($lock_name);
+    if (!$lock_acquired) {
+      // Tell client to retry again in 3 seconds. Currently no browsers are known
+      // to support Retry-After.
+      throw new ServiceUnavailableHttpException(3, t('Image generation in progress. Try again shortly.'));
+    }
+  }
+
+  // Try to generate the image, unless another thread just did it while we were
+  // acquiring the lock.
+  $success = file_exists($derivative_uri) || image_style_create_derivative($style, $image_uri, $derivative_uri);
+
+  if (!empty($lock_acquired)) {
+    lock()->release($lock_name);
+  }
+
+  if ($success) {
+    $image = image_load($derivative_uri);
+    $uri = $image->source;
+    $headers = array(
+      'Content-Type' => $image->info['mime_type'],
+      'Content-Length' => $image->info['file_size'],
+    );
+    return new BinaryFileResponse($uri, 200, $headers);
+  }
+  else {
+    watchdog('image', 'Unable to generate the derived image located at %path.', array('%path' => $derivative_uri));
+    return new Response(t('Error generating image.'), 500);
+  }
+}
+
+/**
+ * Creates a new image derivative based on an image style.
+ *
+ * Generates an image derivative by creating the destination folder (if it does
+ * not already exist), applying all image effects defined in $style->effects,
+ * and saving a cached version of the resulting image.
+ *
+ * @param $style
+ *   An image style array.
+ * @param $source
+ *   Path of the source file.
+ * @param $destination
+ *   Path or URI of the destination file.
+ *
+ * @return
+ *   TRUE if an image derivative was generated, or FALSE if the image derivative
+ *   could not be generated.
+ *
+ * @see image_style_load()
+ */
+function image_style_create_derivative($style, $source, $destination) {
+  // Get the folder for the final location of this style.
+  $directory = drupal_dirname($destination);
+
+  // Build the destination folder tree if it doesn't already exist.
+  if (!file_prepare_directory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS)) {
+    watchdog('image', 'Failed to create style directory: %directory', array('%directory' => $directory), WATCHDOG_ERROR);
+    return FALSE;
+  }
+
+  if (!$image = image_load($source)) {
+    return FALSE;
+  }
+
+  if (!empty($style->effects)) {
+    foreach ($style->effects as $effect) {
+      image_effect_apply($image, $effect);
+    }
+  }
+
+  if (!image_save($image, $destination)) {
+    if (file_exists($destination)) {
+      watchdog('image', 'Cached image file %destination already exists. There may be an issue with your rewrite configuration.', array('%destination' => $destination), WATCHDOG_ERROR);
+    }
+    return FALSE;
+  }
+
+  return TRUE;
+}
+
+/**
+ * Determines the dimensions of the styled image.
+ *
+ * Applies all of an image style's effects to $dimensions.
+ *
+ * @param $style_name
+ *   The name of the style to be applied.
+ * @param $dimensions
+ *   Dimensions to be modified - an array with components width and height, in
+ *   pixels.
+ */
+function image_style_transform_dimensions($style_name, array &$dimensions) {
+  module_load_include('inc', 'image', 'image.effects');
+  $style = entity_load('image_style', $style_name);
+
+  if (!empty($style->effects)) {
+    foreach ($style->effects as $effect) {
+      if (isset($effect['dimensions passthrough'])) {
+        continue;
+      }
+
+      if (isset($effect['dimensions callback'])) {
+        $effect['dimensions callback']($dimensions, $effect['data']);
+      }
+      else {
+        $dimensions['width'] = $dimensions['height'] = NULL;
+      }
+    }
+  }
+}
+
+/**
+ * Flushes cached media for a style.
+ *
+ * @param $style
+ *   An image style array.
+ */
+function image_style_flush($style) {
+  // Delete the style directory in each registered wrapper.
+  $wrappers = file_get_stream_wrappers(STREAM_WRAPPERS_WRITE_VISIBLE);
+  foreach ($wrappers as $wrapper => $wrapper_data) {
+    file_unmanaged_delete_recursive($wrapper . '://styles/' . $style->id());
+  }
+
+  // Let other modules update as necessary on flush.
+  module_invoke_all('image_style_flush', $style);
+
+  // Clear field caches so that formatters may be added for this style.
+  field_info_cache_clear();
+  drupal_theme_rebuild();
+
+  // Clear page caches when flushing.
+  if (module_exists('block')) {
+    cache('block')->deleteAll();
+  }
+  cache('page')->deleteAll();
+}
+
+/**
+ * Returns the URL for an image derivative given a style and image path.
+ *
+ * @param $style_name
+ *   The name of the style to be used with this image.
+ * @param $path
+ *   The path to the image.
+ * @param $clean_urls
+ *   (optional) Whether clean URLs are in use.
+ * @return
+ *   The absolute URL where a style image can be downloaded, suitable for use
+ *   in an <img> tag. Requesting the URL will cause the image to be created.
+ * @see image_style_deliver()
+ */
+function image_style_url($style_name, $path, $clean_urls = NULL) {
+  $uri = image_style_path($style_name, $path);
+  // The token query is added even if the
+  // 'image.settings:allow_insecure_derivatives' configuration is TRUE, so that
+  // the emitted links remain valid if it is changed back to the default FALSE.
+  // However, sites which need to prevent the token query from being emitted at
+  // all can additionally set the 'image.settings:suppress_itok_output'
+  // configuration to TRUE to achieve that (if both are set, the security token
+  // will neither be emitted in the image derivative URL nor checked for in
+  // image_style_deliver()).
+  $token_query = array();
+  if (!config('image.settings')->get('suppress_itok_output')) {
+    $token_query = array(IMAGE_DERIVATIVE_TOKEN => image_style_path_token($style_name, file_stream_wrapper_uri_normalize($path)));
+  }
+
+  if ($clean_urls === NULL) {
+    // Assume clean URLs unless the request tells us otherwise.
+    $clean_urls = TRUE;
+    try {
+      $request = Drupal::request();
+      $clean_urls = $request->attributes->get('clean_urls');
+    }
+    catch (ServiceNotFoundException $e) {
+    }
+  }
+
+  // If not using clean URLs, the image derivative callback is only available
+  // with the script path. If the file does not exist, use url() to ensure
+  // that it is included. Once the file exists it's fine to fall back to the
+  // actual file path, this avoids bootstrapping PHP once the files are built.
+  if ($clean_urls === FALSE && file_uri_scheme($uri) == 'public' && !file_exists($uri)) {
+    $directory_path = file_stream_wrapper_get_instance_by_uri($uri)->getDirectoryPath();
+    return url($directory_path . '/' . file_uri_target($uri), array('absolute' => TRUE, 'query' => $token_query));
+  }
+
+  $file_url = file_create_url($uri);
+  // Append the query string with the token, if necessary.
+  if ($token_query) {
+    $file_url .= (strpos($file_url, '?') !== FALSE ? '&' : '?') . drupal_http_build_query($token_query);
+  }
+
+  return $file_url;
+}
+
+/**
+ * Generates a token to protect an image style derivative.
+ *
+ * This prevents unauthorized generation of an image style derivative,
+ * which can be costly both in CPU time and disk space.
+ *
+ * @param string $style_name
+ *   The name of the image style.
+ * @param string $uri
+ *   The URI of the image for this style, for example as returned by
+ *   image_style_path().
+ *
+ * @return string
+ *   An eight-character token which can be used to protect image style
+ *   derivatives against denial-of-service attacks.
+ */
+function image_style_path_token($style_name, $uri) {
+  // Return the first eight characters.
+  return substr(Crypt::hmacBase64($style_name . ':' . $uri, drupal_get_private_key() . drupal_get_hash_salt()), 0, 8);
+}
+
+/**
+ * Returns the URI of an image when using a style.
+ *
+ * The path returned by this function may not exist. The default generation
+ * method only creates images when they are requested by a user's browser.
+ *
+ * @param $style_name
+ *   The name of the style to be used with this image.
+ * @param $uri
+ *   The URI or path to the image.
+ * @return
+ *   The URI to an image style image.
+ * @see image_style_url()
+ */
+function image_style_path($style_name, $uri) {
+  $scheme = file_uri_scheme($uri);
+  if ($scheme) {
+    $path = file_uri_target($uri);
+  }
+  else {
+    $path = $uri;
+    $scheme = file_default_scheme();
+  }
+  return $scheme . '://styles/' . $style_name . '/' . $scheme . '/' . $path;
 }
 
 /**
@@ -547,6 +835,10 @@ function image_effect_save($style, &$effect) {
   }
   $style->effects[$effect['ieid']] = $effect;
   $style->save();
+
+  // Flush all derivatives that exist for this style, so they are regenerated
+  // with the new or updated effect.
+  image_style_flush($style);
 }
 
 /**
@@ -560,6 +852,7 @@ function image_effect_save($style, &$effect) {
 function image_effect_delete($style, $effect) {
   unset($style->effects[$effect['ieid']]);
   $style->save();
+  image_style_flush($style);
 }
 
 /**
@@ -599,17 +892,13 @@ function image_effect_apply($image, $effect) {
  * @ingroup themeable
  */
 function theme_image_style($variables) {
-  // @todo Image style loading will be moved outside theme in
-  //   https://drupal.org/node/2029649
-  $style = entity_load('image_style', $variables['style_name']);
-
   // Determine the dimensions of the styled image.
   $dimensions = array(
     'width' => $variables['width'],
     'height' => $variables['height'],
   );
 
-  $style->transformDimensions($dimensions);
+  image_style_transform_dimensions($variables['style_name'], $dimensions);
 
   // Add in the image style name as an HTML class.
   $variables['attributes']['class'][] = 'image-style-' . drupal_html_class($variables['style_name']);
@@ -619,7 +908,7 @@ function theme_image_style($variables) {
     '#width' => $dimensions['width'],
     '#height' => $dimensions['height'],
     '#attributes' => $variables['attributes'],
-    '#uri' => $style->buildUrl($variables['uri']),
+    '#uri' => image_style_url($variables['style_name'], $variables['uri']),
   );
 
   if (isset($variables['alt'])) {
diff --git a/core/modules/image/lib/Drupal/image/ImageStyleInterface.php b/core/modules/image/lib/Drupal/image/ImageStyleInterface.php
index d7803cd..87367d3 100644
--- a/core/modules/image/lib/Drupal/image/ImageStyleInterface.php
+++ b/core/modules/image/lib/Drupal/image/ImageStyleInterface.php
@@ -2,7 +2,7 @@
 
 /**
  * @file
- * Contains \Drupal\image\ImageStyleInterface.
+ * Contains \Drupal\image\Plugin\Core\Entity\ImageStyleInterface.
  */
 
 namespace Drupal\image;
@@ -14,99 +14,4 @@
  */
 interface ImageStyleInterface extends ConfigEntityInterface {
 
-  /**
-   * Delivers an image derivative.
-   *
-   * Transfers a generated image derivative to the requesting agent. Modules may
-   * implement this method to set different serve different image derivatives
-   * from different stream wrappers or to customize different permissions on
-   * each image style.
-   *
-   * @param string $scheme
-   *   The scheme name of the original image file stream wrapper ('public',
-   *   'private', 'temporary', etc.).
-   * @param string $target
-   *   The target part of the uri.
-   *
-   * @return \Symfony\Component\HttpFoundation\BinaryFileResponse|\Symfony\Component\HttpFoundation\Response
-   *   The image to be delivered.
-   *
-   * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
-   *   \Symfony\Component\HttpKernel\Exception\ServiceUnavailableHttpException
-   *
-   * @todo Move to controller after https://drupal.org/node/1987712.
-   */
-  public function deliver($scheme, $target);
-
-  /**
-   * Returns the URI of this image when using this style.
-   *
-   * The path returned by this function may not exist. The default generation
-   * method only creates images when they are requested by a user's browser.
-   * Modules may implement this method to decide where to place derivatives.
-   *
-   * @param string $uri
-   *   The URI or path to the original image.
-   *
-   * @return string
-   *   The URI to the image derivative for this style.
-   */
-  public function buildUri($uri);
-
-  /**
-   * Returns the URL of this image derivative for an original image path or URI.
-   *
-   * @param string $path
-   *   The path or URI to the original image.
-   * @param mixed $clean_urls
-   *   (optional) Whether clean URLs are in use.
-   *
-   * @return string
-   *   The absolute URL where a style image can be downloaded, suitable for use
-   *   in an <img> tag. Requesting the URL will cause the image to be created.
-   *
-   * @see \Drupal\image\ImageStyleInterface::deliver()
-   */
-  public function buildUrl($path, $clean_urls = NULL);
-
-  /**
-   * Flushes cached media for this style.
-   *
-   * @param string $path
-   *   (optional) The original image path or URI. If it's supplied, only this
-   *   image derivative will be flushed.
-   */
-  public function flush($path = NULL);
-
-  /**
-   * Creates a new image derivative based on this image style.
-   *
-   * Generates an image derivative applying all image effects and saving the
-   * resulting image.
-   *
-   * @param string $original_uri
-   *   Original image file URI.
-   * @param string $derivative_uri
-   *   Derivative image file URI.
-   *
-   * @return bool
-   *   TRUE if an image derivative was generated, or FALSE if the image
-   *   derivative could not be generated.
-   */
-  public function createDerivative($original_uri, $derivative_uri);
-
-  /**
-   * Determines the dimensions of this image style.
-   *
-   * Stores the dimensions of this image style into $dimensions associative
-   * array. Implementations have to provide at least values to next keys:
-   * - width: Integer with the derivative image width.
-   * - height: Integer with the derivative image height.
-   *
-   * @param array $dimensions
-   *   Associative array passed by reference. Implementations have to store the
-   *   resulting width and height, in pixels.
-   */
-  public function transformDimensions(array &$dimensions);
-
 }
diff --git a/core/modules/image/lib/Drupal/image/Plugin/Core/Entity/ImageStyle.php b/core/modules/image/lib/Drupal/image/Plugin/Core/Entity/ImageStyle.php
index 7dd36c0..2e99768 100644
--- a/core/modules/image/lib/Drupal/image/Plugin/Core/Entity/ImageStyle.php
+++ b/core/modules/image/lib/Drupal/image/Plugin/Core/Entity/ImageStyle.php
@@ -12,13 +12,6 @@
 use Drupal\Core\Annotation\Translation;
 use Drupal\Core\Entity\EntityStorageControllerInterface;
 use Drupal\image\ImageStyleInterface;
-use Drupal\Component\Utility\Crypt;
-use Drupal\Component\Utility\Url;
-use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
-use Symfony\Component\HttpFoundation\Response;
-use Symfony\Component\HttpFoundation\BinaryFileResponse;
-use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
-use Symfony\Component\HttpKernel\Exception\ServiceUnavailableHttpException;
 
 /**
  * Defines an image style configuration entity.
@@ -75,7 +68,7 @@ class ImageStyle extends ConfigEntityBase implements ImageStyleInterface {
   /**
    * The array of image effects for this image style.
    *
-   * @var array
+   * @var string
    */
   public $effects;
 
@@ -90,17 +83,11 @@ public function id() {
    * {@inheritdoc}
    */
   public function postSave(EntityStorageControllerInterface $storage_controller, $update = TRUE) {
-    if ($update) {
-      if (!empty($this->original) && $this->id() !== $this->original->id()) {
-        // The old image style name needs flushing after a rename.
-        $this->original->flush();
-        // Update field instance settings if necessary.
-        static::replaceImageStyle($this);
-      }
-      else {
-        // Flush image style when updating without changing the name.
-        $this->flush();
-      }
+    if ($update && !empty($this->original) && $this->id() !== $this->original->id()) {
+      // The old image style name needs flushing after a rename.
+      image_style_flush($this->original);
+      // Update field instance settings if necessary.
+      static::replaceImageStyle($this);
     }
   }
 
@@ -110,7 +97,7 @@ public function postSave(EntityStorageControllerInterface $storage_controller, $
   public static function postDelete(EntityStorageControllerInterface $storage_controller, array $entities) {
     foreach ($entities as $style) {
       // Flush cached media for the deleted style.
-      $style->flush();
+      image_style_flush($style);
       // Check whether field instance settings need to be updated.
       // In case no replacement style was specified, all image fields that are
       // using the deleted style are left in a broken state.
@@ -125,10 +112,10 @@ public static function postDelete(EntityStorageControllerInterface $storage_cont
   /**
    * Update field instance settings if the image style name is changed.
    *
-   * @param \Drupal\image\ImageStyleInterface $style
+   * @param \Drupal\image\Plugin\Core\Entity\ImageStyle $style
    *   The image style.
    */
-  protected static function replaceImageStyle(ImageStyleInterface $style) {
+  protected static function replaceImageStyle(ImageStyle $style) {
     if ($style->id() != $style->getOriginalID()) {
       $instances = field_read_instances();
       // Loop through all fields searching for image fields.
@@ -161,252 +148,4 @@ protected static function replaceImageStyle(ImageStyleInterface $style) {
     }
   }
 
-  /**
-   * {@inheritdoc}
-   */
-  public function deliver($scheme, $target) {
-    $original_uri = $scheme . '://' . $target;
-
-    // Check that the scheme is valid, and the image derivative token is valid.
-    // (Sites which require image derivatives to be generated without a token
-    // can set the 'image.settings:allow_insecure_derivatives' configuration to
-    // TRUE to bypass the latter check, but this will increase the site's
-    // vulnerability to denial-of-service attacks.)
-    $valid = file_stream_wrapper_valid_scheme($scheme);
-    if (!\Drupal::config('image.settings')->get('allow_insecure_derivatives')) {
-      $image_derivative_token = \Drupal::request()->query->get(IMAGE_DERIVATIVE_TOKEN);
-      $valid &= isset($image_derivative_token) && $image_derivative_token === $this->getPathToken($original_uri);
-    }
-    if (!$valid) {
-      throw new AccessDeniedHttpException();
-    }
-
-    $derivative_uri = $this->buildUri($original_uri);
-    $headers = array();
-
-    // If using the private scheme, let other modules provide headers and
-    // control access to the file.
-    if ($scheme == 'private') {
-      if (file_exists($derivative_uri)) {
-        file_download($scheme, file_uri_target($derivative_uri));
-      }
-      else {
-        $headers = \Drupal::moduleHandler()->invokeAll('file_download', array($original_uri));
-        if (in_array(-1, $headers) || empty($headers)) {
-          throw new AccessDeniedHttpException();
-        }
-      }
-    }
-
-    // Don't try to generate file if source is missing.
-    if (!file_exists($original_uri)) {
-      watchdog('image', 'Source image at %source_image_path not found while trying to generate derivative image at %derivative_path.',  array('%source_image_path' => $original_uri, '%derivative_path' => $derivative_uri));
-      return new Response(t('Error generating image, missing source file.'), 404);
-    }
-
-    // Don't start generating the image if the derivative already exists or if
-    // generation is in progress in another thread.
-    $lock_name = 'image_style_deliver:' . $this->id() . ':' . Crypt::hashBase64($original_uri);
-    if (!file_exists($derivative_uri)) {
-      $lock_acquired = \Drupal::lock()->acquire($lock_name);
-      if (!$lock_acquired) {
-        // Tell client to retry again in 3 seconds. Currently no browsers are
-        // known to support Retry-After.
-        throw new ServiceUnavailableHttpException(3, t('Image generation in progress. Try again shortly.'));
-      }
-    }
-
-    // Try to generate the image, unless another thread just did it while we
-    // were acquiring the lock.
-    $success = file_exists($derivative_uri) || $this->createDerivative($original_uri, $derivative_uri);
-
-    if (!empty($lock_acquired)) {
-      \Drupal::lock()->release($lock_name);
-    }
-
-    if ($success) {
-      $image = image_load($derivative_uri);
-      $uri = $image->source;
-      $headers += array(
-        'Content-Type' => $image->info['mime_type'],
-        'Content-Length' => $image->info['file_size'],
-      );
-      return new BinaryFileResponse($uri, 200, $headers);
-    }
-    else {
-      watchdog('image', 'Unable to generate the derived image located at %path.', array('%path' => $derivative_uri));
-      return new Response(t('Error generating image.'), 500);
-    }
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function buildUri($uri) {
-    $scheme = file_uri_scheme($uri);
-    if ($scheme) {
-      $path = file_uri_target($uri);
-    }
-    else {
-      $path = $uri;
-      $scheme = file_default_scheme();
-    }
-    return $scheme . '://styles/' . $this->id() . '/' . $scheme . '/' . $path;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function buildUrl($path, $clean_urls = NULL) {
-    $uri = $this->buildUri($path);
-    // The token query is added even if the
-    // 'image.settings:allow_insecure_derivatives' configuration is TRUE, so
-    // that the emitted links remain valid if it is changed back to the default
-    // FALSE. However, sites which need to prevent the token query from being
-    // emitted at all can additionally set the
-    // 'image.settings:suppress_itok_output' configuration to TRUE to achieve
-    // that (if both are set, the security token will neither be emitted in the
-    // image derivative URL nor checked for in
-    // \Drupal\image\ImageStyleInterface::deliver()).
-    $token_query = array();
-    if (!\Drupal::config('image.settings')->get('suppress_itok_output')) {
-      $token_query = array(IMAGE_DERIVATIVE_TOKEN => $this->getPathToken(file_stream_wrapper_uri_normalize($path)));
-    }
-
-    if ($clean_urls === NULL) {
-      // Assume clean URLs unless the request tells us otherwise.
-      $clean_urls = TRUE;
-      try {
-        $request = \Drupal::request();
-        $clean_urls = $request->attributes->get('clean_urls');
-      }
-      catch (ServiceNotFoundException $e) {
-      }
-    }
-
-    // If not using clean URLs, the image derivative callback is only available
-    // with the script path. If the file does not exist, use url() to ensure
-    // that it is included. Once the file exists it's fine to fall back to the
-    // actual file path, this avoids bootstrapping PHP once the files are built.
-    if ($clean_urls === FALSE && file_uri_scheme($uri) == 'public' && !file_exists($uri)) {
-      $directory_path = file_stream_wrapper_get_instance_by_uri($uri)->getDirectoryPath();
-      return url($directory_path . '/' . file_uri_target($uri), array('absolute' => TRUE, 'query' => $token_query));
-    }
-
-    $file_url = file_create_url($uri);
-    // Append the query string with the token, if necessary.
-    if ($token_query) {
-      $file_url .= (strpos($file_url, '?') !== FALSE ? '&' : '?') . Url::buildQuery($token_query);
-    }
-
-    return $file_url;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function flush($path = NULL) {
-    // A specific image path has been provided. Flush only that derivative.
-    if (isset($path)) {
-      $derivative_uri = $this->buildUri($path);
-      if (file_exists($derivative_uri)) {
-        file_unmanaged_delete($derivative_uri);
-      }
-      return;
-    }
-
-    // Delete the style directory in each registered wrapper.
-    $wrappers = file_get_stream_wrappers(STREAM_WRAPPERS_WRITE_VISIBLE);
-    foreach ($wrappers as $wrapper => $wrapper_data) {
-      file_unmanaged_delete_recursive($wrapper . '://styles/' . $this->id());
-    }
-
-    // Let other modules update as necessary on flush.
-    \Drupal::moduleHandler()->invokeAll('image_style_flush', array($this));
-
-    // Clear field caches so that formatters may be added for this style.
-    field_info_cache_clear();
-    drupal_theme_rebuild();
-
-    // Clear page caches when flushing.
-    if (\Drupal::moduleHandler()->moduleExists('block')) {
-      cache('block')->deleteAll();
-    }
-    cache('page')->deleteAll();
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function createDerivative($original_uri, $derivative_uri) {
-    // Get the folder for the final location of this style.
-    $directory = drupal_dirname($derivative_uri);
-
-    // Build the destination folder tree if it doesn't already exist.
-    if (!file_prepare_directory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS)) {
-      watchdog('image', 'Failed to create style directory: %directory', array('%directory' => $directory), WATCHDOG_ERROR);
-      return FALSE;
-    }
-
-    if (!$image = image_load($original_uri)) {
-      return FALSE;
-    }
-
-    if (!empty($this->effects)) {
-      foreach ($this->effects as $effect) {
-        image_effect_apply($image, $effect);
-      }
-    }
-
-    if (!image_save($image, $derivative_uri)) {
-      if (file_exists($derivative_uri)) {
-        watchdog('image', 'Cached image file %destination already exists. There may be an issue with your rewrite configuration.', array('%destination' => $derivative_uri), WATCHDOG_ERROR);
-      }
-      return FALSE;
-    }
-
-    return TRUE;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function transformDimensions(array &$dimensions) {
-    module_load_include('inc', 'image', 'image.effects');
-
-    if (!empty($this->effects)) {
-      foreach ($this->effects as $effect) {
-        if (isset($effect['dimensions passthrough'])) {
-          continue;
-        }
-
-        if (isset($effect['dimensions callback'])) {
-          $effect['dimensions callback']($dimensions, $effect['data']);
-        }
-        else {
-          $dimensions['width'] = $dimensions['height'] = NULL;
-        }
-      }
-    }
-  }
-
-  /**
-   * Generates a token to protect an image style derivative.
-   *
-   * This prevents unauthorized generation of an image style derivative,
-   * which can be costly both in CPU time and disk space.
-   *
-   * @param string $uri
-   *   The URI of the image for this style, for example as returned by
-   *   \Drupal\image\ImageStyleInterface::buildUri().
-   *
-   * @return string
-   *   An eight-character token which can be used to protect image style
-   *   derivatives against denial-of-service attacks.
-   */
-  protected function getPathToken($uri) {
-    // Return the first eight characters.
-    return substr(Crypt::hmacBase64($this->id() . ':' . $uri, drupal_get_private_key() . drupal_get_hash_salt()), 0, 8);
-  }
-
 }
diff --git a/core/modules/image/lib/Drupal/image/Tests/FileMoveTest.php b/core/modules/image/lib/Drupal/image/Tests/FileMoveTest.php
index 2fc0b68..f085f2d 100644
--- a/core/modules/image/lib/Drupal/image/Tests/FileMoveTest.php
+++ b/core/modules/image/lib/Drupal/image/Tests/FileMoveTest.php
@@ -39,9 +39,8 @@ function testNormal() {
     // Create derivative image.
     $styles = entity_load_multiple('image_style');
     $style = image_style_load(key($styles));
-    $original_uri = $file->getFileUri();
-    $derivative_uri = $style->buildUri($original_uri);
-    $style->createDerivative($original_uri, $derivative_uri);
+    $derivative_uri = image_style_path($style->id(), $file->getFileUri());
+    image_style_create_derivative($style, $file->getFileUri(), $derivative_uri);
 
     // Check if derivative image exists.
     $this->assertTrue(file_exists($derivative_uri), 'Make sure derivative image is generated successfully.');
diff --git a/core/modules/image/lib/Drupal/image/Tests/ImageAdminStylesTest.php b/core/modules/image/lib/Drupal/image/Tests/ImageAdminStylesTest.php
index 88eb3ad..973a8ef 100644
--- a/core/modules/image/lib/Drupal/image/Tests/ImageAdminStylesTest.php
+++ b/core/modules/image/lib/Drupal/image/Tests/ImageAdminStylesTest.php
@@ -7,7 +7,7 @@
 
 namespace Drupal\image\Tests;
 
-use Drupal\image\ImageStyleInterface;
+use Drupal\Core\Language\Language;
 
 /**
  * Tests creation, deletion, and editing of image styles and effects.
@@ -25,7 +25,7 @@ public static function getInfo() {
   /**
    * Given an image style, generate an image.
    */
-  function createSampleImage(ImageStyleInterface $style) {
+  function createSampleImage($style) {
     static $file_path;
 
     // First, we need to make sure we have an image in our testing
@@ -36,13 +36,13 @@ function createSampleImage(ImageStyleInterface $style) {
       $file_path = file_unmanaged_copy($file->uri);
     }
 
-    return $style->buildUrl($file_path) ? $file_path : FALSE;
+    return image_style_url($style->id(), $file_path) ? $file_path : FALSE;
   }
 
   /**
    * Count the number of images currently create for a style.
    */
-  function getImageCount(ImageStyleInterface $style) {
+  function getImageCount($style) {
     return count(file_scan_directory('public://styles/' . $style->id(), '/.*/'));
   }
 
@@ -271,13 +271,9 @@ function testStyleReplacement() {
     $nid = $this->uploadNodeImage($test_image, $field_name, 'article');
     $node = node_load($nid);
 
-    // Get node field original image URI.
-    $fid = $node->get($field_name)->target_id;
-    $original_uri = file_load($fid)->getFileUri();
-
     // Test that image is displayed using newly created style.
     $this->drupalGet('node/' . $nid);
-    $this->assertRaw($style->buildUrl($original_uri), format_string('Image displayed using style @style.', array('@style' => $style_name)));
+    $this->assertRaw(image_style_url($style_name, file_load($node->{$field_name}[Language::LANGCODE_NOT_SPECIFIED][0]['target_id'])->getFileUri()), format_string('Image displayed using style @style.', array('@style' => $style_name)));
 
     // Rename the style and make sure the image field is updated.
     $new_style_name = strtolower($this->randomName(10));
@@ -289,10 +285,7 @@ function testStyleReplacement() {
     $this->drupalPost($style_path . $style_name, $edit, t('Update style'));
     $this->assertText(t('Changes to the style have been saved.'), format_string('Style %name was renamed to %new_name.', array('%name' => $style_name, '%new_name' => $new_style_name)));
     $this->drupalGet('node/' . $nid);
-
-    // Reload the image style using the new name.
-    $style = entity_load('image_style', $new_style_name);
-    $this->assertRaw($style->buildUrl($original_uri), 'Image displayed using style replacement style.');
+    $this->assertRaw(image_style_url($new_style_name, file_load($node->{$field_name}[Language::LANGCODE_NOT_SPECIFIED][0]['target_id'])->getFileUri()), 'Image displayed using style replacement style.');
 
     // Delete the style and choose a replacement style.
     $edit = array(
@@ -302,9 +295,8 @@ function testStyleReplacement() {
     $message = t('Style %name was deleted.', array('%name' => $new_style_label));
     $this->assertRaw($message);
 
-    $replacement_style = entity_load('image_style', 'thumbnail');
     $this->drupalGet('node/' . $nid);
-    $this->assertRaw($replacement_style->buildUrl($original_uri), 'Image displayed using style replacement style.');
+    $this->assertRaw(image_style_url('thumbnail', file_load($node->{$field_name}[Language::LANGCODE_NOT_SPECIFIED][0]['target_id'])->getFileUri()), 'Image displayed using style replacement style.');
   }
 
   /**
@@ -368,13 +360,9 @@ function testConfigImport() {
     $nid = $this->uploadNodeImage($test_image, $field_name, 'article');
     $node = node_load($nid);
 
-    // Get node field original image URI.
-    $fid = $node->get($field_name)->target_id;
-    $original_uri = file_load($fid)->getFileUri();
-
     // Test that image is displayed using newly created style.
     $this->drupalGet('node/' . $nid);
-    $this->assertRaw($style->buildUrl($original_uri), format_string('Image displayed using style @style.', array('@style' => $style_name)));
+    $this->assertRaw(image_style_url($style_name, file_load($node->{$field_name}[Language::LANGCODE_NOT_SPECIFIED][0]['target_id'])->getFileUri()), format_string('Image displayed using style @style.', array('@style' => $style_name)));
 
     // Copy config to staging, and delete the image style.
     $staging = $this->container->get('config.storage.staging');
@@ -386,5 +374,4 @@ function testConfigImport() {
     $this->assertFalse(entity_load('image_style', $style_name), 'Style deleted after config import.');
     $this->assertEqual($this->getImageCount($style), 0, 'Image style was flushed after being deleted by config import.');
   }
-
 }
diff --git a/core/modules/image/lib/Drupal/image/Tests/ImageDimensionsTest.php b/core/modules/image/lib/Drupal/image/Tests/ImageDimensionsTest.php
index 8a08dee..e7552d2 100644
--- a/core/modules/image/lib/Drupal/image/Tests/ImageDimensionsTest.php
+++ b/core/modules/image/lib/Drupal/image/Tests/ImageDimensionsTest.php
@@ -44,7 +44,7 @@ function testImageDimensions() {
     $style = entity_create('image_style', array('name' => 'test', 'label' => 'Test'));
     $style->save();
     $generated_uri = 'public://styles/test/public/'. drupal_basename($original_uri);
-    $url = $style->buildUrl($original_uri);
+    $url = image_style_url('test', $original_uri);
 
     $variables = array(
       'style_name' => 'test',
diff --git a/core/modules/image/lib/Drupal/image/Tests/ImageFieldDisplayTest.php b/core/modules/image/lib/Drupal/image/Tests/ImageFieldDisplayTest.php
index e7775ad..c0f0cfd 100644
--- a/core/modules/image/lib/Drupal/image/Tests/ImageFieldDisplayTest.php
+++ b/core/modules/image/lib/Drupal/image/Tests/ImageFieldDisplayTest.php
@@ -112,7 +112,7 @@ function _testImageFieldFormatters($scheme) {
 
     // Ensure the derivative image is generated so we do not have to deal with
     // image style callback paths.
-    $this->drupalGet(entity_load('image_style', 'thumbnail')->buildUrl($image_uri));
+    $this->drupalGet(image_style_url('thumbnail', $image_uri));
     $image_info['uri'] = $image_uri;
     $image_info['width'] = 100;
     $image_info['height'] = 50;
@@ -124,7 +124,7 @@ function _testImageFieldFormatters($scheme) {
     if ($scheme == 'private') {
       // Log out and try to access the file.
       $this->drupalLogout();
-      $this->drupalGet(entity_load('image_style', 'thumbnail')->buildUrl($image_uri));
+      $this->drupalGet(image_style_url('thumbnail', $image_uri));
       $this->assertResponse('403', 'Access denied to image style thumbnail as anonymous user.');
     }
   }
diff --git a/core/modules/image/lib/Drupal/image/Tests/ImageFieldTestBase.php b/core/modules/image/lib/Drupal/image/Tests/ImageFieldTestBase.php
index b1d1716..3b9be9f 100644
--- a/core/modules/image/lib/Drupal/image/Tests/ImageFieldTestBase.php
+++ b/core/modules/image/lib/Drupal/image/Tests/ImageFieldTestBase.php
@@ -15,11 +15,11 @@
  *
  * image.effects.inc:
  *   image_style_generate()
- *   \Drupal\image\ImageStyleInterface::createDerivative()
+ *   image_style_create_derivative()
  *
  * image.module:
  *   image_style_options()
- *   \Drupal\image\ImageStyleInterface::flush()
+ *   image_style_flush()
  *   image_effect_definition_load()
  *   image_effect_load()
  *   image_effect_save()
diff --git a/core/modules/image/lib/Drupal/image/Tests/ImageStyleFlushTest.php b/core/modules/image/lib/Drupal/image/Tests/ImageStyleFlushTest.php
index 101171b..298819a 100644
--- a/core/modules/image/lib/Drupal/image/Tests/ImageStyleFlushTest.php
+++ b/core/modules/image/lib/Drupal/image/Tests/ImageStyleFlushTest.php
@@ -34,8 +34,8 @@ function createSampleImage($style, $wrapper) {
     // Make sure we have an image in our wrapper testing file directory.
     $source_uri = file_unmanaged_copy($file->uri, $wrapper . '://');
     // Build the derivative image.
-    $derivative_uri = $style->buildUri($source_uri);
-    $derivative = $style->createDerivative($source_uri, $derivative_uri);
+    $derivative_uri = image_style_path($style->id(), $source_uri);
+    $derivative = image_style_create_derivative($style, $source_uri, $derivative_uri);
 
     return $derivative ? $derivative_uri : FALSE;
   }
diff --git a/core/modules/image/lib/Drupal/image/Tests/ImageStylesPathAndUrlTest.php b/core/modules/image/lib/Drupal/image/Tests/ImageStylesPathAndUrlTest.php
index cae45d7..1b9e2db 100644
--- a/core/modules/image/lib/Drupal/image/Tests/ImageStylesPathAndUrlTest.php
+++ b/core/modules/image/lib/Drupal/image/Tests/ImageStylesPathAndUrlTest.php
@@ -22,10 +22,9 @@ class ImageStylesPathAndUrlTest extends WebTestBase {
    */
   public static $modules = array('image', 'image_module_test');
 
-  /**
-   * @var \Drupal\image\ImageStyleInterface
-   */
-  protected $style;
+  protected $style_name;
+  protected $image_info;
+  protected $image_filepath;
 
   public static function getInfo() {
     return array(
@@ -38,57 +37,58 @@ public static function getInfo() {
   function setUp() {
     parent::setUp();
 
-    $this->style = entity_create('image_style', array('name' => 'style_foo', 'label' => $this->randomString()));
-    $this->style->save();
+    $this->style_name = 'style_foo';
+    $style = entity_create('image_style', array('name' => $this->style_name, 'label' => $this->randomString()));
+    $style->save();
   }
 
   /**
-   * Tests \Drupal\image\ImageStyleInterface::buildUri().
+   * Test image_style_path().
    */
   function testImageStylePath() {
     $scheme = 'public';
-    $actual = $this->style->buildUri("$scheme://foo/bar.gif");
-    $expected = "$scheme://styles/" . $this->style->id() . "/$scheme/foo/bar.gif";
+    $actual = image_style_path($this->style_name, "$scheme://foo/bar.gif");
+    $expected = "$scheme://styles/" . $this->style_name . "/$scheme/foo/bar.gif";
     $this->assertEqual($actual, $expected, 'Got the path for a file URI.');
 
-    $actual = $this->style->buildUri('foo/bar.gif');
-    $expected = "$scheme://styles/" . $this->style->id() . "/$scheme/foo/bar.gif";
+    $actual = image_style_path($this->style_name, 'foo/bar.gif');
+    $expected = "$scheme://styles/" . $this->style_name . "/$scheme/foo/bar.gif";
     $this->assertEqual($actual, $expected, 'Got the path for a relative file path.');
   }
 
   /**
-   * Tests an image style URL using the "public://" scheme.
+   * Test image_style_url() with a file using the "public://" scheme.
    */
   function testImageStyleUrlAndPathPublic() {
-    $this->doImageStyleUrlAndPathTests('public');
+    $this->_testImageStyleUrlAndPath('public');
   }
 
   /**
-   * Tests an image style URL using the "private://" scheme.
+   * Test image_style_url() with a file using the "private://" scheme.
    */
   function testImageStyleUrlAndPathPrivate() {
-    $this->doImageStyleUrlAndPathTests('private');
+    $this->_testImageStyleUrlAndPath('private');
   }
 
   /**
-   * Tests an image style URL with the "public://" scheme and unclean URLs.
+   * Test image_style_url() with the "public://" scheme and unclean URLs.
    */
-   function testImageStyleUrlAndPathPublicUnclean() {
-     $this->doImageStyleUrlAndPathTests('public', FALSE);
+   function testImageStylUrlAndPathPublicUnclean() {
+     $this->_testImageStyleUrlAndPath('public', FALSE);
    }
 
   /**
-   * Tests an image style URL with the "private://" schema and unclean URLs.
+   * Test image_style_url() with the "private://" schema and unclean URLs.
    */
   function testImageStyleUrlAndPathPrivateUnclean() {
-    $this->doImageStyleUrlAndPathTests('private', FALSE);
+    $this->_testImageStyleUrlAndPath('private', FALSE);
   }
 
   /**
-   * Tests an image style URL with a file URL that has an extra slash in it.
+   * Tests image_style_url() with a file URL that has an extra slash in it.
    */
   function testImageStyleUrlExtraSlash() {
-    $this->doImageStyleUrlAndPathTests('public', TRUE, TRUE);
+    $this->_testImageStyleUrlAndPath('public', TRUE, TRUE);
   }
 
   /**
@@ -96,29 +96,30 @@ function testImageStyleUrlExtraSlash() {
    */
   function testImageStyleUrlForMissingSourceImage() {
     $non_existent_uri = 'public://foo.png';
-    $generated_url = $this->style->buildUrl($non_existent_uri);
+    $generated_url = image_style_url($this->style_name, $non_existent_uri);
     $this->drupalGet($generated_url);
     $this->assertResponse(404, 'Accessing an image style URL with a source image that does not exist provides a 404 error response.');
   }
 
   /**
-   * Tests building an image style URL.
+   * Tests image_style_url().
    */
-  function doImageStyleUrlAndPathTests($scheme, $clean_url = TRUE, $extra_slash = FALSE) {
-    $this->prepareRequestForGenerator($clean_url);
+  function _testImageStyleUrlAndPath($scheme, $clean_url = TRUE, $extra_slash = FALSE) {
+    $request = $this->prepareRequestForGenerator($clean_url);
 
     // Make the default scheme neither "public" nor "private" to verify the
     // functions work for other than the default scheme.
     config('system.file')->set('default_scheme', 'temporary')->save();
 
     // Create the directories for the styles.
-    $directory = $scheme . '://styles/' . $this->style->id();
+    $directory = $scheme . '://styles/' . $this->style_name;
     $status = file_prepare_directory($directory, FILE_CREATE_DIRECTORY);
     $this->assertNotIdentical(FALSE, $status, 'Created the directory for the generated images for the test style.');
 
     // Create a working copy of the file.
     $files = $this->drupalGetTestFiles('image');
     $file = array_shift($files);
+    $image_info = image_get_info($file->uri);
     $original_uri = file_unmanaged_copy($file->uri, $scheme . '://', FILE_EXISTS_RENAME);
     // Let the image_module_test module know about this file, so it can claim
     // ownership in hook_file_download().
@@ -126,9 +127,9 @@ function doImageStyleUrlAndPathTests($scheme, $clean_url = TRUE, $extra_slash =
     $this->assertNotIdentical(FALSE, $original_uri, 'Created the generated image file.');
 
     // Get the URL of a file that has not been generated and try to create it.
-    $generated_uri = $this->style->buildUri($original_uri);
+    $generated_uri = image_style_path($this->style_name, $original_uri);
     $this->assertFalse(file_exists($generated_uri), 'Generated file does not exist.');
-    $generate_url = $this->style->buildUrl($original_uri, $clean_url);
+    $generate_url = image_style_url($this->style_name, $original_uri, $clean_url);
 
     // Ensure that the tests still pass when the file is generated by accessing
     // a poorly constructed (but still valid) file URL that has an extra slash
@@ -136,7 +137,7 @@ function doImageStyleUrlAndPathTests($scheme, $clean_url = TRUE, $extra_slash =
     if ($extra_slash) {
       $modified_uri = str_replace('://', ':///', $original_uri);
       $this->assertNotEqual($original_uri, $modified_uri, 'An extra slash was added to the generated file URI.');
-      $generate_url = $this->style->buildUrl($modified_uri, $clean_url);
+      $generate_url = image_style_url($this->style_name, $modified_uri, $clean_url);
     }
     if (!$clean_url) {
       $this->assertTrue(strpos($generate_url, 'index.php/') !== FALSE, 'When using non-clean URLS, the system path contains the script name.');
@@ -161,8 +162,8 @@ function doImageStyleUrlAndPathTests($scheme, $clean_url = TRUE, $extra_slash =
       $this->assertNotEqual(strpos($this->drupalGetHeader('Cache-Control'), 'no-cache'), FALSE, 'Cache-Control header contains \'no-cache\' to prevent caching.');
       $this->assertEqual($this->drupalGetHeader('X-Image-Owned-By'), 'image_module_test', 'Expected custom header has been added.');
 
-      // Make sure that a second request to the already existing derivative
-      // works too.
+      // Make sure that a second request to the already existing derivate works
+      // too.
       $this->drupalGet($generate_url);
       $this->assertResponse(200, 'Image was generated at the URL.');
 
@@ -176,9 +177,9 @@ function doImageStyleUrlAndPathTests($scheme, $clean_url = TRUE, $extra_slash =
       // make sure that access is denied.
       $file_noaccess = array_shift($files);
       $original_uri_noaccess = file_unmanaged_copy($file_noaccess->uri, $scheme . '://', FILE_EXISTS_RENAME);
-      $generated_uri_noaccess = $scheme . '://styles/' . $this->style->id() . '/' . $scheme . '/'. drupal_basename($original_uri_noaccess);
+      $generated_uri_noaccess = $scheme . '://styles/' . $this->style_name . '/' . $scheme . '/'. drupal_basename($original_uri_noaccess);
       $this->assertFalse(file_exists($generated_uri_noaccess), 'Generated file does not exist.');
-      $generate_url_noaccess = $this->style->buildUrl($original_uri_noaccess);
+      $generate_url_noaccess = image_style_url($this->style_name, $original_uri_noaccess);
 
       $this->drupalGet($generate_url_noaccess);
       $this->assertResponse(403, 'Confirmed that access is denied for the private image style.');
@@ -205,6 +206,7 @@ function doImageStyleUrlAndPathTests($scheme, $clean_url = TRUE, $extra_slash =
     // Create another working copy of the file.
     $files = $this->drupalGetTestFiles('image');
     $file = array_shift($files);
+    $image_info = image_get_info($file->uri);
     $original_uri = file_unmanaged_copy($file->uri, $scheme . '://', FILE_EXISTS_RENAME);
     // Let the image_module_test module know about this file, so it can claim
     // ownership in hook_file_download().
@@ -214,12 +216,12 @@ function doImageStyleUrlAndPathTests($scheme, $clean_url = TRUE, $extra_slash =
     // has not been created and try to create it. Check that the security token
     // is not present in the URL but that the image is still accessible.
     config('image.settings')->set('suppress_itok_output', TRUE)->save();
-    $generated_uri = $this->style->buildUri($original_uri);
+    $generated_uri = image_style_path($this->style_name, $original_uri);
     $this->assertFalse(file_exists($generated_uri), 'Generated file does not exist.');
-    $generate_url = $this->style->buildUrl($original_uri, $clean_url);
+    $generate_url = image_style_url($this->style_name, $original_uri, $clean_url);
     $this->assertIdentical(strpos($generate_url, IMAGE_DERIVATIVE_TOKEN . '='), FALSE, 'The security token does not appear in the image style URL.');
     $this->drupalGet($generate_url);
     $this->assertResponse(200, 'Image was accessible at the URL with a missing token.');
-  }
 
+  }
 }
diff --git a/core/modules/image/lib/Drupal/image/Tests/ImageThemeFunctionTest.php b/core/modules/image/lib/Drupal/image/Tests/ImageThemeFunctionTest.php
index f0d540f..cd00cb1 100644
--- a/core/modules/image/lib/Drupal/image/Tests/ImageThemeFunctionTest.php
+++ b/core/modules/image/lib/Drupal/image/Tests/ImageThemeFunctionTest.php
@@ -41,7 +41,7 @@ function testImageFormatterTheme() {
     // Create a style.
     $style = entity_create('image_style', array('name' => 'test', 'label' => 'Test'));
     $style->save();
-    $url = $style->buildUrl($original_uri);
+    $url = image_style_url('test', $original_uri);
 
     // Test using theme_image_formatter() without an image title, alt text, or
     // link options.
@@ -84,7 +84,7 @@ function testImageStyleTheme() {
     // Create a style.
     $style = entity_create('image_style', array('name' => 'image_test', 'label' => 'Test'));
     $style->save();
-    $url = $style->buildUrl($original_uri);
+    $url = image_style_url('image_test', $original_uri);
 
     $path = $this->randomName();
     $element = array(
diff --git a/core/modules/image/lib/Drupal/image/Type/ImageItem.php b/core/modules/image/lib/Drupal/image/Type/ImageItem.php
index 3b86fe4..7d441fd 100644
--- a/core/modules/image/lib/Drupal/image/Type/ImageItem.php
+++ b/core/modules/image/lib/Drupal/image/Type/ImageItem.php
@@ -28,31 +28,28 @@ class ImageItem extends ConfigEntityReferenceItemBase {
    */
   public function getPropertyDefinitions() {
     $this->definition['settings']['target_type'] = 'file';
-    // Definitions vary by entity type and bundle, so key them accordingly.
-    $key = $this->definition['settings']['target_type'] . ':';
-    $key .= isset($this->definition['settings']['target_bundle']) ? $this->definition['settings']['target_bundle'] : '';
 
-    if (!isset(static::$propertyDefinitions[$key])) {
-      static::$propertyDefinitions[$key] = parent::getPropertyDefinitions();
+    if (!isset(static::$propertyDefinitions)) {
+      static::$propertyDefinitions = parent::getPropertyDefinitions();
 
-      static::$propertyDefinitions[$key]['alt'] = array(
+      static::$propertyDefinitions['alt'] = array(
         'type' => 'string',
         'label' => t("Alternative image text, for the image's 'alt' attribute."),
       );
-      static::$propertyDefinitions[$key]['title'] = array(
+      static::$propertyDefinitions['title'] = array(
         'type' => 'string',
         'label' => t("Image title text, for the image's 'title' attribute."),
       );
-      static::$propertyDefinitions[$key]['width'] = array(
+      static::$propertyDefinitions['width'] = array(
         'type' => 'integer',
         'label' => t('The width of the image in pixels.'),
       );
-      static::$propertyDefinitions[$key]['height'] = array(
+      static::$propertyDefinitions['height'] = array(
         'type' => 'integer',
         'label' => t('The height of the image in pixels.'),
       );
     }
-    return static::$propertyDefinitions[$key];
+    return static::$propertyDefinitions;
   }
 
 }
diff --git a/core/modules/language/config/schema/language.schema.yml b/core/modules/language/config/schema/language.schema.yml
index d50d121..495f724 100644
--- a/core/modules/language/config/schema/language.schema.yml
+++ b/core/modules/language/config/schema/language.schema.yml
@@ -45,32 +45,3 @@ language.mappings:
   sequence:
     - type: string
       label: 'Language'
-
-language.entity.*:
-  type: mapping
-  label: 'Language'
-  mapping:
-    id:
-      type: string
-      label: 'ID'
-    uuid:
-      type: string
-      label: 'UUID'
-    label:
-      type: label
-      label: 'Language name'
-    direction:
-      type: boolean
-      label: 'Direction'
-    weight:
-      type: integer
-      label: 'Weight'
-    locked:
-      type: boolean
-      label: 'Locked'
-    status:
-      type: boolean
-      label: 'Status'
-    langcode:
-      type: string
-      label: 'Language code'
diff --git a/core/modules/language/language.admin.inc b/core/modules/language/language.admin.inc
index 041398e..a7c6663 100644
--- a/core/modules/language/language.admin.inc
+++ b/core/modules/language/language.admin.inc
@@ -11,6 +11,84 @@
 use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
 
 /**
+ * User interface for the language overview screen.
+ */
+function language_admin_overview_form($form, &$form_state) {
+  drupal_static_reset('language_list');
+  $languages = language_list();
+  $default = language_default();
+
+  $form['languages'] = array(
+    '#languages' => $languages,
+    '#language_default' => $default,
+    '#type' => 'table',
+    '#header' => array(
+      t('Name'),
+      t('Weight'),
+      t('Operations'),
+    ),
+    '#tabledrag' => array(
+      array('order', 'sibling', 'language-order-weight'),
+    ),
+  );
+
+  foreach ($languages as $langcode => $language) {
+    $form['languages'][$langcode]['#attributes']['class'][] = 'draggable';
+    $form['languages'][$langcode]['name'] = array(
+      '#markup' => check_plain($language->name),
+    );
+    $form['languages'][$langcode]['weight'] = array(
+      '#type' => 'weight',
+      '#title' => t('Weight for @title', array('@title' => $language->name)),
+      '#title_display' => 'invisible',
+      '#default_value' => $language->weight,
+      '#attributes' => array(
+        'class' => array('language-order-weight'),
+      ),
+      '#delta' => 30,
+    );
+    $links = array();
+    $links['edit'] = array(
+      'title' => t('edit'),
+      'href' => 'admin/config/regional/language/edit/' . $langcode,
+    );
+    if ($langcode != $default->id) {
+      $links['delete'] = array(
+        'title' => t('delete'),
+        'href' => 'admin/config/regional/language/delete/' . $langcode,
+      );
+    }
+    $form['languages'][$langcode]['operations'] = array(
+      '#type' => 'operations',
+      '#links' => $links,
+      '#weight' => 100,
+    );
+  }
+
+  $form['actions'] = array('#type' => 'actions');
+  $form['actions']['submit'] = array(
+    '#type' => 'submit',
+    '#value' => t('Save configuration'),
+  );
+
+  return $form;
+}
+
+/**
+ * Process language overview form submissions, updating existing languages.
+ */
+function language_admin_overview_form_submit($form, &$form_state) {
+  $languages = language_list();
+
+  foreach ($languages as $langcode => $language) {
+    $language->weight = $form_state['values']['languages'][$langcode]['weight'];
+    language_save($language);
+  }
+
+  drupal_set_message(t('Configuration saved.'));
+}
+
+/**
  * User interface for the language addition screen.
  */
 function language_admin_add_form($form, &$form_state) {
@@ -109,7 +187,7 @@ function _language_admin_common_controls(&$form, $language = NULL) {
   }
   $form['name'] = array(
     '#type' => 'textfield',
-    '#title' => t('Language name in English'),
+    '#title' => t('Language name'),
     '#maxlength' => 64,
     '#default_value' => @$language->name,
     '#required' => TRUE,
@@ -280,17 +358,11 @@ function language_negotiation_configure_form() {
   $form = array(
     '#submit' => array('language_negotiation_configure_form_submit'),
     '#theme' => 'language_negotiation_configure_form',
+    '#language_types' => language_types_get_configurable(FALSE),
     '#language_types_info' => language_types_info(),
     '#language_negotiation_info' => language_negotiation_info(),
   );
-  $form['#language_types'] = array();
-  $configurable = config('system.language.types')->get('configurable');
-  foreach ($form['#language_types_info'] as $type => $info) {
-    // Show locked language types only if they are configurable.
-    if (empty($info['locked']) || in_array($type, $configurable)) {
-      $form['#language_types'][] = $type;
-    }
-  }
+
   foreach ($form['#language_types'] as $type) {
     language_negotiation_configure_form_table($form, $type);
   }
@@ -318,21 +390,6 @@ function language_negotiation_configure_form_table(&$form, $type) {
     '#show_operations' => FALSE,
     'weight' => array('#tree' => TRUE),
   );
-  // Only show configurability checkbox for the unlocked language types.
-  if (empty($info['locked'])) {
-    $configurable = config('system.language.types')->get('configurable');
-    $table_form['configurable'] = array(
-      '#type' => 'checkbox',
-      '#title' => t('Customize %language_name language detection to differ from User interface text language detection settings.', array('%language_name' => $info['name'])),
-      '#default_value' => in_array($type, $configurable),
-      '#attributes' => array('class' => array('language-customization-checkbox')),
-      '#attached' => array(
-        'library' => array(
-          array('language', 'language.admin')
-        ),
-      ),
-    );
-  }
 
   $negotiation_info = $form['#language_negotiation_info'];
   $enabled_methods = variable_get("language_negotiation_$type", array());
@@ -464,13 +521,12 @@ function theme_language_negotiation_configure_form($variables) {
       '#rows' => $rows,
       '#attributes' => array('id' => "language-negotiation-methods-$type"),
     );
-    $table  = drupal_render($form[$type]['configurable']);
-    $table .= drupal_render($build);
+    $table  = drupal_render($build);
     $table .= drupal_render_children($form[$type]);
 
     drupal_add_tabledrag("language-negotiation-methods-$type", 'order', 'sibling', "language-method-weight-$type");
 
-    $output .= '<div class="form-item table-language-group table-' . $type . '-wrapper">' . $title . $description . $table . '</div>';
+    $output .= '<div class="form-item">' . $title . $description . $table . '</div>';
   }
 
   $output .= drupal_render_children($form);
@@ -483,19 +539,11 @@ function theme_language_negotiation_configure_form($variables) {
 function language_negotiation_configure_form_submit($form, &$form_state) {
   $configurable_types = $form['#language_types'];
 
-  $stored_values = config('system.language.types')->get('configurable');
-  $customized = array();
-  $method_weights_type = array();
-
   foreach ($configurable_types as $type) {
-    $customized[$type] = in_array($type, $stored_values);
     $method_weights = array();
     $enabled_methods = $form_state['values'][$type]['enabled'];
     $enabled_methods[LANGUAGE_NEGOTIATION_SELECTED] = TRUE;
     $method_weights_input = $form_state['values'][$type]['weight'];
-    if (isset($form_state['values'][$type]['configurable'])) {
-      $customized[$type] = !empty($form_state['values'][$type]['configurable']);
-    }
 
     foreach ($method_weights_input as $method_id => $weight) {
       if ($enabled_methods[$method_id]) {
@@ -503,28 +551,13 @@ function language_negotiation_configure_form_submit($form, &$form_state) {
       }
     }
 
-    $method_weights_type[$type] = $method_weights;
+    language_negotiation_set($type, $method_weights);
     variable_set("language_negotiation_methods_weight_$type", $method_weights_input);
   }
 
   // Update non-configurable language types and the related language negotiation
   // configuration.
-  language_types_set(array_keys(array_filter($customized)));
-
-  // Update the language negotiations after setting the configurability.
-  foreach ($method_weights_type as $type => $method_weights) {
-    language_negotiation_set($type, $method_weights);
-  }
-
-  // Clear block definitions cache since the available blocks and their names
-  // may have been changed based on the configurable types.
-  if (module_exists('block')) {
-    // If there is an active language switcher for a language type that has been
-    // made not configurable, deactivate it first.
-    $non_configurable = array_keys(array_diff($customized, array_filter($customized)));
-    _language_disable_language_switcher($non_configurable);
-    Drupal::service('plugin.manager.block')->clearCachedDefinitions();
-  }
+  language_types_set();
 
   $form_state['redirect'] = 'admin/config/regional/language/detection';
   drupal_set_message(t('Language negotiation configuration saved.'));
@@ -549,8 +582,10 @@ function language_negotiation_configure_browser_form($form, &$form_state) {
   // the list of existing and then predefined languages.
   if (empty($existing_languages)) {
     $language_options = language_admin_predefined_list();
+    $default = key($language_options);
   }
   else {
+    $default = key($existing_languages);
     $language_options = array(
       t('Existing languages') => $existing_languages,
       t('Languages not yet added') => language_admin_predefined_list()
@@ -906,21 +941,3 @@ function language_content_settings_form_submit(array $form, array &$form_state)
   }
   drupal_set_message(t('Settings successfully updated.'));
 }
-
-/**
- * Helper function to disable the language switcher blocks.
- *
- * @param array $language_types
- *   Array containing all language types whose language switchers need to be
- *   disabled.
- */
-function _language_disable_language_switcher(array $language_types) {
-  $blocks = _block_rehash();
-  foreach ($language_types as $language_type) {
-    foreach ($blocks as $block) {
-      if (strpos($block->id, 'language_switcher_' . substr($language_type, 9)) !== FALSE) {
-        $block->delete();
-      }
-    }
-  }
-}
diff --git a/core/modules/language/language.admin.js b/core/modules/language/language.admin.js
deleted file mode 100644
index 41623cf..0000000
--- a/core/modules/language/language.admin.js
+++ /dev/null
@@ -1,32 +0,0 @@
-(function ($, Drupal) {
-
-"use strict";
-
-/**
- * Makes language negotiation inherit user interface negotiation.
- */
-Drupal.behaviors.negotiationLanguage = {
-  attach: function () {
-    var $configForm = $('#language-negotiation-configure-form');
-    var inputSelector = 'input[name$="[configurable]"]';
-    // Given a customization checkbox derive the language type being changed.
-    function toggleTable (checkbox) {
-      var $checkbox = $(checkbox);
-      // Get the language detection type such as User interface text language
-      // detection or Content language detection.
-      $checkbox.closest('.table-language-group')
-        .find('table, .tabledrag-toggle-weight')
-        .toggle($checkbox.prop('checked'));
-    }
-    // Bind hide/show and rearrange customization checkboxes.
-    $configForm.once('negotiation-language-admin-bind').on('change', inputSelector, function (event) {
-      toggleTable(event.target);
-    });
-    // Initially, hide language detection types that are not customized.
-    $configForm.find(inputSelector + ':not(:checked)').each(function (index, element) {
-      toggleTable(element);
-    });
-  }
-};
-
-})(jQuery, Drupal);
diff --git a/core/modules/language/language.install b/core/modules/language/language.install
index b7b3c77..066ef26 100644
--- a/core/modules/language/language.install
+++ b/core/modules/language/language.install
@@ -17,8 +17,7 @@
 function language_install() {
   // Enable URL language detection for each configurable language type.
   require_once DRUPAL_ROOT . '/core/includes/language.inc';
-  foreach (language_types_get_configurable() as $type) {
-    module_load_include('inc', 'language', 'language.negotiation');
+  foreach (language_types_get_configurable(FALSE) as $type) {
     language_negotiation_set($type, array(LANGUAGE_NEGOTIATION_URL => 0));
   }
 }
diff --git a/core/modules/language/language.module b/core/modules/language/language.module
index 9674630..bdbd15c 100644
--- a/core/modules/language/language.module
+++ b/core/modules/language/language.module
@@ -70,7 +70,10 @@ function language_menu() {
   $items['admin/config/regional/language'] = array(
     'title' => 'Languages',
     'description' => 'Configure languages for content and the user interface.',
-    'route_name' => 'language_admin_overview',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('language_admin_overview_form'),
+    'access arguments' => array('administer languages'),
+    'file' => 'language.admin.inc',
     'weight' => -10,
   );
   $items['admin/config/regional/language/list'] = array(
@@ -157,8 +160,6 @@ function language_menu() {
 
 /**
  * Editing or deleting locked languages should not be possible.
- *
- * @deprecated Use \Drupal\language\LanguageAccessController instead.
  */
 function language_access_language_edit_or_delete($language) {
   return !$language->locked && user_access('administer languages');
@@ -462,9 +463,8 @@ function language_get_default_langcode($entity_type, $bundle) {
 
     case 'authors_default':
       global $user;
-      $language_code = $user->getPreferredLangcode();
-      if (!empty($language_code)) {
-        $default_value = $language_code;
+      if (!empty($user->preferred_langcode)) {
+        $default_value = $user->preferred_langcode;
       }
       else {
         $default_value = $language_interface->id;
@@ -591,26 +591,6 @@ function language_delete($langcode) {
 }
 
 /**
- * Implements hook_library_info().
- */
-function language_library_info() {
-  $libraries['language.admin'] = array(
-    'title' => 'Language detection admin',
-    'version' => VERSION,
-    'js' => array(
-      drupal_get_path('module', 'language') . '/language.admin.js' => array(),
-    ),
-    'dependencies' => array(
-      array('system', 'jquery'),
-      array('system', 'drupal'),
-      array('system', 'jquery.once'),
-    ),
-  );
-
-  return $libraries;
-}
-
-/**
  * Implements hook_language_types_info().
  *
  * Defines the three core language types:
@@ -631,17 +611,14 @@ function language_language_types_info() {
     Language::TYPE_INTERFACE => array(
       'name' => t('User interface text'),
       'description' => t('Order of language detection methods for user interface text. If a translation of user interface text is available in the detected language, it will be displayed.'),
-      'locked' => TRUE,
     ),
     Language::TYPE_CONTENT => array(
       'name' => t('Content'),
       'description' => t('Order of language detection methods for content. If a version of content is available in the detected language, it will be displayed.'),
       'fixed' => array(LANGUAGE_NEGOTIATION_INTERFACE),
-      'locked' => TRUE,
     ),
     Language::TYPE_URL => array(
       'fixed' => array(LANGUAGE_NEGOTIATION_URL, LANGUAGE_NEGOTIATION_URL_FALLBACK),
-      'locked' => TRUE,
     ),
   );
 }
@@ -740,9 +717,8 @@ function language_negotiation_include() {
  * Implements hook_modules_enabled().
  */
 function language_modules_enabled($modules) {
-  include_once DRUPAL_ROOT . '/core/includes/language.inc';
-  // Load configurability options from configuration.
-  language_types_set(array());
+  language_negotiation_include();
+  language_types_set();
   language_negotiation_purge();
 }
 
diff --git a/core/modules/language/language.negotiation.inc b/core/modules/language/language.negotiation.inc
index 9e145bb..c4e97b3 100644
--- a/core/modules/language/language.negotiation.inc
+++ b/core/modules/language/language.negotiation.inc
@@ -20,6 +20,11 @@
 const LANGUAGE_NEGOTIATION_BROWSER = 'language-browser';
 
 /**
+ * The language is determined using the current interface language.
+ */
+const LANGUAGE_NEGOTIATION_INTERFACE = 'language-interface';
+
+/**
  * If no URL language, language is determined using an already detected one.
  */
 const LANGUAGE_NEGOTIATION_URL_FALLBACK = 'language-url-fallback';
@@ -191,12 +196,8 @@ function language_from_user($languages) {
   // User preference (only for authenticated users).
   global $user;
 
-  if ($user->id()) {
-    $langcode = $user->getPreferredLangcode();
-    $default_langcode = language_default()->id;
-    if (!empty($langcode) && $langcode != $default_langcode && isset($languages[$langcode])) {
-      return $langcode;
-    }
+  if ($user->uid && !empty($user->preferred_langcode) && isset($languages[$user->preferred_langcode])) {
+    return $user->preferred_langcode;
   }
 
   // No language preference from the user.
@@ -220,13 +221,9 @@ function language_from_user_admin(array $languages, Request $request = NULL) {
   // User preference (only for authenticated users).
   global $user;
 
-  if ($user->id()) {
-    $request_path = $request ? urldecode(trim($request->getPathInfo(), '/')) : _current_path();
-    $langcode = $user->getPreferredAdminLangcode();
-    $default_langcode = language_default()->id;
-    if (!empty($langcode) && $langcode != $default_langcode && isset($languages[$langcode]) && path_is_admin($request_path)) {
-      return $langcode;
-    }
+  $request_path = $request ? urldecode(trim($request->getPathInfo(), '/')) : _current_path();
+  if ($user->uid && !empty($user->preferred_admin_langcode) && isset($languages[$user->preferred_admin_langcode]) && path_is_admin($request_path)) {
+    return $user->preferred_admin_langcode;
   }
 
   // No language preference from the user or not on an admin path.
@@ -249,7 +246,7 @@ function language_from_session($languages) {
   // an authenticated user.
   if (isset($_GET[$param]) && isset($languages[$langcode = $_GET[$param]])) {
     global $user;
-    if ($user->id()) {
+    if ($user->uid) {
       $_SESSION[$param] = $langcode;
     }
     return $langcode;
@@ -487,7 +484,7 @@ function language_url_rewrite_session(&$path, &$options) {
   // request processing.
   if (!isset($query_rewrite)) {
     global $user;
-    if (!$user->id()) {
+    if (!$user->uid) {
       $languages = language_list();
       $query_param = check_plain(config('language.negotiation')->get('session.parameter'));
       $query_value = isset($_GET[$query_param]) ? check_plain($_GET[$query_param]) : NULL;
diff --git a/core/modules/language/language.routing.yml b/core/modules/language/language.routing.yml
index e75e1ce..4a2fc8c 100644
--- a/core/modules/language/language.routing.yml
+++ b/core/modules/language/language.routing.yml
@@ -18,10 +18,3 @@ language_negotiation_selected:
     _form: 'Drupal\language\Form\NegotiationSelectedForm'
   requirements:
     _permission: 'administer languages'
-
-language_admin_overview:
-  pattern: '/admin/config/regional/language'
-  defaults:
-    _entity_list: 'language_entity'
-  requirements:
-    _permission: 'administer languages'
diff --git a/core/modules/language/lib/Drupal/language/LanguageAccessController.php b/core/modules/language/lib/Drupal/language/LanguageAccessController.php
deleted file mode 100644
index e201dec..0000000
--- a/core/modules/language/lib/Drupal/language/LanguageAccessController.php
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\language\LanguageAccessController.
- */
-
-namespace Drupal\language;
-
-use Drupal\Core\Entity\EntityAccessController;
-use Drupal\Core\Entity\EntityInterface;
-use Drupal\Core\Language\Language;
-use Drupal\Core\Session\AccountInterface;
-
-class LanguageAccessController extends EntityAccessController {
-
-  /**
-   * {@inheritdoc}
-   */
-  public function access(EntityInterface $entity, $operation, $langcode = Language::LANGCODE_DEFAULT, AccountInterface $account = NULL) {
-    switch ($operation) {
-      case 'create':
-      case 'update':
-      case 'delete':
-        return !$entity->locked && user_access('administer languages');
-        break;
-    }
-    return FALSE;
-  }
-
-}
diff --git a/core/modules/language/lib/Drupal/language/LanguageListController.php b/core/modules/language/lib/Drupal/language/LanguageListController.php
deleted file mode 100644
index d729b78..0000000
--- a/core/modules/language/lib/Drupal/language/LanguageListController.php
+++ /dev/null
@@ -1,164 +0,0 @@
-<?php
-/**
- * @file
- * Contains \Drupal\language\Form\LanguageListController.
- */
-
-namespace Drupal\language;
-
-use Drupal\Core\Config\Entity\ConfigEntityListController;
-use Drupal\Core\Entity\EntityInterface;
-use Drupal\Core\Form\FormInterface;
-
-/**
- * User interface for the language overview screen.
- */
-class LanguageListController extends ConfigEntityListController implements FormInterface {
-
-  /**
-   * {@inheritdoc}
-   */
-  public function load() {
-    $entities = $this->storage->loadByProperties(array('locked' => '0'));
-    uasort($entities, array($this->entityInfo['class'], 'sort'));
-    return $entities;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getFormID() {
-    return 'language_admin_overview_form';
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getOperations(EntityInterface $entity) {
-    $operations = parent::getOperations($entity);
-    $default = language_default();
-
-    // Edit and delete path for Languages entities have a different pattern
-    // than other config entities.
-    $path = 'admin/config/regional/language';
-    if (isset($operations['edit'])) {
-      $operations['edit']['href'] = $path . '/edit/' . $entity->id();
-    }
-    if (isset($operations['delete'])) {
-      $operations['delete']['href'] = $path . '/delete/' . $entity->id();
-    }
-
-    // Deleting the site default language is not allowed.
-    if ($entity->id() == $default->id) {
-      unset($operations['delete']);
-    }
-
-    return $operations;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function buildHeader() {
-    $row = parent::buildHeader();
-    unset($row['id']);
-    $row['label'] = t('Name');
-    $row['weight'] = t('Weight');
-    return $row;
-  }
-
-
-  /**
-   * {@inheritdoc}
-   */
-  public function buildRow(EntityInterface $entity) {
-    $row = parent::buildRow($entity);
-
-    $row['#attributes']['class'][] = 'draggable';
-    unset($row['id']);
-
-    $row['label'] = array(
-      '#markup' => check_plain($entity->get('label')),
-    );
-
-    $row['#weight'] = $entity->get('weight');
-    // Add weight column.
-    $row['weight'] = array(
-      '#type' => 'weight',
-      '#title' => t('Weight for @title', array('@title' => $entity->label())),
-      '#title_display' => 'invisible',
-      '#default_value' => $entity->get('weight'),
-      '#attributes' => array('class' => array('weight')),
-      '#delta' => 30,
-    );
-
-    return $row;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function buildForm(array $form, array &$form_state) {
-    $languages = $this->load();
-
-    $form['languages'] = array(
-      '#languages' => $languages,
-      '#type' => 'table',
-      '#header' => $this->buildHeader(),
-      '#empty' => t('There are no languages', array('@label' => $this->entityInfo['label'])),
-      '#tabledrag' => array(
-        array('order', 'sibling', 'weight'),
-      ),
-    );
-
-    foreach ($languages as $entity) {
-      $form['languages'][$entity->id()] = $this->buildRow($entity);
-    }
-
-    $form['actions']['#type'] = 'actions';
-    $form['actions']['submit'] = array(
-      '#type' => 'submit',
-      '#value' => t('Save configuration'),
-    );
-
-    return $form;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function validateForm(array &$form, array &$form_state) {
-    // No validation.
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function submitForm(array &$form, array &$form_state) {
-    $languages = $form_state['values']['languages'];
-
-    $language_entities = $this->load();
-    foreach ($languages as $langcode => $language) {
-      if (isset($language_entities[$langcode]) && $language['weight'] != $language_entities[$langcode]->get('weight')) {
-        // Update changed weight.
-        $language_entities[$langcode]->set('weight', $language['weight']);
-        $language_entities[$langcode]->save();
-      }
-    }
-
-    // Kill the static cache in language_list().
-    drupal_static_reset('language_list');
-
-    // Update weight of locked system languages.
-    language_update_locked_weights();
-
-    drupal_set_message(t('Configuration saved.'));
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function render() {
-    return drupal_get_form($this);
-  }
-}
diff --git a/core/modules/language/lib/Drupal/language/Plugin/Core/Entity/Language.php b/core/modules/language/lib/Drupal/language/Plugin/Core/Entity/Language.php
index 4f71f3e..4172e96 100644
--- a/core/modules/language/lib/Drupal/language/Plugin/Core/Entity/Language.php
+++ b/core/modules/language/lib/Drupal/language/Plugin/Core/Entity/Language.php
@@ -10,8 +10,6 @@
 use Drupal\Core\Entity\Annotation\EntityType;
 use Drupal\Core\Annotation\Translation;
 use Drupal\Core\Config\Entity\ConfigEntityBase;
-use Drupal\Core\Entity\EntityStorageControllerInterface;
-use Drupal\Core\Language\LanguageManager;
 use Drupal\language\LanguageInterface;
 
 /**
@@ -22,9 +20,7 @@
  *   label = @Translation("Language"),
  *   module = "language",
  *   controllers = {
- *     "storage" = "Drupal\Core\Config\Entity\ConfigStorageController",
- *     "list" = "Drupal\language\LanguageListController",
- *     "access" = "Drupal\language\LanguageAccessController"
+ *     "storage" = "Drupal\Core\Config\Entity\ConfigStorageController"
  *   },
  *   config_prefix = "language.entity",
  *   entity_keys = {
@@ -80,15 +76,4 @@ class Language extends ConfigEntityBase implements LanguageInterface {
    */
   public $locked = FALSE;
 
-  /**
-   * {@inheritdoc}
-   */
-  public function preSave(EntityStorageControllerInterface $storage_controller) {
-    parent::preSave($storage_controller);
-    // Languages are picked from a predefined list which is given in English.
-    // For the uncommon case of custom languages the label should be given in
-    // English.
-    $this->langcode = 'en';
-  }
-
 }
diff --git a/core/modules/language/lib/Drupal/language/Plugin/Derivative/LanguageBlock.php b/core/modules/language/lib/Drupal/language/Plugin/Derivative/LanguageBlock.php
index a329c3b..ee52336 100644
--- a/core/modules/language/lib/Drupal/language/Plugin/Derivative/LanguageBlock.php
+++ b/core/modules/language/lib/Drupal/language/Plugin/Derivative/LanguageBlock.php
@@ -19,17 +19,11 @@ class LanguageBlock extends DerivativeBase {
   public function getDerivativeDefinitions(array $base_plugin_definition) {
     include_once DRUPAL_ROOT . '/core/includes/language.inc';
     $info = language_types_info();
-    $configurable_types = language_types_get_configurable();
-    foreach ($configurable_types as $type) {
+    foreach (language_types_get_configurable(FALSE) as $type) {
       $this->derivatives[$type] = $base_plugin_definition;
       $this->derivatives[$type]['admin_label'] = t('Language switcher (!type)', array('!type' => $info[$type]['name']));
       $this->derivatives[$type]['cache'] = DRUPAL_NO_CACHE;
     }
-    // If there is just one configurable type then change the title of the
-    // block.
-    if (count($configurable_types) == 1) {
-      $this->derivatives[reset($configurable_types)]['admin_label'] = t('Language switcher');
-    }
     return parent::getDerivativeDefinitions($base_plugin_definition);
   }
 }
diff --git a/core/modules/language/lib/Drupal/language/Plugin/views/field/LanguageField.php b/core/modules/language/lib/Drupal/language/Plugin/views/field/LanguageField.php
index d1e9cc0..62bcaef 100644
--- a/core/modules/language/lib/Drupal/language/Plugin/views/field/LanguageField.php
+++ b/core/modules/language/lib/Drupal/language/Plugin/views/field/LanguageField.php
@@ -36,7 +36,7 @@ public function buildOptionsForm(&$form, &$form_state) {
     );
   }
 
-  public function render($values) {
+  function render($values) {
     // @todo: Drupal Core dropped native language until config translation is
     // ready, see http://drupal.org/node/1616594.
     $value = $this->getValue($values);
diff --git a/core/modules/language/lib/Drupal/language/Tests/LanguageConfigurationTest.php b/core/modules/language/lib/Drupal/language/Tests/LanguageConfigurationTest.php
index f970bdd..4bce384 100644
--- a/core/modules/language/lib/Drupal/language/Tests/LanguageConfigurationTest.php
+++ b/core/modules/language/lib/Drupal/language/Tests/LanguageConfigurationTest.php
@@ -51,9 +51,6 @@ function testLanguageConfiguration() {
     $this->drupalPost('admin/config/regional/language/add', $edit, 'Add language');
     $this->assertText('French');
     $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), 'Correct page redirection.');
-    // Langcode for Languages is always 'en'.
-    $language = $this->container->get('config.factory')->get('language.entity.fr')->get();
-    $this->assertEqual($language['langcode'], 'en');
 
     // Check if the Default English language has no path prefix.
     $this->drupalGet('admin/config/regional/language/detection/url');
@@ -103,16 +100,6 @@ function testLanguageConfiguration() {
     );
     $this->drupalPost(NULL, $edit, t('Save configuration'));
     $this->assertText(t('The prefix may not contain a slash.'), 'English prefix cannot be changed to contain a slash.');
-
-    // Remove English language and add a new Language to check if langcode of
-    // Language entity is 'en'.
-    $this->assert(language_delete('en'), 'Deleted English language.');
-    $edit = array(
-      'predefined_langcode' => 'de',
-    );
-    $this->drupalPost('admin/config/regional/language/add', $edit, 'Add language');
-    $language = $this->container->get('config.factory')->get('language.entity.de')->get();
-    $this->assertEqual($language['langcode'], 'en');
   }
 
   /**
diff --git a/core/modules/language/lib/Drupal/language/Tests/LanguageCustomLanguageConfigurationTest.php b/core/modules/language/lib/Drupal/language/Tests/LanguageCustomLanguageConfigurationTest.php
index ff8086b..f5875af 100644
--- a/core/modules/language/lib/Drupal/language/Tests/LanguageCustomLanguageConfigurationTest.php
+++ b/core/modules/language/lib/Drupal/language/Tests/LanguageCustomLanguageConfigurationTest.php
@@ -2,7 +2,7 @@
 
 /**
  * @file
- * Contains \Drupal\language\Tests\LanguageCustomConfigurationTest.
+ * Definition of Drupal\language\Tests\LanguageCustomConfigurationTest.
  */
 
 namespace Drupal\language\Tests;
@@ -47,7 +47,7 @@ public function testLanguageConfiguration() {
     $this->drupalPost('admin/config/regional/language/add', $edit, t('Add custom language'));
     // Test validation on missing values.
     $this->assertText(t('!name field is required.', array('!name' => t('Language code'))));
-    $this->assertText(t('!name field is required.', array('!name' => t('Language name in English'))));
+    $this->assertText(t('!name field is required.', array('!name' => t('Language name'))));
     $empty_language = new Language();
     $this->assertFieldChecked('edit-direction-' . $empty_language->direction, 'Consistent usage of language direction.');
     $this->assertEqual($this->getUrl(), url('admin/config/regional/language/add', array('absolute' => TRUE)), 'Correct page redirection.');
@@ -61,7 +61,7 @@ public function testLanguageConfiguration() {
     );
     $this->drupalPost('admin/config/regional/language/add', $edit, t('Add custom language'));
     $this->assertRaw(t('%field may only contain characters a-z, underscores, or hyphens.', array('%field' => t('Language code'))));
-    $this->assertRaw(t('%field cannot contain any markup.', array('%field' => t('Language name in English'))));
+    $this->assertRaw(t('%field cannot contain any markup.', array('%field' => t('Language name'))));
     $this->assertEqual($this->getUrl(), url('admin/config/regional/language/add', array('absolute' => TRUE)), 'Correct page redirection.');
 
     // Test validation of existing language values.
diff --git a/core/modules/language/lib/Drupal/language/Tests/LanguageListTest.php b/core/modules/language/lib/Drupal/language/Tests/LanguageListTest.php
index 1483aa4..fa718da 100644
--- a/core/modules/language/lib/Drupal/language/Tests/LanguageListTest.php
+++ b/core/modules/language/lib/Drupal/language/Tests/LanguageListTest.php
@@ -79,8 +79,8 @@ function testLanguageList() {
     $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), 'Correct page redirection.');
     $this->assertText(t('The default language cannot be deleted.'), 'Failed to delete the default language.');
 
-    // Ensure 'Edit' link works.
-    $this->clickLink(t('Edit'));
+    // Ensure 'edit' link works.
+    $this->clickLink(t('edit'));
     $this->assertTitle(t('Edit language | Drupal'), 'Page title is "Edit language".');
     // Edit a language.
     $name = $this->randomName(16);
@@ -98,8 +98,8 @@ function testLanguageList() {
     $this->drupalPost($path, $edit, t('Save configuration'));
     // Ensure 'delete' link works.
     $this->drupalGet('admin/config/regional/language');
-    $this->clickLink(t('Delete'));
-    $this->assertText(t('Are you sure you want to delete the language'), '"Delete" link is correct.');
+    $this->clickLink(t('delete'));
+    $this->assertText(t('Are you sure you want to delete the language'), '"delete" link is correct.');
     // Delete a language.
     $this->drupalGet('admin/config/regional/language/delete/' . $langcode);
     // First test the 'cancel' link.
diff --git a/core/modules/language/lib/Drupal/language/Tests/LanguageNegotiationInfoTest.php b/core/modules/language/lib/Drupal/language/Tests/LanguageNegotiationInfoTest.php
index 6ab71ba..e580e5c 100644
--- a/core/modules/language/lib/Drupal/language/Tests/LanguageNegotiationInfoTest.php
+++ b/core/modules/language/lib/Drupal/language/Tests/LanguageNegotiationInfoTest.php
@@ -56,8 +56,8 @@ function testInfoAlterations() {
     \Drupal::state()->set('language_test.content_language_type', TRUE);
     $this->languageNegotiationUpdate();
     $type = Language::TYPE_CONTENT;
-    $language_types = language_types_get_configurable();
-    $this->assertTrue(in_array($type, $language_types), 'Content language type is configurable.');
+    $language_types = variable_get('language_types', language_types_get_default());
+    $this->assertTrue($language_types[$type], 'Content language type is configurable.');
 
     // Enable some core and custom language negotiation methods. The test
     // language type is supposed to be configurable.
@@ -69,7 +69,6 @@ function testInfoAlterations() {
       $form_field => TRUE,
       $type . '[enabled][' . $test_method_id . ']' => TRUE,
       $test_type . '[enabled][' . $test_method_id . ']' => TRUE,
-      $test_type . '[configurable]' => TRUE,
     );
     $this->drupalPost('admin/config/regional/language/detection', $edit, t('Save settings'));
 
@@ -99,7 +98,7 @@ function testInfoAlterations() {
     foreach (language_types_get_all() as $type) {
       $langcode = $last[$type];
       $value = $type == Language::TYPE_CONTENT || strpos($type, 'test') !== FALSE ? 'it' : 'en';
-      $this->assertEqual($langcode, $value, format_string('The negotiated language for %type is %language', array('%type' => $type, '%language' => $value)));
+      $this->assertEqual($langcode, $value, format_string('The negotiated language for %type is %language', array('%type' => $type, '%language' => $langcode)));
     }
 
     // Disable language_test and check that everything is set back to the
@@ -159,9 +158,8 @@ protected function languageNegotiationUpdate($op = 'enable') {
    */
   protected function checkFixedLanguageTypes() {
     drupal_static_reset('language_types_info');
-    $configurable = language_types_get_configurable();
     foreach (language_types_info() as $type => $info) {
-      if (!in_array($type, $configurable) && isset($info['fixed'])) {
+      if (isset($info['fixed'])) {
         $negotiation = variable_get("language_negotiation_$type", array());
         $equal = count($info['fixed']) == count($negotiation);
         while ($equal && list($id) = each($negotiation)) {
diff --git a/core/modules/language/tests/language_test/language_test.module b/core/modules/language/tests/language_test/language_test.module
index 267cdf3..3cb6f6b 100644
--- a/core/modules/language/tests/language_test/language_test.module
+++ b/core/modules/language/tests/language_test/language_test.module
@@ -32,7 +32,6 @@ function language_test_language_types_info() {
       ),
       'fixed_test_language_type' => array(
         'fixed' => array('test_language_negotiation_method'),
-        'locked' => TRUE,
       ),
     );
   }
@@ -43,15 +42,7 @@ function language_test_language_types_info() {
  */
 function language_test_language_types_info_alter(array &$language_types) {
   if (Drupal::state()->get('language_test.content_language_type')) {
-    $language_types[Language::TYPE_CONTENT]['locked'] = FALSE;
     unset($language_types[Language::TYPE_CONTENT]['fixed']);
-    // By default languages are not configurable. Make Language::TYPE_CONTENT
-    // configurable.
-    $configurable = config('system.language.types')->get('configurable');
-    if (!in_array(Language::TYPE_CONTENT, $configurable)) {
-      $configurable[] = Language::TYPE_CONTENT;
-      config('system.language.types')->set('configurable', $configurable)->save();
-    }
   }
 }
 
@@ -96,7 +87,6 @@ function language_test_language_negotiation_info_alter(array &$negotiation_info)
  */
 function language_test_store_language_negotiation() {
   $last = array();
-  print_r(language_types_get_all());
   foreach (language_types_get_all() as $type) {
     $last[$type] = language($type)->id;
   }
diff --git a/core/modules/layout/layout.admin.inc b/core/modules/layout/layout.admin.inc
index 63fe122..53ac47b 100644
--- a/core/modules/layout/layout.admin.inc
+++ b/core/modules/layout/layout.admin.inc
@@ -17,11 +17,11 @@
  * @see layout_menu()
  */
 function layout_page_view($key) {
-  $layout = Drupal::service('plugin.manager.layout')->getDefinition($key);
+  $layout = layout_manager()->getDefinition($key);
   drupal_set_title(t('View template %name', array('%name' => $layout['title'])), PASS_THROUGH);
 
   // Render the layout in an admin context with region demonstrations.
-  $instance = Drupal::service('plugin.manager.layout')->createInstance($key, array());
+  $instance = layout_manager()->createInstance($key, array());
   $regions = $instance->getRegions();
   foreach ($regions as $region => $info) {
     $regions[$region] = '<div class="layout-region-demonstration">' . check_plain($info['label']) . '</div>';
diff --git a/core/modules/layout/layout.module b/core/modules/layout/layout.module
index 8c0f29d..17acc6d 100644
--- a/core/modules/layout/layout.module
+++ b/core/modules/layout/layout.module
@@ -36,7 +36,7 @@ function layout_menu() {
  *   otherwise.
  */
 function layout_user_access($key) {
-  return (user_access('administer layouts') && Drupal::service('plugin.manager.layout')->getDefinition($key));
+  return (user_access('administer layouts') && layout_manager()->getDefinition($key));
 }
 
 /**
@@ -52,13 +52,23 @@ function layout_permission() {
 }
 
 /**
+ * Get the layout plugin manager instance.
+ *
+ * @return Drupal\layout\Plugin\Type\LayoutManager
+ *   The layout plugin manager instance.
+ */
+function layout_manager() {
+  return drupal_container()->get('plugin.manager.layout');
+}
+
+/**
  * Implements hook_theme().
  *
  * Expose all layouts as theme items, so themes can override layout markup.
  */
 function layout_theme($existing, $type, $theme, $path) {
   $items = array();
-  foreach (Drupal::service('plugin.manager.layout')->getDefinitions() as $name => $layout) {
+  foreach (layout_manager()->getDefinitions() as $name => $layout) {
     $items[$layout['theme']] = array(
       'variables' => array('content' => NULL),
       'path' => $layout['path'],
diff --git a/core/modules/layout/lib/Drupal/layout/Plugin/Core/Entity/Display.php b/core/modules/layout/lib/Drupal/layout/Plugin/Core/Entity/Display.php
index 5fbdfc8..adaf260 100644
--- a/core/modules/layout/lib/Drupal/layout/Plugin/Core/Entity/Display.php
+++ b/core/modules/layout/lib/Drupal/layout/Plugin/Core/Entity/Display.php
@@ -179,7 +179,7 @@ public function getLayoutInstance() {
         throw new \Exception(sprintf('Display "%id" had no layout plugin attached.', array('%id' => $this->id())), E_RECOVERABLE_ERROR);
       }
 
-      $this->layoutInstance = \Drupal::service('plugin.manager.layout')->createInstance($this->layout, $this->layoutSettings);
+      $this->layoutInstance = layout_manager()->createInstance($this->layout, $this->layoutSettings);
       // @todo add handling for remapping if the layout could not be found
     }
 
diff --git a/core/modules/layout/lib/Drupal/layout/Tests/LayoutDerivativesTest.php b/core/modules/layout/lib/Drupal/layout/Tests/LayoutDerivativesTest.php
index 68ebf9e..f41460c 100644
--- a/core/modules/layout/lib/Drupal/layout/Tests/LayoutDerivativesTest.php
+++ b/core/modules/layout/lib/Drupal/layout/Tests/LayoutDerivativesTest.php
@@ -33,7 +33,7 @@ public static function getInfo() {
    * Tests for module/theme layout derivatives.
    */
   function testDerivatives() {
-    $manager = $this->container->get('plugin.manager.layout');
+    $manager = drupal_container()->get('plugin.manager.layout');
 
     $definitions = $manager->getDefinitions();
     $this->assertTrue(is_array($definitions), 'Definitions found.');
@@ -105,6 +105,6 @@ function testPageLayout() {
     $this->assertRaw('<div class="layout-region layout-col-right">');
 
     // Ensure the CSS was added.
-    $this->assertRaw(url('', array('absolute' => TRUE)) . drupal_get_path('theme', 'layout_test_theme') . '/layouts/static/two-col/two-col.css');
+    $this->assertRaw('@import url("' . url('', array('absolute' => TRUE)) . drupal_get_path('theme', 'layout_test_theme') . '/layouts/static/two-col/two-col.css');
   }
 }
diff --git a/core/modules/locale/css/locale.admin.css b/core/modules/locale/css/locale.admin.css
index bae704d..4bb2bab 100644
--- a/core/modules/locale/css/locale.admin.css
+++ b/core/modules/locale/css/locale.admin.css
@@ -36,7 +36,7 @@
   width: 50%;
   table-layout: fixed;
 }
-.locale-translate-edit-form tr .form-item {
+.locale-translate-edit-form .form-item {
   white-space: normal;
 }
 .locale-translate-edit-form td {
diff --git a/core/modules/locale/lib/Drupal/locale/LocaleConfigSubscriber.php b/core/modules/locale/lib/Drupal/locale/LocaleConfigSubscriber.php
index cb9be73..7b1219b 100644
--- a/core/modules/locale/lib/Drupal/locale/LocaleConfigSubscriber.php
+++ b/core/modules/locale/lib/Drupal/locale/LocaleConfigSubscriber.php
@@ -70,7 +70,7 @@ public function configContext(ConfigEvent $event) {
       $context->set('locale.language', $language);
     }
     elseif ($account = $context->get('user.account')) {
-      $context->set('locale.language', language_load($account->getPreferredLangcode()));
+      $context->set('locale.language', language_load(user_preferred_langcode($account)));
     }
     elseif ($language = $this->languageManager->getLanguage(Language::TYPE_INTERFACE)) {
       $context->set('locale.language', $language);
diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleContentTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleContentTest.php
index b53ba51..c55927f 100644
--- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleContentTest.php
+++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleContentTest.php
@@ -97,7 +97,6 @@ function testContentTypeLanguageConfiguration() {
     $this->drupalPost("admin/structure/types/manage/{$type2->type}", $edit, t('Save content type'));
     $this->assertRaw(t('The content type %type has been updated.', array('%type' => $type2->name)));
     $this->drupalLogout();
-    drupal_static_reset('language_list');
 
     // Verify language selection is not present on the node add form.
     $this->drupalLogin($web_user);
@@ -154,7 +153,6 @@ function testContentTypeDirLang() {
     $edit = array();
     $edit['predefined_langcode'] = 'ar';
     $this->drupalPost('admin/config/regional/language/add', $edit, t('Add language'));
-    drupal_static_reset('language_list');
 
     // Install Spanish language.
     $edit = array();
diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleUninstallTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleUninstallTest.php
index 961a5dd..c53ed7a 100644
--- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleUninstallTest.php
+++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleUninstallTest.php
@@ -96,7 +96,7 @@ function testUninstallProcess() {
 
     // Change language negotiation options.
     drupal_load('module', 'locale');
-    \Drupal::config('system.language.types')->set('configurable', language_types_get_default() + array('language_custom' => TRUE))->save();
+    variable_set('language_types', language_types_get_default() + array('language_custom' => TRUE));
     variable_set('language_negotiation_' . Language::TYPE_INTERFACE, language_language_negotiation_info());
     variable_set('language_negotiation_' . Language::TYPE_CONTENT, language_language_negotiation_info());
     variable_set('language_negotiation_' . Language::TYPE_URL, language_language_negotiation_info());
diff --git a/core/modules/locale/locale.install b/core/modules/locale/locale.install
index b781421..eac6fa4 100644
--- a/core/modules/locale/locale.install
+++ b/core/modules/locale/locale.install
@@ -948,14 +948,22 @@ function locale_update_8015() {
  * Converts localized date formats.
  */
 function locale_update_8016() {
+  $configs = array();
+
   // Fetch all date types from {date_format_type}.
   $result = db_query('SELECT * FROM {date_format_locale}');
   foreach ($result as $format) {
     $language = $format->language;
     // Create config objects for the language if not yet done.
-    config("locale.config.$language.system.date_format." . $format->type)
-      ->set('pattern.php', $format->format)
-      ->save();
+    if (!isset($configs[$language])) {
+      $configs[$language] = config('locale.config.' . $language . '.system.date');
+    }
+    $configs[$language]->set('formats.' . $format->type . '.pattern.php', $format->format);
+  }
+
+  // Save all instantiated config objects.
+  foreach ($configs as $config) {
+    $config->save();
   }
 }
 
diff --git a/core/modules/menu/lib/Drupal/menu/Access/DeleteLinkAccessCheck.php b/core/modules/menu/lib/Drupal/menu/Access/DeleteLinkAccessCheck.php
index 45560dc..f4438e7 100644
--- a/core/modules/menu/lib/Drupal/menu/Access/DeleteLinkAccessCheck.php
+++ b/core/modules/menu/lib/Drupal/menu/Access/DeleteLinkAccessCheck.php
@@ -7,20 +7,20 @@
 
 namespace Drupal\menu\Access;
 
-use Drupal\Core\Access\StaticAccessCheckInterface;
+use Drupal\Core\Access\AccessCheckInterface;
 use Symfony\Component\Routing\Route;
 use Symfony\Component\HttpFoundation\Request;
 
 /**
  * Access check for menu link delete routes.
  */
-class DeleteLinkAccessCheck implements StaticAccessCheckInterface {
+class DeleteLinkAccessCheck implements AccessCheckInterface {
 
   /**
    * {@inheritdoc}
    */
-  public function appliesTo() {
-    return array('_access_menu_delete_link');
+  public function applies(Route $route) {
+    return array_key_exists('_access_menu_delete_link', $route->getRequirements());
   }
 
   /**
diff --git a/core/modules/menu/lib/Drupal/menu/Access/DeleteMenuAccessCheck.php b/core/modules/menu/lib/Drupal/menu/Access/DeleteMenuAccessCheck.php
index e8fb6f2..ef00dd0 100644
--- a/core/modules/menu/lib/Drupal/menu/Access/DeleteMenuAccessCheck.php
+++ b/core/modules/menu/lib/Drupal/menu/Access/DeleteMenuAccessCheck.php
@@ -7,20 +7,20 @@
 
 namespace Drupal\menu\Access;
 
-use Drupal\Core\Access\StaticAccessCheckInterface;
+use Drupal\Core\Access\AccessCheckInterface;
 use Symfony\Component\Routing\Route;
 use Symfony\Component\HttpFoundation\Request;
 
 /**
  * Access check for menu delete routes.
  */
-class DeleteMenuAccessCheck implements StaticAccessCheckInterface {
+class DeleteMenuAccessCheck implements AccessCheckInterface {
 
   /**
    * {@inheritdoc}
    */
-  public function appliesTo() {
-    return array('_access_menu_delete_menu');
+  public function applies(Route $route) {
+    return array_key_exists('_access_menu_delete_menu', $route->getRequirements());
   }
 
   /**
diff --git a/core/modules/menu/lib/Drupal/menu/MenuAccessController.php b/core/modules/menu/lib/Drupal/menu/MenuAccessController.php
index b7128c0..4cb2962 100644
--- a/core/modules/menu/lib/Drupal/menu/MenuAccessController.php
+++ b/core/modules/menu/lib/Drupal/menu/MenuAccessController.php
@@ -31,16 +31,9 @@ protected function checkAccess(EntityInterface $entity, $operation, $langcode, A
       }
     }
 
-    if (in_array($operation, array('update', 'delete'))) {
+    if (in_array($operation, array('create', 'update', 'delete'))) {
       return user_access('administer menu', $account);
     }
   }
 
-  /**
-   * {@inheritdoc}
-   */
-  protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) {
-    return user_access('administer menu', $account);
-  }
-
 }
diff --git a/core/modules/menu/lib/Drupal/menu/Tests/MenuTest.php b/core/modules/menu/lib/Drupal/menu/Tests/MenuTest.php
index 44ea1e0..b914837 100644
--- a/core/modules/menu/lib/Drupal/menu/Tests/MenuTest.php
+++ b/core/modules/menu/lib/Drupal/menu/Tests/MenuTest.php
@@ -419,10 +419,8 @@ public function testBlockContextualLinks() {
   public function testMenuBundles() {
     $this->drupalLogin($this->big_user);
     $menu = $this->addCustomMenu();
-    // Clear the entity info cache to ensure the static caches are rebuilt.
-    entity_info_cache_clear();
     $bundles = entity_get_bundles('menu_link');
-    $this->assertTrue(isset($bundles[$menu->id()]));
+    $this->assertTrue($bundles[$menu->id()]);
     $menus = menu_list_system_menus();
     $menus[$menu->id()] = $menu->label();
     ksort($menus);
@@ -661,24 +659,6 @@ function enableMenuLink($item) {
   }
 
   /**
-   * Test administrative users other than user 1 can access the menu parents AJAX callback.
-   */
-  public function testMenuParentsJsAccess() {
-
-    $admin = $this->drupalCreateUser(array('administer menu'));
-    $this->drupalLogin($admin);
-    // Just check access to the callback overall, the POST data is irrelevant.
-    $this->drupalGetAJAX('admin/structure/menu/parents');
-    $this->assertResponse(200);
-
-    // Do standard user tests.
-    // Login the user.
-    $this->drupalLogin($this->std_user);
-    $this->drupalGetAJAX('admin/structure/menu/parents');
-    $this->assertResponse(403);
-  }
-
-  /**
    * Get standard menu link.
    */
   private function getStandardMenuLink() {
diff --git a/core/modules/menu/menu.module b/core/modules/menu/menu.module
index af081e5..850feed 100644
--- a/core/modules/menu/menu.module
+++ b/core/modules/menu/menu.module
@@ -77,7 +77,7 @@ function menu_menu() {
     'title' => 'Parent menu items',
     'page callback' => 'menu_parent_options_js',
     'type' => MENU_CALLBACK,
-    'access arguments' => array('administer menu'),
+    'access arguments' => array(TRUE),
   );
   $items['admin/structure/menu/list'] = array(
     'title' => 'List menus',
diff --git a/core/modules/menu_link/menu_link.module b/core/modules/menu_link/menu_link.module
index 4ff3121..222aa83 100644
--- a/core/modules/menu_link/menu_link.module
+++ b/core/modules/menu_link/menu_link.module
@@ -7,16 +7,6 @@
 
 use Drupal\menu_link\Plugin\Core\Entity\MenuLink;
 
-function menu_link_help($path, $arg) {
-  switch ($path) {
-    case 'admin/help#menu_link':
-      $output = '';
-      $output .= '<h3>' . t('About') . '</h3>';
-      $output .= '<p>' . t('The Menu Link module allows users to create menu links. It is required by the Menu module, which provides an interface for managing menus. See the <a href="@menu-help">Menu module help page</a> for more information.', array('@menu-help' => url('admin/help/menu'))) . '</p>';
-      return $output;
-  }
-}
-
 /**
  * Entity URI callback.
  *
diff --git a/core/modules/node/config/schema/node.schema.yml b/core/modules/node/config/schema/node.schema.yml
index 2ad1c17..64eecd4 100644
--- a/core/modules/node/config/schema/node.schema.yml
+++ b/core/modules/node/config/schema/node.schema.yml
@@ -7,68 +7,3 @@ node.settings:
     items_per_page:
       type: integer
       label: 'Number of posts on front page'
-
-node.type.*:
-  type: mapping
-  label: 'Content type'
-  mapping:
-    type:
-      type: string
-      label: 'Machine-readable name'
-    uuid:
-      type: string
-      label: 'UUID'
-    name:
-      type: label
-      label: 'Name'
-    description:
-      type: text
-      label: 'Description'
-    help:
-      type: text
-      label: 'Explanation or submission guidelines'
-    has_title:
-      type: boolean
-      label: 'Has title'
-    title_label:
-      type: label
-      label: 'Title field label'
-    settings:
-      type: mapping
-      label: 'Settings'
-      mapping:
-        node:
-          type: node.settings.node
-    status:
-      type: boolean
-      label: 'Enabled status of the configuration entity'
-    langcode:
-      type: string
-      label: 'Language'
-
-node.settings.node:
-  type: mapping
-  label: 'Content type settings'
-  mapping:
-    preview:
-      type: integer
-      label: 'Preview before submitting'
-    options:
-      type: mapping
-      label: 'Publishing options'
-      mapping:
-        status:
-          type: string
-          label: 'Published'
-        promote:
-          type: string
-          label: 'Promoted to front page'
-        sticky:
-          type: string
-          label: 'Sticky at top of lists'
-        revision:
-          type: string
-          label: 'Create new revision'
-    submitted:
-      type: boolean
-      label: 'Display setting for author and date Submitted by post information'
diff --git a/core/modules/node/config/views.view.content.yml b/core/modules/node/config/views.view.content.yml
index dcd8e7f..bebc2d3 100644
--- a/core/modules/node/config/views.view.content.yml
+++ b/core/modules/node/config/views.view.content.yml
@@ -108,7 +108,6 @@ display:
           empty_zero: '0'
           hide_alter_empty: '1'
           plugin_id: node_bulk_form
-          provider: node
         title:
           id: title
           table: node_field_data
@@ -125,7 +124,6 @@ display:
           hide_alter_empty: '1'
           link_to_node: '1'
           plugin_id: node
-          provider: node
         type:
           id: type
           table: node_field_data
@@ -143,7 +141,6 @@ display:
           link_to_node: '0'
           machine_name: '0'
           plugin_id: node_type
-          provider: node
         name:
           id: name
           table: users
@@ -164,7 +161,6 @@ display:
           anonymous_text: ''
           format_username: '1'
           plugin_id: user_name
-          provider: user
         status:
           id: status
           table: node_field_data
@@ -184,7 +180,6 @@ display:
           type_custom_false: ''
           not: '0'
           plugin_id: boolean
-          provider: views
         changed:
           id: changed
           table: node_field_data
@@ -203,7 +198,6 @@ display:
           custom_date_format: ''
           timezone: ''
           plugin_id: date
-          provider: views
         edit_node:
           id: edit_node
           table: node
@@ -212,7 +206,6 @@ display:
           exclude: '1'
           text: Edit
           plugin_id: node_link_edit
-          provider: node
         delete_node:
           id: delete_node
           table: node
@@ -221,7 +214,6 @@ display:
           exclude: '1'
           text: Delete
           plugin_id: node_link_delete
-          provider: node
         translation_link:
           id: translation_link
           table: node
@@ -250,7 +242,6 @@ display:
             translation_link: translation_link
           destination: '1'
           plugin_id: dropbutton
-          provider: views
       filters:
         status_extra:
           id: status_extra
@@ -259,7 +250,6 @@ display:
           operator: '='
           value: ''
           plugin_id: node_status
-          provider: node
         status:
           id: status
           table: node_field_data
@@ -304,7 +294,6 @@ display:
                 operator: '='
                 value: '0'
           plugin_id: boolean
-          provider: views
         type:
           id: type
           table: node_field_data
@@ -326,7 +315,6 @@ display:
               authenticated: authenticated
             reduce: '0'
           plugin_id: bundle
-          provider: views
         langcode:
           id: langcode
           table: node
@@ -344,7 +332,6 @@ display:
               authenticated: authenticated
           optional: '1'
           plugin_id: language
-          provider: language
       sorts: {  }
       title: Content
       empty:
@@ -355,7 +342,6 @@ display:
           empty: '1'
           content: 'No content available.'
           plugin_id: text_custom
-          provider: views
       arguments: {  }
       relationships:
         uid:
@@ -365,7 +351,6 @@ display:
           admin_label: author
           required: '1'
           plugin_id: standard
-          provider: views
       show_admin_links: '0'
     display_plugin: default
     display_title: Master
diff --git a/core/modules/node/config/views.view.frontpage.yml b/core/modules/node/config/views.view.frontpage.yml
index 806893a..9ef450f 100644
--- a/core/modules/node/config/views.view.frontpage.yml
+++ b/core/modules/node/config/views.view.frontpage.yml
@@ -26,7 +26,6 @@ display:
           table: views
           tokenize: '0'
           plugin_id: text
-          provider: views
         node_listing_empty:
           admin_label: ''
           empty: '1'
@@ -37,7 +36,6 @@ display:
           relationship: none
           table: node
           plugin_id: node_listing_empty
-          provider: node
         title:
           id: title
           table: views
@@ -49,7 +47,6 @@ display:
           empty: '1'
           title: 'Welcome to [site:name]'
           plugin_id: title
-          provider: views
       exposed_form:
         type: basic
         options:
@@ -97,7 +94,6 @@ display:
           table: node_field_data
           value: '1'
           plugin_id: boolean
-          provider: views
         status:
           expose:
             operator: '0'
@@ -107,7 +103,6 @@ display:
           table: node_field_data
           value: '1'
           plugin_id: boolean
-          provider: views
       pager:
         type: full
         options:
@@ -157,7 +152,6 @@ display:
           relationship: none
           table: node_field_data
           plugin_id: boolean
-          provider: views
         created:
           field: created
           id: created
@@ -171,7 +165,6 @@ display:
           expose:
             label: ''
           granularity: second
-          provider: views
       style:
         type: default
         options:
diff --git a/core/modules/node/lib/Drupal/node/Access/NodeRevisionAccessCheck.php b/core/modules/node/lib/Drupal/node/Access/NodeRevisionAccessCheck.php
deleted file mode 100644
index aca491d..0000000
--- a/core/modules/node/lib/Drupal/node/Access/NodeRevisionAccessCheck.php
+++ /dev/null
@@ -1,158 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\node\Access\NodeRevisionAccessCheck.
- */
-
-namespace Drupal\node\Access;
-
-use Drupal\Core\Access\AccessCheckInterface;
-use Drupal\Core\Database\Connection;
-use Drupal\Core\Entity\EntityManager;
-use Drupal\Core\Session\AccountInterface;
-use Drupal\node\NodeInterface;
-use Symfony\Component\HttpFoundation\Request;
-use Symfony\Component\Routing\Route;
-
-/**
- * Provides an access checker for node revisions.
- */
-class NodeRevisionAccessCheck implements AccessCheckInterface {
-
-  /**
-   * The node storage.
-   *
-   * @var \Drupal\Core\Entity\EntityStorageControllerInterface
-   */
-  protected $nodeStorage;
-
-  /**
-   * The node access controller.
-   *
-   * @var \Drupal\Core\Entity\EntityAccessControllerInterface
-   */
-  protected $nodeAccess;
-
-  /**
-   * The database connection.
-   *
-   * @var \Drupal\Core\Database\Connection
-   */
-  protected $connection;
-
-  /**
-   * A static cache of access checks.
-   *
-   * @var array
-   */
-  protected $access = array();
-
-  /**
-   * Constructs a new NodeRevisionAccessCheck.
-   *
-   * @param \Drupal\Core\Entity\EntityManager $entity_manager
-   *   The entity manager.
-   * @param \Drupal\Core\Database\Connection $connection
-   *   The database connection.
-   */
-  public function __construct(EntityManager $entity_manager, Connection $connection) {
-    $this->nodeStorage = $entity_manager->getStorageController('node');
-    $this->nodeAccess = $entity_manager->getAccessController('node');
-    $this->connection = $connection;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function applies(Route $route) {
-    return array_key_exists('_access_node_revision', $route->getRequirements());
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function access(Route $route, Request $request) {
-    $revision = $this->nodeStorage->loadRevision($request->attributes->get('node_revision'));
-    return $this->checkAccess($revision, $route->getRequirement('_access_node_revision')) ? static::ALLOW : static::DENY;
-  }
-
-  /**
-   * Checks node revision access.
-   *
-   * @param \Drupal\node\NodeInterface $node
-   *   The node to check.
-   * @param string $op
-   *   (optional) The specific operation being checked. Defaults to 'view.'
-   * @param \Drupal\Core\Session\AccountInterface|null $account
-   *   (optional) A user object representing the user for whom the operation is
-   *   to be performed. Determines access for a user other than the current user.
-   *   Defaults to NULL.
-   * @param string|null $langcode
-   *   (optional) Language code for the variant of the node. Different language
-   *   variants might have different permissions associated. If NULL, the
-   *   original langcode of the node is used. Defaults to NULL.
-   *
-   * @return bool
-   *   TRUE if the operation may be performed, FALSE otherwise.
-   */
-  public function checkAccess(NodeInterface $node, $op = 'view', AccountInterface $account = NULL, $langcode = NULL) {
-    $map = array(
-      'view' => 'view all revisions',
-      'update' => 'revert all revisions',
-      'delete' => 'delete all revisions',
-    );
-    $bundle = $node->bundle();
-    $type_map = array(
-      'view' => "view $bundle revisions",
-      'update' => "revert $bundle revisions",
-      'delete' => "delete $bundle revisions",
-    );
-
-    if (!$node || !isset($map[$op]) || !isset($type_map[$op])) {
-      // If there was no node to check against, or the $op was not one of the
-      // supported ones, we return access denied.
-      return FALSE;
-    }
-
-    if (!isset($account)) {
-      $account = $GLOBALS['user'];
-    }
-
-    // If no language code was provided, default to the node revision's langcode.
-    if (empty($langcode)) {
-      $langcode = $node->language()->id;
-    }
-
-    // Statically cache access by revision ID, language code, user account ID,
-    // and operation.
-    $cid = $node->getRevisionId() . ':' . $langcode . ':' . $account->id() . ':' . $op;
-
-    if (!isset($this->access[$cid])) {
-      // Perform basic permission checks first.
-      if (!user_access($map[$op], $account) && !user_access($type_map[$op], $account) && !user_access('administer nodes', $account)) {
-        return $this->access[$cid] = FALSE;
-      }
-
-      // There should be at least two revisions. If the vid of the given node
-      // and the vid of the default revision differ, then we already have two
-      // different revisions so there is no need for a separate database check.
-      // Also, if you try to revert to or delete the default revision, that's
-      // not good.
-      if ($node->isDefaultRevision() && ($this->connection->query('SELECT COUNT(*) FROM {node_field_revision} WHERE nid = :nid AND default_langcode = 1', array(':nid' => $node->id()))->fetchField() == 1 || $op == 'update' || $op == 'delete')) {
-        $this->access[$cid] = FALSE;
-      }
-      elseif (user_access('administer nodes', $account)) {
-        $this->access[$cid] = TRUE;
-      }
-      else {
-        // First check the access to the default revision and finally, if the
-        // node passed in is not the default revision then access to that, too.
-        $this->access[$cid] = $this->nodeAccess->access($this->nodeStorage->load($node->id()), $op, $langcode, $account) && ($node->isDefaultRevision() || $this->nodeAccess->access($node, $op, $langcode, $account));
-      }
-    }
-
-    return $this->access[$cid];
-  }
-
-}
diff --git a/core/modules/node/lib/Drupal/node/Form/DeleteMultiple.php b/core/modules/node/lib/Drupal/node/Form/DeleteMultiple.php
index 8395fcb..7a43181 100644
--- a/core/modules/node/lib/Drupal/node/Form/DeleteMultiple.php
+++ b/core/modules/node/lib/Drupal/node/Form/DeleteMultiple.php
@@ -96,7 +96,7 @@ public function getConfirmText() {
    * {@inheritdoc}
    */
   public function buildForm(array $form, array &$form_state) {
-    $this->nodes = $this->tempStoreFactory->get('node_multiple_delete_confirm')->get($GLOBALS['user']->id());
+    $this->nodes = $this->tempStoreFactory->get('node_multiple_delete_confirm')->get($GLOBALS['user']->uid);
     if (empty($this->nodes)) {
       return new RedirectResponse(url($this->getCancelPath(), array('absolute' => TRUE)));
     }
@@ -116,7 +116,7 @@ public function buildForm(array $form, array &$form_state) {
   public function submitForm(array &$form, array &$form_state) {
     if ($form_state['values']['confirm'] && !empty($this->nodes)) {
       $this->storageController->delete($this->nodes);
-      $this->tempStoreFactory->get('node_multiple_delete_confirm')->delete($GLOBALS['user']->id());
+      $this->tempStoreFactory->get('node_multiple_delete_confirm')->delete($GLOBALS['user']->uid);
       $count = count($this->nodes);
       watchdog('content', 'Deleted @count posts.', array('@count' => $count));
       drupal_set_message(format_plural($count, 'Deleted 1 post.', 'Deleted @count posts.'));
diff --git a/core/modules/node/lib/Drupal/node/Form/NodeDeleteForm.php b/core/modules/node/lib/Drupal/node/Form/NodeDeleteForm.php
deleted file mode 100644
index 5a3fdb0..0000000
--- a/core/modules/node/lib/Drupal/node/Form/NodeDeleteForm.php
+++ /dev/null
@@ -1,106 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\node\Form\NodeDeleteForm.
- */
-
-namespace Drupal\node\Form;
-
-use Drupal\Core\Entity\EntityControllerInterface;
-use Drupal\Core\Entity\EntityNGConfirmFormBase;
-use Drupal\Core\Entity\EntityStorageControllerInterface;
-use Drupal\Core\Extension\ModuleHandlerInterface;
-use Drupal\Core\Routing\PathBasedGeneratorInterface;
-use Symfony\Component\DependencyInjection\ContainerInterface;
-use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
-
-/**
- * Provides a form for deleting a node.
- */
-class NodeDeleteForm extends EntityNGConfirmFormBase implements EntityControllerInterface {
-
-  /**
-   * The URL generator.
-   *
-   * @var \Drupal\Core\Routing\PathBasedGeneratorInterface
-   */
-  protected $urlGenerator;
-
-  /**
-   * The node type storage.
-   *
-   * @var \Drupal\Core\Entity\EntityStorageControllerInterface
-   */
-  protected $nodeTypeStorage;
-
-  /**
-   * Constructs a NodeDeleteForm object.
-   *
-   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
-   *   The module handler service.
-   * @param \Drupal\Core\Routing\PathBasedGeneratorInterface $url_generator
-   *   The URL generator.
-   * @param \Drupal\Core\Entity\EntityStorageControllerInterface $node_type_storage
-   *   The node type storage.
-   */
-  public function __construct(ModuleHandlerInterface $module_handler, PathBasedGeneratorInterface $url_generator, EntityStorageControllerInterface $node_type_storage) {
-    parent::__construct($module_handler);
-
-    $this->urlGenerator = $url_generator;
-    $this->nodeTypeStorage = $node_type_storage;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function createInstance(ContainerInterface $container, $entity_type, array $entity_info) {
-    return new static(
-      $container->get('module_handler'),
-      $container->get('url_generator'),
-      $container->get('plugin.manager.entity')->getStorageController('node_type')
-    );
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getQuestion() {
-    return t('Are you sure you want to delete %title?', array('%title' => $this->entity->label()));
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getCancelPath() {
-    $uri = $this->entity->uri();
-    return $this->urlGenerator->generateFromPath($uri['path'], $uri['options']);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getConfirmText() {
-    return t('Delete');
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function form(array $form, array &$form_state) {
-    // Do not attach fields to the delete form.
-    return $form;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function submit(array $form, array &$form_state) {
-    $this->entity->delete();
-    watchdog('content', '@type: deleted %title.', array('@type' => $this->entity->bundle(), '%title' => $this->entity->label()));
-    $node_type = $this->nodeTypeStorage->load($this->entity->bundle())->label();
-    drupal_set_message(t('@type %title has been deleted.', array('@type' => $node_type, '%title' => $this->entity->label())));
-    $form_state['redirect'] = '<front>';
-  }
-
-}
diff --git a/core/modules/node/lib/Drupal/node/Form/NodeRevisionDeleteForm.php b/core/modules/node/lib/Drupal/node/Form/NodeRevisionDeleteForm.php
deleted file mode 100644
index 8c06d49..0000000
--- a/core/modules/node/lib/Drupal/node/Form/NodeRevisionDeleteForm.php
+++ /dev/null
@@ -1,130 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\node\Form\NodeRevisionDeleteForm.
- */
-
-namespace Drupal\node\Form;
-
-use Drupal\Core\Controller\ControllerInterface;
-use Drupal\Core\Database\Connection;
-use Drupal\Core\Entity\EntityStorageControllerInterface;
-use Drupal\Core\Form\ConfirmFormBase;
-use Drupal\node\NodeInterface;
-use Symfony\Component\DependencyInjection\ContainerInterface;
-use Symfony\Component\HttpFoundation\Request;
-
-/**
- * Provides a form for reverting a node revision.
- */
-class NodeRevisionDeleteForm extends ConfirmFormBase implements ControllerInterface {
-
-  /**
-   * The node revision.
-   *
-   * @var \Drupal\node\NodeInterface
-   */
-  protected $revision;
-
-  /**
-   * The node storage.
-   *
-   * @var \Drupal\Core\Entity\EntityStorageControllerInterface
-   */
-  protected $nodeStorage;
-
-  /**
-   * The node type storage.
-   *
-   * @var \Drupal\Core\Entity\EntityStorageControllerInterface
-   */
-  protected $nodeTypeStorage;
-
-  /**
-   * The database connection.
-   *
-   * @var \Drupal\Core\Database\Connection
-   */
-  protected $connection;
-
-  /**
-   * Constructs a new NodeRevisionDeleteForm.
-   *
-   * @param \Drupal\Core\Entity\EntityStorageControllerInterface $node_storage
-   *   The node storage.
-   * @param \Drupal\Core\Entity\EntityStorageControllerInterface $node_type_storage
-   *   The node type storage.
-   * @param \Drupal\Core\Database\Connection $connection
-   *   The database connection.
-   */
-  public function __construct(EntityStorageControllerInterface $node_storage, EntityStorageControllerInterface $node_type_storage, Connection $connection) {
-    $this->nodeStorage = $node_storage;
-    $this->nodeTypeStorage = $node_type_storage;
-    $this->connection = $connection;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function create(ContainerInterface $container) {
-    $entity_manager = $container->get('plugin.manager.entity');
-    return new static(
-      $entity_manager->getStorageController('node'),
-      $entity_manager->getStorageController('node_type'),
-      $container->get('database')
-    );
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getFormID() {
-    return 'node_revision_delete_confirm';
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getQuestion() {
-    return t('Are you sure you want to delete the revision from %revision-date?', array('%revision-date' => format_date($this->revision->getRevisionCreationTime())));
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getCancelPath() {
-    return 'node/' . $this->revision->id() . '/revisions';
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getConfirmText() {
-    return t('Delete');
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function buildForm(array $form, array &$form_state, Request $request = NULL, $node_revision = NULL) {
-    $this->revision = $this->nodeStorage->loadRevision($node_revision);
-    return parent::buildForm($form, $form_state, $request);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function submitForm(array &$form, array &$form_state) {
-    $this->nodeStorage->deleteRevision($this->revision->getRevisionId());
-
-    watchdog('content', '@type: deleted %title revision %revision.', array('@type' => $this->revision->bundle(), '%title' => $this->revision->label(), '%revision' => $this->revision->getRevisionId()));
-    $node_type = $this->nodeTypeStorage->load($this->revision->bundle())->label();
-    drupal_set_message(t('Revision from %revision-date of @type %title has been deleted.', array('%revision-date' => format_date($this->revision->getRevisionCreationTime()), '@type' => $node_type, '%title' => $this->revision->label())));
-    $form_state['redirect'] = 'node/' . $this->revision->id();
-    if ($this->connection->query('SELECT COUNT(DISTINCT vid) FROM {node_field_revision} WHERE nid = :nid', array(':nid' => $this->revision->id()))->fetchField() > 1) {
-      $form_state['redirect'] .= '/revisions';
-    }
-  }
-
-}
diff --git a/core/modules/node/lib/Drupal/node/Form/NodeRevisionRevertForm.php b/core/modules/node/lib/Drupal/node/Form/NodeRevisionRevertForm.php
deleted file mode 100644
index d4c69ec..0000000
--- a/core/modules/node/lib/Drupal/node/Form/NodeRevisionRevertForm.php
+++ /dev/null
@@ -1,119 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\node\Form\NodeRevisionDeleteForm.
- */
-
-namespace Drupal\node\Form;
-
-use Drupal\Core\Controller\ControllerInterface;
-use Drupal\Core\Entity\EntityStorageControllerInterface;
-use Drupal\Core\Form\ConfirmFormBase;
-use Drupal\node\NodeInterface;
-use Symfony\Component\DependencyInjection\ContainerInterface;
-use Symfony\Component\HttpFoundation\Request;
-
-/**
- * Provides a form for reverting a node revision.
- */
-class NodeRevisionRevertForm extends ConfirmFormBase implements ControllerInterface {
-
-  /**
-   * The node revision.
-   *
-   * @var \Drupal\node\NodeInterface
-   */
-  protected $revision;
-
-  /**
-   * The node storage.
-   *
-   * @var \Drupal\Core\Entity\EntityStorageControllerInterface
-   */
-  protected $nodeStorage;
-
-  /**
-   * Constructs a new NodeRevisionRevertForm.
-   *
-   * @param \Drupal\Core\Entity\EntityStorageControllerInterface $node_storage
-   *   The node storage.
-   */
-  public function __construct(EntityStorageControllerInterface $node_storage) {
-    $this->nodeStorage = $node_storage;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function create(ContainerInterface $container) {
-    return new static(
-      $container->get('plugin.manager.entity')->getStorageController('node')
-    );
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getFormID() {
-    return 'node_revision_revert_confirm';
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getQuestion() {
-    return t('Are you sure you want to revert to the revision from %revision-date?', array('%revision-date' => format_date($this->revision->getRevisionCreationTime())));
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getCancelPath() {
-    return 'node/' . $this->revision->id() . '/revisions';
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getConfirmText() {
-    return t('Revert');
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getDescription() {
-    return '';
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function buildForm(array $form, array &$form_state, Request $request = NULL, $node_revision = NULL) {
-    $this->revision = $this->nodeStorage->loadRevision($node_revision);
-    return parent::buildForm($form, $form_state, $request);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function submitForm(array &$form, array &$form_state) {
-    $this->revision->setNewRevision();
-    // Make this the new default revision for the node.
-    $this->revision->isDefaultRevision(TRUE);
-
-    // The revision timestamp will be updated when the revision is saved. Keep the
-    // original one for the confirmation message.
-    $original_revision_timestamp = $this->revision->getRevisionCreationTime();
-
-    $this->revision->log = t('Copy of the revision from %date.', array('%date' => format_date($original_revision_timestamp)));
-
-    $this->revision->save();
-
-    watchdog('content', '@type: reverted %title revision %revision.', array('@type' => $this->revision->bundle(), '%title' => $this->revision->label(), '%revision' => $this->revision->getRevisionId()));
-    drupal_set_message(t('@type %title has been reverted back to the revision from %revision-date.', array('@type' => node_get_type_label($this->revision), '%title' => $this->revision->label(), '%revision-date' => format_date($original_revision_timestamp))));
-    $form_state['redirect'] = 'node/' . $this->revision->id() . '/revisions';
-  }
-
-}
diff --git a/core/modules/node/lib/Drupal/node/Form/RebuildPermissionsForm.php b/core/modules/node/lib/Drupal/node/Form/RebuildPermissionsForm.php
deleted file mode 100644
index d104fab..0000000
--- a/core/modules/node/lib/Drupal/node/Form/RebuildPermissionsForm.php
+++ /dev/null
@@ -1,57 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\node\Form\RebuildPermissionsForm.
- */
-
-namespace Drupal\node\Form;
-
-use Drupal\Core\Form\ConfirmFormBase;
-
-class RebuildPermissionsForm extends ConfirmFormBase {
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getFormID() {
-    return 'node_configure_rebuild_confirm';
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getQuestion() {
-    return t('Are you sure you want to rebuild the permissions on site content?');
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getCancelPath() {
-    return 'admin/reports/status';
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getConfirmText() {
-    return t('Rebuild permissions');
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getDescription() {
-    return t('This action rebuilds all permissions on site content, and may be a lengthy process. This action cannot be undone.');
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function submitForm(array &$form, array &$form_state) {
-    node_access_rebuild(TRUE);
-    $form_state['redirect'] = 'admin/reports/status';
-  }
-
-}
diff --git a/core/modules/node/lib/Drupal/node/NodeAccessController.php b/core/modules/node/lib/Drupal/node/NodeAccessController.php
index 2556d76..e36743e 100644
--- a/core/modules/node/lib/Drupal/node/NodeAccessController.php
+++ b/core/modules/node/lib/Drupal/node/NodeAccessController.php
@@ -7,64 +7,16 @@
 
 namespace Drupal\node;
 
-use Drupal\Core\Database\Connection;
-use Drupal\Core\Database\Query\SelectInterface;
-use Drupal\Core\Entity\EntityControllerInterface;
-use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Language\Language;
 use Drupal\Core\Entity\EntityAccessController;
 use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Entity\EntityNG;
 use Drupal\Core\Session\AccountInterface;
-use Drupal\user\Plugin\Core\Entity\User;
-use Symfony\Component\DependencyInjection\ContainerInterface;
 
 /**
  * Defines the access controller for the node entity type.
  */
-class NodeAccessController extends EntityAccessController implements NodeAccessControllerInterface, EntityControllerInterface {
-
-  /**
-   * The node grant storage.
-   *
-   * @var \Drupal\node\NodeGrantStorageControllerInterface
-   */
-  protected $grantStorage;
-
-   /**
-   * The module handler.
-   *
-   * @var \Drupal\Core\Extension\ModuleHandlerInterface
-   */
-  protected $moduleHandler;
-
-  /**
-   * Constructs a NodeAccessController object.
-   *
-   * @param string $entity_type
-   *   The entity type of the access controller instance.
-   * @param \Drupal\node\NodeGrantDatabaseStorageInterface $grant_storage
-   *   The node grant storage.
-   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
-   *   The module handler to invoke the alter hook with.
-   */
-  public function __construct($entity_type, NodeGrantDatabaseStorageInterface $grant_storage, ModuleHandlerInterface $module_handler) {
-    parent::__construct($entity_type);
-    $this->grantStorage = $grant_storage;
-    $this->moduleHandler = $module_handler;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function createInstance(ContainerInterface $container, $entity_type, array $entity_info) {
-    return new static(
-      $entity_type,
-      $container->get('node.grant_storage'),
-      $container->get('module_handler')
-    );
-  }
-
+class NodeAccessController extends EntityAccessController {
 
   /**
    * {@inheritdoc}
@@ -82,22 +34,6 @@ public function access(EntityInterface $entity, $operation, $langcode = Language
   /**
    * {@inheritdoc}
    */
-  public function createAccess($entity_bundle = NULL, AccountInterface $account = NULL, array $context = array()) {
-    $account = $this->prepareUser($account);
-
-    if (user_access('bypass node access', $account)) {
-      return TRUE;
-    }
-    if (!user_access('access content', $account)) {
-      return FALSE;
-    }
-
-    return parent::createAccess($entity_bundle, $account, $context);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
   protected function checkAccess(EntityInterface $node, $operation, $langcode, AccountInterface $account) {
     // Fetch information from the node object if possible.
     $status = isset($node->status) ? $node->status : NULL;
@@ -118,7 +54,7 @@ protected function checkAccess(EntityInterface $node, $operation, $langcode, Acc
 
     // If no module specified either allow or deny, we fall back to the
     // node_access table.
-    if (($grants = $this->grantStorage->access($node, $operation, $langcode, $account)) !== NULL) {
+    if (($grants = $this->accessGrants($node, $operation, $langcode, $account)) !== NULL) {
       return $grants;
     }
 
@@ -130,63 +66,64 @@ protected function checkAccess(EntityInterface $node, $operation, $langcode, Acc
   }
 
   /**
-   * {@inheritdoc}
+   * Determines access to nodes based on node grants.
+   *
+   * @param \Drupal\Core\Entity\EntityInterface $node
+   *   The entity for which to check 'create' access.
+   * @param string $operation
+   *   The entity operation. Usually one of 'view', 'edit', 'create' or
+   *   'delete'.
+   * @param string $langcode
+   *   The language code for which to check access.
+   * @param \Drupal\Core\Session\AccountInterface $account
+   *   The user for which to check access.
+   *
+   * @return bool|null
+   *   TRUE if access was granted, FALSE if access was denied or NULL if no
+   *   module implements hook_node_grants(), the node does not (yet) have an id
+   *   or none of the implementing modules explicitly granted or denied access.
    */
-  protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) {
-    $configured_types = node_permissions_get_configured_types();
-    if (isset($configured_types[$entity_bundle])) {
-      return user_access('create ' . $entity_bundle . ' content', $account);
+  protected function accessGrants(EntityInterface $node, $operation, $langcode, AccountInterface $account) {
+    // If no module implements the hook or the node does not have an id there is
+    // no point in querying the database for access grants.
+    if (!module_implements('node_grants') || !$node->id()) {
+      return;
     }
-  }
 
-  /**
-   * {@inheritdoc}
-   */
-  public function acquireGrants(NodeInterface $node) {
-    $grants = $this->moduleHandler->invokeAll('node_access_records', array($node));
-    // Let modules alter the grants.
-    $this->moduleHandler->alter('node_access_records', $grants, $node);
-    // If no grants are set and the node is published, then use the default grant.
-    if (empty($grants) && $node->isPublished()) {
-      $grants[] = array('realm' => 'all', 'gid' => 0, 'grant_view' => 1, 'grant_update' => 0, 'grant_delete' => 0);
+    // Check the database for potential access grants.
+    $query = db_select('node_access');
+    $query->addExpression('1');
+    // Only interested for granting in the current operation.
+    $query->condition('grant_' . $operation, 1, '>=');
+    // Check for grants for this node and the correct langcode.
+    $nids = db_and()
+      ->condition('nid', $node->id())
+      ->condition('langcode', $langcode);
+    // If the node is published, also take the default grant into account. The
+    // default is saved with a node ID of 0.
+    $status = $node instanceof EntityNG ? $node->status : $node->get('status', $langcode)->value;
+    if ($status) {
+      $nids = db_or()
+        ->condition($nids)
+        ->condition('nid', 0);
+    }
+    $query->condition($nids);
+    $query->range(0, 1);
+
+    $grants = db_or();
+    foreach (node_access_grants($operation, $account instanceof User ? $account->getBCEntity() : $account) as $realm => $gids) {
+      foreach ($gids as $gid) {
+        $grants->condition(db_and()
+          ->condition('gid', $gid)
+          ->condition('realm', $realm));
+      }
     }
-    return $grants;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function writeGrants(NodeInterface $node, $delete = TRUE) {
-    $grants = $this->acquireGrants($node);
-    $this->grantStorage->write($node, $grants, NULL, $delete);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function writeDefaultGrant() {
-    $this->grantStorage->writeDefault();
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function deleteGrants() {
-    $this->grantStorage->delete();
-  }
 
-  /**
-   * {@inheritdoc}
-   */
-  public function countGrants() {
-    return $this->grantStorage->count();
-  }
+    if (count($grants) > 0) {
+      $query->condition($grants);
+    }
 
-  /**
-   * {@inheritdoc}
-   */
-  public function checkAllGrants(AccountInterface $account) {
-    return $this->grantStorage->checkAll($account);
+    return $query->execute()->fetchField();
   }
 
 }
diff --git a/core/modules/node/lib/Drupal/node/NodeAccessControllerInterface.php b/core/modules/node/lib/Drupal/node/NodeAccessControllerInterface.php
deleted file mode 100644
index 6387185..0000000
--- a/core/modules/node/lib/Drupal/node/NodeAccessControllerInterface.php
+++ /dev/null
@@ -1,87 +0,0 @@
-<?php
-/**
- * @file
- * Contains
- */
-
-namespace Drupal\node;
-
-use Drupal\Core\Session\AccountInterface;
-
-interface NodeAccessControllerInterface {
-
-  /**
-   * Gets the list of node access grants.
-   *
-   * This function is called to check the access grants for a node. It collects
-   * all node access grants for the node from hook_node_access_records()
-   * implementations, allows these grants to be altered via
-   * hook_node_access_records_alter() implementations, and returns the grants to
-   * the caller.
-   *
-   * @param \Drupal\node\NodeInterface $node
-   *   The $node to acquire grants for.
-   *
-   * @return array $grants
-   *   The access rules for the node.
-   */
-  public function acquireGrants(NodeInterface $node);
-
-
-  /**
-   * Writes a list of grants to the database, deleting any previously saved ones.
-   *
-   * If a realm is provided, it will only delete grants from that realm, but it
-   * will always delete a grant from the 'all' realm. Modules that utilize
-   * node_access() can use this function when doing mass updates due to widespread
-   * permission changes.
-   *
-   * Note: Don't call this function directly from a contributed module. Call
-   * node_access_acquire_grants() instead.
-   *
-   * @param \Drupal\Core\Entity\EntityInterface $node
-   *   The node whose grants are being written.
-   * @param $grants
-   *   A list of grants to write. See hook_node_access_records() for the
-   *   expected structure of the grants array.
-   * @param $realm
-   *   (optional) If provided, read/write grants for that realm only. Defaults to
-   *   NULL.
-   * @param $delete
-   *   (optional) If false, does not delete records. This is only for optimization
-   *   purposes, and assumes the caller has already performed a mass delete of
-   *   some form. Defaults to TRUE.
-   */
-  public function writeGrants(NodeInterface $node, $delete = TRUE);
-
-  /**
-   * Creates the default node access grant entry on the grant storage.
-   */
-  public function writeDefaultGrant();
-
-  /**
-   * Deletes all node access entries.
-   */
-  public function deleteGrants();
-
-  /**
-   * Counts available node grants.
-   *
-   * @return int
-   *   Returns the amount of node grants.
-   */
-  public function countGrants();
-
-  /**
-   * Checks all grants for a given account.
-   *
-   * @param \Drupal\Core\Session\AccountInterface $account
-   *   A user object representing the user for whom the operation is to be
-   *   performed.
-   *
-   * @return int.
-   *   Status of the access check.
-   */
-  public function checkAllGrants(AccountInterface $account);
-
-}
diff --git a/core/modules/node/lib/Drupal/node/NodeFormController.php b/core/modules/node/lib/Drupal/node/NodeFormController.php
index 814d937..e55e056 100644
--- a/core/modules/node/lib/Drupal/node/NodeFormController.php
+++ b/core/modules/node/lib/Drupal/node/NodeFormController.php
@@ -47,7 +47,7 @@ protected function prepareEntity() {
         }
       }
       global $user;
-      $node->uid = $user->id();
+      $node->uid = $user->uid;
       $node->created = REQUEST_TIME;
     }
     else {
diff --git a/core/modules/node/lib/Drupal/node/NodeGrantDatabaseStorage.php b/core/modules/node/lib/Drupal/node/NodeGrantDatabaseStorage.php
deleted file mode 100644
index 0c2c124..0000000
--- a/core/modules/node/lib/Drupal/node/NodeGrantDatabaseStorage.php
+++ /dev/null
@@ -1,260 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\node\NodeGrantDatabaseStorage.
- */
-
-namespace Drupal\node;
-
-use Drupal\Core\Database\Connection;
-use Drupal\Core\Database\Query\SelectInterface;
-use Drupal\Core\Entity\EntityInterface;
-use Drupal\Core\Entity\EntityNG;
-use Drupal\Core\Extension\ModuleHandlerInterface;
-use Drupal\Core\Session\AccountInterface;
-use Drupal\user\Plugin\Core\Entity\User;
-use Symfony\Component\DependencyInjection\ContainerInterface;
-
-/**
- * Defines a controller class that handles the node grants system.
- *
- * This is used to build node query access.
- */
-class NodeGrantDatabaseStorage implements NodeGrantDatabaseStorageInterface {
-
-  /**
-   * The database connection.
-   *
-   * @var \Drupal\Core\Database\Connection
-   */
-  protected $database;
-
-  /**
-   * The module handler.
-   *
-   * @var \Drupal\Core\Extension\ModuleHandlerInterface
-   */
-  protected $moduleHandler;
-
-  /**
-   * Constructs a NodeAccessController object.
-   *
-   * @param \Drupal\Core\Database\Connection $database
-   *   The database connection.
-   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
-   *   The module handler.
-   */
-  public function __construct(Connection $database, ModuleHandlerInterface $module_handler) {
-    $this->database = $database;
-    $this->moduleHandler = $module_handler;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function access(EntityInterface $node, $operation, $langcode, AccountInterface $account) {
-    // If no module implements the hook or the node does not have an id there is
-    // no point in querying the database for access grants.
-    if (!$this->moduleHandler->getImplementations('node_grants') || !$node->id()) {
-      return;
-    }
-
-    // Check the database for potential access grants.
-    $query = $this->database->select('node_access');
-    $query->addExpression('1');
-    // Only interested for granting in the current operation.
-    $query->condition('grant_' . $operation, 1, '>=');
-    // Check for grants for this node and the correct langcode.
-    $nids = $query->andConditionGroup()
-      ->condition('nid', $node->id())
-      ->condition('langcode', $langcode);
-    // If the node is published, also take the default grant into account. The
-    // default is saved with a node ID of 0.
-    $status = $node instanceof EntityNG ? $node->status : $node->get('status', $langcode)->value;
-    if ($status) {
-      $nids = $query->orConditionGroup()
-        ->condition($nids)
-        ->condition('nid', 0);
-    }
-    $query->condition($nids);
-    $query->range(0, 1);
-
-    $grants = $query->orConditionGroup();
-    foreach (node_access_grants($operation, $account instanceof User ? $account->getBCEntity() : $account) as $realm => $gids) {
-      foreach ($gids as $gid) {
-        $grants->condition(db_and()
-            ->condition('gid', $gid)
-            ->condition('realm', $realm));
-      }
-    }
-
-    if (count($grants) > 0) {
-      $query->condition($grants);
-    }
-
-    return $query->execute()->fetchField();
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function checkAll(AccountInterface $account) {
-    $query = $this->database->select('node_access');
-    $query->addExpression('COUNT(*)');
-    $query
-      ->condition('nid', 0)
-      ->condition('grant_view', 1, '>=');
-
-    $grants = db_or();
-    foreach (node_access_grants('view', $account) as $realm => $gids) {
-      foreach ($gids as $gid) {
-        $grants->condition(db_and()
-            ->condition('gid', $gid)
-            ->condition('realm', $realm)
-        );
-      }
-    }
-    if (count($grants) > 0 ) {
-      $query->condition($grants);
-    }
-    return $query->execute()->fetchField();
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function alterQuery($query, array $tables, $op, AccountInterface $account, $base_table) {
-    if (!$langcode = $query->getMetaData('langcode')) {
-      $langcode = FALSE;
-    }
-
-    // Find all instances of the base table being joined -- could appear
-    // more than once in the query, and could be aliased. Join each one to
-    // the node_access table.
-    $grants = node_access_grants($op, $account);
-    foreach ($tables as $nalias => $tableinfo) {
-      $table = $tableinfo['table'];
-      if (!($table instanceof SelectInterface) && $table == $base_table) {
-        $base_table_found = TRUE;
-        // Set the subquery.
-        $subquery = $this->database->select('node_access', 'na')
-          ->fields('na', array('nid'));
-
-        $grant_conditions = db_or();
-        // If any grant exists for the specified user, then user has access to the
-        // node for the specified operation.
-        foreach ($grants as $realm => $gids) {
-          foreach ($gids as $gid) {
-            $grant_conditions->condition(db_and()
-                ->condition('na.gid', $gid)
-                ->condition('na.realm', $realm)
-            );
-          }
-        }
-
-        // Attach conditions to the subquery for nodes.
-        if (count($grant_conditions->conditions())) {
-          $subquery->condition($grant_conditions);
-        }
-        $subquery->condition('na.grant_' . $op, 1, '>=');
-
-        // Add langcode-based filtering if this is a multilingual site.
-        if (language_multilingual()) {
-          // If no specific langcode to check for is given, use the grant entry
-          // which is set as a fallback.
-          // If a specific langcode is given, use the grant entry for it.
-          if ($langcode === FALSE) {
-            $subquery->condition('na.fallback', 1, '=');
-          }
-          else {
-            $subquery->condition('na.langcode', $langcode, '=');
-          }
-        }
-
-        $field = 'nid';
-        // Now handle entities.
-        $subquery->where("$nalias.$field = na.nid");
-
-        $query->exists($subquery);
-      }
-    }
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function write(NodeInterface $node, array $grants, $realm = NULL, $delete = TRUE) {
-    if ($delete) {
-      $query = $this->database->delete('node_access')->condition('nid', $node->id());
-      if ($realm) {
-        $query->condition('realm', array($realm, 'all'), 'IN');
-      }
-      $query->execute();
-    }
-    // Only perform work when node_access modules are active.
-    if (!empty($grants) && count($this->moduleHandler->getImplementations('node_grants'))) {
-      $query = $this->database->insert('node_access')->fields(array('nid', 'langcode', 'fallback', 'realm', 'gid', 'grant_view', 'grant_update', 'grant_delete'));
-      // If we have defined a granted langcode, use it. But if not, add a grant
-      // for every language this node is translated to.
-      foreach ($grants as $grant) {
-        if ($realm && $realm != $grant['realm']) {
-          continue;
-        }
-        if (isset($grant['langcode'])) {
-          $grant_languages = array($grant['langcode'] => language_load($grant['langcode']));
-        }
-        else {
-          $grant_languages = $node->getTranslationLanguages(TRUE);
-        }
-        foreach ($grant_languages as $grant_langcode => $grant_language) {
-          // Only write grants; denies are implicit.
-          if ($grant['grant_view'] || $grant['grant_update'] || $grant['grant_delete']) {
-            $grant['nid'] = $node->id();
-            $grant['langcode'] = $grant_langcode;
-            // The record with the original langcode is used as the fallback.
-            if ($grant['langcode'] == $node->langcode) {
-              $grant['fallback'] = 1;
-            }
-            else {
-              $grant['fallback'] = 0;
-            }
-            $query->values($grant);
-          }
-        }
-      }
-      $query->execute();
-    }
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function delete() {
-    $this->database->delete('node_access')->execute();
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function writeDefault() {
-    $this->database->insert('node_access')
-      ->fields(array(
-          'nid' => 0,
-          'realm' => 'all',
-          'gid' => 0,
-          'grant_view' => 1,
-          'grant_update' => 0,
-          'grant_delete' => 0,
-        ))
-      ->execute();
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function count() {
-    return $this->database->query('SELECT COUNT(*) FROM {node_access}')->fetchField();
-  }
-
-}
diff --git a/core/modules/node/lib/Drupal/node/NodeGrantDatabaseStorageInterface.php b/core/modules/node/lib/Drupal/node/NodeGrantDatabaseStorageInterface.php
deleted file mode 100644
index 2457b8f..0000000
--- a/core/modules/node/lib/Drupal/node/NodeGrantDatabaseStorageInterface.php
+++ /dev/null
@@ -1,124 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\node\NodeGrantStorageControllerInterface.
- */
-
-namespace Drupal\node;
-
-use Drupal\Core\Entity\EntityInterface;
-use Drupal\Core\Session\AccountInterface;
-
-/**
- * Provides an interface for node access controllers.
- */
-interface NodeGrantDatabaseStorageInterface {
-
-  /**
-   * Checks all grants for a given account.
-   *
-   * @param \Drupal\Core\Session\AccountInterface $account
-   *   A user object representing the user for whom the operation is to be
-   *   performed.
-   *
-   * @return int.
-   *   Status of the access check.
-   */
-  public function checkAll(AccountInterface $account);
-
-  /**
-   * Alters a query when node access is required.
-   *
-   * @param mixed $query
-   *   Query that is being altered.
-   * @param array $tables
-   *   A list of tables that need to be part of the alter.
-   * @param string $op
-   *    The operation to be performed on the node. Possible values are:
-   *    - "view"
-   *    - "update"
-   *    - "delete"
-   *    - "create"
-   * @param \Drupal\Core\Session\AccountInterface $account
-   *   A user object representing the user for whom the operation is to be
-   *   performed.
-   * @param string $base_table
-   *   The base table of the query.
-   *
-   * @return int
-   *   Status of the access check.
-   */
-  public function alterQuery($query, array $tables, $op, AccountInterface $account, $base_table);
-
-  /**
-   * Writes a list of grants to the database, deleting previously saved ones.
-   *
-   * If a realm is provided, it will only delete grants from that realm, but
-   * it will always delete a grant from the 'all' realm. Modules that use
-   * node_access() can use this method when doing mass updates due to
-   * widespread permission changes.
-   *
-   * Note: Don't call this method directly from a contributed module. Call
-   * node_access_write_grants() instead.
-   *
-   * @param \Drupal\node\NodeInterface $node
-   *   The node whose grants are being written.
-   * @param array $grants
-   *   A list of grants to write. Each grant is an array that must contain the
-   *   following keys: realm, gid, grant_view, grant_update, grant_delete.
-   *   The realm is specified by a particular module; the gid is as well, and
-   *   is a module-defined id to define grant privileges. each grant_* field
-   *   is a boolean value.
-   * @param string $realm
-   *   (optional) If provided, read/write grants for that realm only. Defaults to
-   *   NULL.
-   * @param bool $delete
-   *   (optional) If false, does not delete records. This is only for optimization
-   *   purposes, and assumes the caller has already performed a mass delete of
-   *   some form. Defaults to TRUE.
-   *
-   * @see node_access_write_grants()
-   * @see node_access_acquire_grants()
-   */
-  public function write(NodeInterface $node, array $grants, $realm = NULL, $delete = TRUE);
-
-  /**
-   * Deletes all node access entries.
-   */
-  public function delete();
-
-  /**
-   * Creates the default node access grant entry.
-   */
-  public function writeDefault();
-
-  /**
-   * Determines access to nodes based on node grants.
-   *
-   * @param \Drupal\Core\Entity\EntityInterface $node
-   *   The entity for which to check 'create' access.
-   * @param string $operation
-   *   The entity operation. Usually one of 'view', 'edit', 'create' or
-   *   'delete'.
-   * @param string $langcode
-   *   The language code for which to check access.
-   * @param \Drupal\Core\Session\AccountInterface $account
-   *   The user for which to check access.
-   *
-   * @return bool|null
-   *   TRUE if access was granted, FALSE if access was denied or NULL if no
-   *   module implements hook_node_grants(), the node does not (yet) have an id
-   *   or none of the implementing modules explicitly granted or denied access.
-   */
-  public function access(EntityInterface $node, $operation, $langcode, AccountInterface $account);
-
-  /**
-   * Counts available node grants.
-   *
-   * @return int
-   *   Returns the amount of node grants.
-   */
-  public function count();
-
-}
diff --git a/core/modules/node/lib/Drupal/node/NodeTypeAccessController.php b/core/modules/node/lib/Drupal/node/NodeTypeAccessController.php
index 55238a6..40327e3 100644
--- a/core/modules/node/lib/Drupal/node/NodeTypeAccessController.php
+++ b/core/modules/node/lib/Drupal/node/NodeTypeAccessController.php
@@ -28,11 +28,4 @@ protected function checkAccess(EntityInterface $entity, $operation, $langcode, A
     return user_access('administer content types', $account);
   }
 
-  /**
-   * {@inheritdoc}
-   */
-  protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) {
-    return user_access('administer content types', $account);
-  }
-
 }
diff --git a/core/modules/node/lib/Drupal/node/Plugin/Action/AssignOwnerNode.php b/core/modules/node/lib/Drupal/node/Plugin/Action/AssignOwnerNode.php
index 76bc6d6..94d85de 100644
--- a/core/modules/node/lib/Drupal/node/Plugin/Action/AssignOwnerNode.php
+++ b/core/modules/node/lib/Drupal/node/Plugin/Action/AssignOwnerNode.php
@@ -11,7 +11,6 @@
 use Drupal\Core\Annotation\Translation;
 use Drupal\Core\Action\ConfigurableActionBase;
 use Drupal\Core\Database\Connection;
-use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 
 /**
@@ -23,7 +22,7 @@
  *   type = "node"
  * )
  */
-class AssignOwnerNode extends ConfigurableActionBase implements ContainerFactoryPluginInterface {
+class AssignOwnerNode extends ConfigurableActionBase {
 
   /**
    * The database connection.
diff --git a/core/modules/node/lib/Drupal/node/Plugin/Action/DeleteNode.php b/core/modules/node/lib/Drupal/node/Plugin/Action/DeleteNode.php
index 9b839d0..f4a5eff 100644
--- a/core/modules/node/lib/Drupal/node/Plugin/Action/DeleteNode.php
+++ b/core/modules/node/lib/Drupal/node/Plugin/Action/DeleteNode.php
@@ -10,7 +10,6 @@
 use Drupal\Core\Annotation\Action;
 use Drupal\Core\Annotation\Translation;
 use Drupal\Core\Action\ActionBase;
-use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
 use Drupal\user\TempStoreFactory;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 
@@ -24,7 +23,7 @@
  *   confirm_form_path = "admin/content/node/delete"
  * )
  */
-class DeleteNode extends ActionBase implements ContainerFactoryPluginInterface {
+class DeleteNode extends ActionBase {
 
   /**
    * The tempstore object.
@@ -62,7 +61,7 @@ public static function create(ContainerInterface $container, array $configuratio
    * {@inheritdoc}
    */
   public function executeMultiple(array $entities) {
-    $this->tempStore->set($GLOBALS['user']->id(), $entities);
+    $this->tempStore->set($GLOBALS['user']->uid, $entities);
   }
 
   /**
diff --git a/core/modules/node/lib/Drupal/node/Plugin/Core/Entity/Node.php b/core/modules/node/lib/Drupal/node/Plugin/Core/Entity/Node.php
index 01a3535..b8451b8 100644
--- a/core/modules/node/lib/Drupal/node/Plugin/Core/Entity/Node.php
+++ b/core/modules/node/lib/Drupal/node/Plugin/Core/Entity/Node.php
@@ -28,7 +28,6 @@
  *     "access" = "Drupal\node\NodeAccessController",
  *     "form" = {
  *       "default" = "Drupal\node\NodeFormController",
- *       "delete" = "Drupal\node\Form\NodeDeleteForm",
  *       "edit" = "Drupal\node\NodeFormController"
  *     },
  *     "translation" = "Drupal\node\NodeTranslationController"
@@ -116,7 +115,7 @@ public function postSave(EntityStorageControllerInterface $storage_controller, $
     // default revision. There's no need to delete existing records if the node
     // is new.
     if ($this->isDefaultRevision()) {
-      \Drupal::entityManager()->getAccessController('node')->writeGrants($this->getBCEntity(), $update);
+      node_access_acquire_grants($this->getBCEntity(), $update);
     }
   }
 
diff --git a/core/modules/node/lib/Drupal/node/Plugin/entity_reference/selection/NodeSelection.php b/core/modules/node/lib/Drupal/node/Plugin/entity_reference/selection/NodeSelection.php
index 04a61bd..41ba9d4 100644
--- a/core/modules/node/lib/Drupal/node/Plugin/entity_reference/selection/NodeSelection.php
+++ b/core/modules/node/lib/Drupal/node/Plugin/entity_reference/selection/NodeSelection.php
@@ -7,15 +7,17 @@
 
 namespace Drupal\node\Plugin\entity_reference\selection;
 
+use Drupal\Component\Annotation\Plugin;
 use Drupal\Core\Annotation\Translation;
-use Drupal\entity_reference\Annotation\EntityReferenceSelection;
+use Drupal\Core\Database\Query\SelectInterface;
 use Drupal\entity_reference\Plugin\entity_reference\selection\SelectionBase;
 
 /**
  * Provides specific access control for the node entity type.
  *
- * @EntityReferenceSelection(
+ * @Plugin(
  *   id = "node_default",
+ *   module = "node",
  *   label = @Translation("Node selection"),
  *   entity_types = {"node"},
  *   group = "default",
@@ -25,7 +27,7 @@
 class NodeSelection extends SelectionBase {
 
   /**
-   * {@inheritdoc}
+   * Overrides SelectionBase::buildEntityQuery().
    */
   public function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS') {
     $query = parent::buildEntityQuery($match, $match_operator);
diff --git a/core/modules/node/lib/Drupal/node/Plugin/views/field/Language.php b/core/modules/node/lib/Drupal/node/Plugin/views/field/Language.php
index ff47cb2..d76e41c 100644
--- a/core/modules/node/lib/Drupal/node/Plugin/views/field/Language.php
+++ b/core/modules/node/lib/Drupal/node/Plugin/views/field/Language.php
@@ -36,7 +36,7 @@ public function buildOptionsForm(&$form, &$form_state) {
     );
   }
 
-  public function render($values) {
+  function render($values) {
     // @todo: Drupal Core dropped native language until config translation is
     // ready, see http://drupal.org/node/1616594.
     $value = $this->getValue($values);
diff --git a/core/modules/node/lib/Drupal/node/Plugin/views/field/Link.php b/core/modules/node/lib/Drupal/node/Plugin/views/field/Link.php
index a5ad276..8327bcf 100644
--- a/core/modules/node/lib/Drupal/node/Plugin/views/field/Link.php
+++ b/core/modules/node/lib/Drupal/node/Plugin/views/field/Link.php
@@ -45,7 +45,7 @@ public function query() {
     $this->addAdditionalFields();
   }
 
-  public function render($values) {
+  function render($values) {
     if ($entity = $this->getEntity($values)) {
       return $this->render_link($entity, $values);
     }
diff --git a/core/modules/node/lib/Drupal/node/Plugin/views/field/Node.php b/core/modules/node/lib/Drupal/node/Plugin/views/field/Node.php
index 0851b25..b446ed2 100644
--- a/core/modules/node/lib/Drupal/node/Plugin/views/field/Node.php
+++ b/core/modules/node/lib/Drupal/node/Plugin/views/field/Node.php
@@ -86,7 +86,7 @@ function render_link($data, $values) {
     return $data;
   }
 
-  public function render($values) {
+  function render($values) {
     $value = $this->getValue($values);
     return $this->render_link($this->sanitizeValue($value), $values);
   }
diff --git a/core/modules/node/lib/Drupal/node/Plugin/views/field/Path.php b/core/modules/node/lib/Drupal/node/Plugin/views/field/Path.php
index 78ff114..a5c8e40 100644
--- a/core/modules/node/lib/Drupal/node/Plugin/views/field/Path.php
+++ b/core/modules/node/lib/Drupal/node/Plugin/views/field/Path.php
@@ -53,7 +53,7 @@ public function query() {
     $this->addAdditionalFields();
   }
 
-  public function render($values) {
+  function render($values) {
     $nid = $this->getValue($values, 'nid');
     return url("node/$nid", array('absolute' => $this->options['absolute']));
   }
diff --git a/core/modules/node/lib/Drupal/node/Plugin/views/field/Type.php b/core/modules/node/lib/Drupal/node/Plugin/views/field/Type.php
index 1ca5150..6d31ae4 100644
--- a/core/modules/node/lib/Drupal/node/Plugin/views/field/Type.php
+++ b/core/modules/node/lib/Drupal/node/Plugin/views/field/Type.php
@@ -51,7 +51,7 @@ function render_name($data, $values) {
     return $this->sanitizeValue($data);
   }
 
-  public function render($values) {
+  function render($values) {
     $value = $this->getValue($values);
     return $this->render_link($this->render_name($value, $values), $values);
   }
diff --git a/core/modules/node/lib/Drupal/node/Plugin/views/row/Rss.php b/core/modules/node/lib/Drupal/node/Plugin/views/row/Rss.php
index 4005bfa..49cc52a 100644
--- a/core/modules/node/lib/Drupal/node/Plugin/views/row/Rss.php
+++ b/core/modules/node/lib/Drupal/node/Plugin/views/row/Rss.php
@@ -89,7 +89,7 @@ public function preRender($values) {
     }
   }
 
-  public function render($row) {
+  function render($row) {
     // For the most part, this code is taken from node_feed() in node.module
     global $base_url;
 
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 acba6b6..db8b858 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
@@ -55,8 +55,7 @@ class Node extends WizardPluginBase {
     'status' => array(
       'value' => TRUE,
       'table' => 'node_field_data',
-      'field' => 'status',
-      'provider' => 'node'
+      'field' => 'status'
     )
   );
 
@@ -149,7 +148,6 @@ protected function defaultDisplayOptions() {
     $display_options['fields']['title']['id'] = 'title';
     $display_options['fields']['title']['table'] = 'node_field_data';
     $display_options['fields']['title']['field'] = 'title';
-    $display_options['fields']['title']['provider'] = 'node';
     $display_options['fields']['title']['label'] = '';
     $display_options['fields']['title']['alter']['alter_text'] = 0;
     $display_options['fields']['title']['alter']['make_link'] = 0;
diff --git a/core/modules/node/lib/Drupal/node/Plugin/views/wizard/NodeRevision.php b/core/modules/node/lib/Drupal/node/Plugin/views/wizard/NodeRevision.php
index 757748d..179a0ec 100644
--- a/core/modules/node/lib/Drupal/node/Plugin/views/wizard/NodeRevision.php
+++ b/core/modules/node/lib/Drupal/node/Plugin/views/wizard/NodeRevision.php
@@ -66,8 +66,7 @@ class NodeRevision extends WizardPluginBase {
     'status' => array(
       'value' => TRUE,
       'table' => 'node_field_revision',
-      'field' => 'status',
-      'provider' => 'node'
+      'field' => 'status'
     )
   );
 
@@ -100,7 +99,6 @@ protected function defaultDisplayOptions() {
     $display_options['fields']['timestamp']['id'] = 'timestamp';
     $display_options['fields']['timestamp']['table'] = 'node_field_revision';
     $display_options['fields']['timestamp']['field'] = 'timestamp';
-    $display_options['fields']['timestamp']['provider'] = 'node';
     $display_options['fields']['timestamp']['alter']['alter_text'] = 0;
     $display_options['fields']['timestamp']['alter']['make_link'] = 0;
     $display_options['fields']['timestamp']['alter']['absolute'] = 0;
@@ -116,7 +114,6 @@ protected function defaultDisplayOptions() {
     $display_options['fields']['title']['id'] = 'title';
     $display_options['fields']['title']['table'] = 'node_field_revision';
     $display_options['fields']['title']['field'] = 'title';
-    $display_options['fields']['title']['provider'] = 'node';
     $display_options['fields']['title']['label'] = '';
     $display_options['fields']['title']['alter']['alter_text'] = 0;
     $display_options['fields']['title']['alter']['make_link'] = 0;
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeAccessBaseTableTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeAccessBaseTableTest.php
index 5107337..adee17d 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeAccessBaseTableTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeAccessBaseTableTest.php
@@ -92,7 +92,7 @@ function testNodeAccessBasic() {
           $private_nodes[] = $nid;
         }
         $titles[$nid] = $edit['title'];
-        $this->nodesByUser[$this->webUser->id()][$nid] = $is_private;
+        $this->nodesByUser[$this->webUser->uid][$nid] = $is_private;
       }
     }
     $this->publicTid = db_query('SELECT tid FROM {taxonomy_term_data} WHERE name = :name', array(':name' => 'public'))->fetchField();
@@ -106,7 +106,7 @@ function testNodeAccessBasic() {
         foreach ($data as $nid => $is_private) {
           $this->drupalGet('node/' . $nid);
           if ($is_private) {
-            $should_be_visible = $uid == $this->webUser->id();
+            $should_be_visible = $uid == $this->webUser->uid;
           }
           else {
             $should_be_visible = TRUE;
@@ -115,7 +115,7 @@ function testNodeAccessBasic() {
             '%private' => $is_private ? 'private' : 'public',
             '%uid' => $uid,
             '%visible' => $should_be_visible ? 'visible' : 'not visible',
-            '%current_uid' => $this->webUser->id(),
+            '%current_uid' => $this->webUser->uid,
           )));
         }
       }
@@ -165,13 +165,13 @@ protected function assertTaxonomyPage($is_admin) {
           // Non-administrators can only see their own nodes on the private
           // term page.
           if (!$is_admin && $tid_is_private) {
-            $should_be_visible = $should_be_visible && $uid == $this->webUser->id();
+            $should_be_visible = $should_be_visible && $uid == $this->webUser->uid;
           }
           $this->assertIdentical(isset($this->nids_visible[$nid]), $should_be_visible, strtr('A %private node by user %uid is %visible for user %current_uid on the %tid_is_private page.', array(
             '%private' => $is_private ? 'private' : 'public',
             '%uid' => $uid,
             '%visible' => isset($this->nids_visible[$nid]) ? 'visible' : 'not visible',
-            '%current_uid' => $this->webUser->id(),
+            '%current_uid' => $this->webUser->uid,
             '%tid_is_private' => $tid_is_private ? 'private' : 'public',
           )));
         }
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeAccessTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeAccessTest.php
index 66448d0..4a5e0f8 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeAccessTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeAccessTest.php
@@ -47,7 +47,7 @@ function testNodeAccess() {
 
     // User cannot 'view own unpublished content'.
     $web_user3 = $this->drupalCreateUser(array('access content'));
-    $node3 = $this->drupalCreateNode(array('status' => 0, 'uid' => $web_user3->id()));
+    $node3 = $this->drupalCreateNode(array('status' => 0, 'uid' => $web_user3->uid));
     $this->assertNodeAccess(array('view' => FALSE), $node3, $web_user3);
 
     // User cannot create content without permission.
@@ -56,7 +56,7 @@ function testNodeAccess() {
     // User can 'view own unpublished content', but another user cannot.
     $web_user4 = $this->drupalCreateUser(array('access content', 'view own unpublished content'));
     $web_user5 = $this->drupalCreateUser(array('access content', 'view own unpublished content'));
-    $node4 = $this->drupalCreateNode(array('status' => 0, 'uid' => $web_user4->id()));
+    $node4 = $this->drupalCreateNode(array('status' => 0, 'uid' => $web_user4->uid));
     $this->assertNodeAccess(array('view' => TRUE, 'update' => FALSE), $node4, $web_user4);
     $this->assertNodeAccess(array('view' => FALSE), $node4, $web_user5);
 
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeAdminTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeAdminTest.php
index 73d8a3b..6ad8a19 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeAdminTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeAdminTest.php
@@ -96,8 +96,8 @@ function testContentAdminPages() {
 
     $nodes['published_page'] = $this->drupalCreateNode(array('type' => 'page'));
     $nodes['published_article'] = $this->drupalCreateNode(array('type' => 'article'));
-    $nodes['unpublished_page_1'] = $this->drupalCreateNode(array('type' => 'page', 'uid' => $this->base_user_1->id(), 'status' => 0));
-    $nodes['unpublished_page_2'] = $this->drupalCreateNode(array('type' => 'page', 'uid' => $this->base_user_2->id(), 'status' => 0));
+    $nodes['unpublished_page_1'] = $this->drupalCreateNode(array('type' => 'page', 'uid' => $this->base_user_1->uid, 'status' => 0));
+    $nodes['unpublished_page_2'] = $this->drupalCreateNode(array('type' => 'page', 'uid' => $this->base_user_2->uid, 'status' => 0));
 
     // Verify view, edit, and delete links for any content.
     $this->drupalGet('admin/content');
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeBlockFunctionalTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeBlockFunctionalTest.php
index b308072..8d95c06 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeBlockFunctionalTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeBlockFunctionalTest.php
@@ -68,7 +68,7 @@ public function testRecentNodeBlock() {
     $this->assertText(t('No content available.'), 'Block with "No content available." found.');
 
     // Add some test nodes.
-    $default_settings = array('uid' => $this->webUser->id(), 'type' => 'article');
+    $default_settings = array('uid' => $this->webUser->uid, 'type' => 'article');
     $node1 = $this->drupalCreateNode($default_settings);
     $node2 = $this->drupalCreateNode($default_settings);
     $node3 = $this->drupalCreateNode($default_settings);
@@ -136,7 +136,7 @@ public function testRecentNodeBlock() {
     $this->assertTrue(isset($visibility['node_type']['types']['article']), 'Visibility settings were saved to configuration');
 
     // Create a page node.
-    $node5 = $this->drupalCreateNode(array('uid' => $this->adminUser->id(), 'type' => 'page'));
+    $node5 = $this->drupalCreateNode(array('uid' => $this->adminUser->uid, 'type' => 'page'));
 
     // Verify visibility rules.
     $this->drupalGet('');
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeCreationTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeCreationTest.php
index 90592b0..55719bb 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeCreationTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeCreationTest.php
@@ -64,7 +64,7 @@ function testNodeCreation() {
   function testFailedPageCreation() {
     // Create a node.
     $edit = array(
-      'uid'      => $this->loggedInUser->id(),
+      'uid'      => $this->loggedInUser->uid,
       'name'     => $this->loggedInUser->name,
       'type'     => 'page',
       'langcode' => Language::LANGCODE_NOT_SPECIFIED,
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeQueryAlterTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeQueryAlterTest.php
index 4d62136..2caeca9 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeQueryAlterTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeQueryAlterTest.php
@@ -169,7 +169,7 @@ function testNodeQueryAlterOverride() {
     // $account instead of the global $user, we will log in as
     // noAccessUser2.
     $this->drupalLogin($this->noAccessUser2);
-    \Drupal::state()->set('node_access_test.no_access_uid', $this->noAccessUser->id());
+    \Drupal::state()->set('node_access_test.no_access_uid', $this->noAccessUser->uid);
     drupal_static_reset('node_access_view_all_nodes');
     try {
       $query = db_select('node', 'mytab')
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeRevisionsAllTestCase.php b/core/modules/node/lib/Drupal/node/Tests/NodeRevisionsAllTestCase.php
index f2209d7..a5751eb 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeRevisionsAllTestCase.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeRevisionsAllTestCase.php
@@ -98,12 +98,12 @@ function testRevisions() {
 
     // Confirm the correct revision text appears on "view revisions" page.
     $this->drupalGet("node/$node->nid/revisions/$node->vid/view");
-    $this->assertText($node->body[Language::LANGCODE_NOT_SPECIFIED][0]['value'], 'Correct text displays for version.');
+    $this->assertText($node->body[Language::LANGCODE_NOT_SPECIFIED][0]['value'], t('Correct text displays for version.'));
 
     // Confirm the correct log message appears on "revisions overview" page.
     $this->drupalGet("node/$node->nid/revisions");
     foreach ($logs as $log) {
-      $this->assertText($log, 'Log message found.');
+      $this->assertText($log, t('Log message found.'));
     }
 
     // Confirm that this is the current revision.
@@ -119,7 +119,7 @@ function testRevisions() {
       )),
       'Revision reverted.');
     $reverted_node = node_load($node->nid, TRUE);
-    $this->assertTrue(($nodes[1]->body[Language::LANGCODE_NOT_SPECIFIED][0]['value'] == $reverted_node->body[Language::LANGCODE_NOT_SPECIFIED][0]['value']), 'Node reverted correctly.');
+    $this->assertTrue(($nodes[1]->body[Language::LANGCODE_NOT_SPECIFIED][0]['value'] == $reverted_node->body[Language::LANGCODE_NOT_SPECIFIED][0]['value']), t('Node reverted correctly.'));
 
     // Confirm that this is not the current version.
     $node = node_revision_load($node->vid);
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeSaveTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeSaveTest.php
index 0a1c210..6157fb0 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeSaveTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeSaveTest.php
@@ -52,7 +52,7 @@ function testImport() {
     $node = array(
       'title' => $title,
       'body' => array(array('value' => $this->randomName(32))),
-      'uid' => $this->web_user->id(),
+      'uid' => $this->web_user->uid,
       'type' => 'article',
       'nid' => $test_nid,
     );
@@ -60,7 +60,7 @@ function testImport() {
     $node->enforceIsNew();
 
     // Verify that node_submit did not overwrite the user ID.
-    $this->assertEqual($node->uid, $this->web_user->id(), 'Function node_submit() preserves user ID');
+    $this->assertEqual($node->uid, $this->web_user->uid, 'Function node_submit() preserves user ID');
 
     $node->save();
     // Test the import.
@@ -77,7 +77,7 @@ function testImport() {
   function testTimestamps() {
     // Use the default timestamps.
     $edit = array(
-      'uid' => $this->web_user->id(),
+      'uid' => $this->web_user->uid,
       'type' => 'article',
       'title' => $this->randomName(8),
     );
@@ -105,7 +105,7 @@ function testTimestamps() {
 
     // Programmatically set the timestamps on the node.
     $edit = array(
-      'uid' => $this->web_user->id(),
+      'uid' => $this->web_user->uid,
       'type' => 'article',
       'title' => $this->randomName(8),
       'created' => 280299600, // Sun, 19 Nov 1978 05:00:00 GMT
@@ -136,7 +136,7 @@ function testTimestamps() {
   function testDeterminingChanges() {
     // Initial creation.
     $node = entity_create('node', array(
-      'uid' => $this->web_user->id(),
+      'uid' => $this->web_user->uid,
       'type' => 'article',
       'title' => 'test_changes',
     ));
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeTokenReplaceTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeTokenReplaceTest.php
index 8bb425d..9037751 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeTokenReplaceTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeTokenReplaceTest.php
@@ -36,7 +36,7 @@ function testNodeTokenReplacement() {
     $account = $this->drupalCreateUser();
     $settings = array(
       'type' => 'article',
-      'uid' => $account->id(),
+      'uid' => $account->uid,
       'title' => '<blink>Blinking Text</blink>',
       'body' => array(array('value' => $this->randomName(32), 'summary' => $this->randomName(16))),
     );
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeTranslationUITest.php b/core/modules/node/lib/Drupal/node/Tests/NodeTranslationUITest.php
index 473947b..bea3245 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeTranslationUITest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeTranslationUITest.php
@@ -120,7 +120,7 @@ protected function assertAuthoringInfo() {
     foreach ($this->langcodes as $index => $langcode) {
       $user = $this->drupalCreateUser();
       $values[$langcode] = array(
-        'uid' => $user->id(),
+        'uid' => $user->uid,
         'created' => REQUEST_TIME - mt_rand(0, 1000),
       );
       $edit = array(
diff --git a/core/modules/node/lib/Drupal/node/Tests/PageEditTest.php b/core/modules/node/lib/Drupal/node/Tests/PageEditTest.php
index 2407dfb..c37a227 100644
--- a/core/modules/node/lib/Drupal/node/Tests/PageEditTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/PageEditTest.php
@@ -114,7 +114,7 @@ function testPageAuthoredBy() {
 
     // Check that the node was authored by the currently logged in user.
     $node = $this->drupalGetNodeByTitle($edit['title']);
-    $this->assertIdentical($node->uid, $this->admin_user->id(), 'Node authored by admin user.');
+    $this->assertIdentical($node->uid, $this->admin_user->uid, 'Node authored by admin user.');
 
     // Try to change the 'authored by' field to an invalid user name.
     $edit = array(
@@ -135,7 +135,7 @@ function testPageAuthoredBy() {
     $edit['name'] = $this->web_user->name;
     $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save and keep published'));
     $node = node_load($node->nid, TRUE);
-    $this->assertIdentical($node->uid, $this->web_user->id(), 'Node authored by normal user.');
+    $this->assertIdentical($node->uid, $this->web_user->uid, 'Node authored by normal user.');
 
     // Check that normal users cannot change the authored by information.
     $this->drupalLogin($this->web_user);
diff --git a/core/modules/node/lib/Drupal/node/Tests/Views/FilterUidRevisionTest.php b/core/modules/node/lib/Drupal/node/Tests/Views/FilterUidRevisionTest.php
index 67b4cba..375bd32 100644
--- a/core/modules/node/lib/Drupal/node/Tests/Views/FilterUidRevisionTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/Views/FilterUidRevisionTest.php
@@ -55,7 +55,7 @@ public function testFilter() {
 
     $view = views_get_view('test_filter_node_uid_revision');
     $view->initHandlers();
-    $view->filter['uid_revision']->value = array($author->id());
+    $view->filter['uid_revision']->value = array($author->uid);
 
     $this->executeView($view);
     $this->assertIdenticalResultset($view, $expected_result, array('nid' => 'nid'), 'Make sure that the view only returns nodes which match either the node or the revision author.');
diff --git a/core/modules/node/node.admin.inc b/core/modules/node/node.admin.inc
index 3a30faf..1d80c2e 100644
--- a/core/modules/node/node.admin.inc
+++ b/core/modules/node/node.admin.inc
@@ -9,6 +9,29 @@
 use Drupal\node\NodeInterface;
 
 /**
+ * Page callback: Form constructor for the permission rebuild confirmation form.
+ *
+ * @return array
+ *   An array as expected by drupal_render().
+ *
+ * @see node_configure_rebuild_confirm_submit()
+ * @see node_menu()
+ * @ingroup forms
+ */
+function node_configure_rebuild_confirm() {
+  return confirm_form(array(), t('Are you sure you want to rebuild the permissions on site content?'),
+                  'admin/reports/status', t('This action rebuilds all permissions on site content, and may be a lengthy process. This action cannot be undone.'), t('Rebuild permissions'), t('Cancel'));
+}
+
+/**
+ * Form submission handler for node_configure_rebuild_confirm().
+ */
+function node_configure_rebuild_confirm_submit($form, &$form_state) {
+  node_access_rebuild(TRUE);
+  $form_state['redirect'] = 'admin/reports/status';
+}
+
+/**
  * Updates all nodes in the passed-in array with the passed-in field values.
  *
  * IMPORTANT NOTE: This function is intended to work when called from a form
@@ -206,7 +229,7 @@ function node_admin_nodes() {
     // If the user is able to view their own unpublished nodes, allow them
     // to see these in addition to published nodes. Check that they actually
     // have some unpublished nodes to view before adding the condition.
-    if (user_access('view own unpublished content') && $own_unpublished = db_query('SELECT DISTINCT nid FROM {node_field_data} WHERE uid = :uid AND status = :status', array(':uid' => $GLOBALS['user']->id(), ':status' => 0))->fetchCol()) {
+    if (user_access('view own unpublished content') && $own_unpublished = db_query('SELECT DISTINCT nid FROM {node_field_data} WHERE uid = :uid AND status = :status', array(':uid' => $GLOBALS['user']->uid, ':status' => 0))->fetchCol()) {
       $query->condition(db_or()
         ->condition('n.status', 1)
         ->condition('n.nid', $own_unpublished, 'IN')
@@ -253,7 +276,7 @@ function node_admin_nodes() {
     );
     $form['nodes'][$node->nid]['author'] = array(
       '#theme' => 'username',
-      '#account' => user_load($node->uid),
+      '#account' => $node,
     );
     $form['nodes'][$node->nid]['status'] = array(
       '#markup' => $node->status ? t('published') : t('not published'),
diff --git a/core/modules/node/node.api.php b/core/modules/node/node.api.php
index a3e0138..51abca3 100644
--- a/core/modules/node/node.api.php
+++ b/core/modules/node/node.api.php
@@ -187,7 +187,7 @@ function hook_node_grants($account, $op) {
   if (user_access('access private content', $account)) {
     $grants['example'] = array(1);
   }
-  $grants['example_owner'] = array($account->id());
+  $grants['example_owner'] = array($account->uid);
   return $grants;
 }
 
@@ -253,7 +253,7 @@ function hook_node_grants($account, $op) {
  * @return
  *   An array of grants as defined above.
  *
- * @see node_access_write_grants()
+ * @see _node_access_write_grants()
  * @see hook_node_access_records_alter()
  * @ingroup node_access
  */
@@ -577,13 +577,13 @@ function hook_node_access($node, $op, $account, $langcode) {
     }
 
     if ($op == 'update') {
-      if (user_access('edit any ' . $type . ' content', $account) || (user_access('edit own ' . $type . ' content', $account) && ($account->id() == $node->uid))) {
+      if (user_access('edit any ' . $type . ' content', $account) || (user_access('edit own ' . $type . ' content', $account) && ($account->uid == $node->uid))) {
         return NODE_ACCESS_ALLOW;
       }
     }
 
     if ($op == 'delete') {
-      if (user_access('delete any ' . $type . ' content', $account) || (user_access('delete own ' . $type . ' content', $account) && ($account->id() == $node->uid))) {
+      if (user_access('delete any ' . $type . ' content', $account) || (user_access('delete own ' . $type . ' content', $account) && ($account->uid == $node->uid))) {
         return NODE_ACCESS_ALLOW;
       }
     }
diff --git a/core/modules/node/node.module b/core/modules/node/node.module
index 45f19c7..b9c5bd3 100644
--- a/core/modules/node/node.module
+++ b/core/modules/node/node.module
@@ -9,7 +9,6 @@
  */
 
 use Drupal\Core\Language\Language;
-use Drupal\node\NodeInterface;
 use Symfony\Component\HttpFoundation\Response;
 
 use Drupal\Core\Cache\CacheBackendInterface;
@@ -22,6 +21,7 @@
 use Drupal\Core\Template\Attribute;
 use Drupal\entity\Plugin\Core\Entity\EntityDisplay;
 use Drupal\file\Plugin\Core\Entity\File;
+use Drupal\node\NodeInterface;
 use Drupal\user\UserInterface;
 
 /**
@@ -281,7 +281,7 @@ function node_mark($nid, $timestamp) {
   global $user;
   $cache = &drupal_static(__FUNCTION__, array());
 
-  if ($user->isAnonymous() || !module_exists('history')) {
+  if (!$user->uid || !module_exists('history')) {
     return MARK_READ;
   }
   if (!isset($cache[$nid])) {
@@ -501,6 +501,53 @@ function node_type_update_nodes($old_id, $new_id) {
 }
 
 /**
+ * Implements hook_rdf_mapping().
+ */
+function node_rdf_mapping() {
+  return array(
+    array(
+      'type' => 'node',
+      'bundle' => RDF_DEFAULT_BUNDLE,
+      'mapping' => array(
+        'rdftype' => array('sioc:Item', 'foaf:Document'),
+        'title' => array(
+          'predicates' => array('dc:title'),
+        ),
+        'created' => array(
+          'predicates' => array('dc:date', 'dc:created'),
+          'datatype' => 'xsd:dateTime',
+          'callback' => 'date_iso8601',
+        ),
+        'changed' => array(
+          'predicates' => array('dc:modified'),
+          'datatype' => 'xsd:dateTime',
+          'callback' => 'date_iso8601',
+        ),
+        'body' => array(
+          'predicates' => array('content:encoded'),
+        ),
+        'uid' => array(
+          'predicates' => array('sioc:has_creator'),
+          'type' => 'rel',
+        ),
+        'name' => array(
+          'predicates' => array('foaf:name'),
+        ),
+        'comment_count' => array(
+          'predicates' => array('sioc:num_replies'),
+          'datatype' => 'xsd:integer',
+        ),
+        'last_activity' => array(
+          'predicates' => array('sioc:last_activity_date'),
+          'datatype' => 'xsd:dateTime',
+          'callback' => 'date_iso8601',
+        ),
+      ),
+    ),
+  );
+}
+
+/**
  * Loads node entities from the database.
  *
  * This function should be used whenever you need to load more than one node
@@ -693,7 +740,7 @@ function template_preprocess_node(&$variables) {
   //   http://drupal.org/node/1941286.
   $username = array(
     '#theme' => 'username',
-    '#account' => user_load($node->uid),
+    '#account' => $node,
     '#link_options' => array('attributes' => array('rel' => 'author')),
   );
   $variables['name'] = drupal_render($username);
@@ -951,7 +998,7 @@ function node_search_execute($keys = NULL, $conditions = NULL) {
     $uri = $node->uri();
     $username = array(
       '#theme' => 'username',
-      '#account' => user_load($node->uid),
+      '#account' => $node,
     );
     $results[] = array(
       'link' => url($uri['path'], array_merge($uri['options'], array('absolute' => TRUE, 'language' => $language))),
@@ -1015,7 +1062,7 @@ function node_user_cancel($edit, $account, $method) {
       $nodes = db_select('node_field_data', 'n')
         ->distinct()
         ->fields('n', array('nid'))
-        ->condition('uid', $account->id())
+        ->condition('uid', $account->uid)
         ->execute()
         ->fetchCol();
       node_mass_update($nodes, array('status' => 0), NULL, TRUE);
@@ -1027,14 +1074,14 @@ function node_user_cancel($edit, $account, $method) {
       $nodes = db_select('node_field_data', 'n')
         ->distinct()
         ->fields('n', array('nid'))
-        ->condition('uid', $account->id())
+        ->condition('uid', $account->uid)
         ->execute()
         ->fetchCol();
       node_mass_update($nodes, array('uid' => 0), NULL, TRUE);
       // Anonymize old revisions.
       db_update('node_field_revision')
         ->fields(array('uid' => 0))
-        ->condition('uid', $account->id())
+        ->condition('uid', $account->uid)
         ->execute();
       break;
   }
@@ -1049,12 +1096,12 @@ function node_user_predelete($account) {
   $nodes = db_select('node_field_data', 'n')
     ->distinct()
     ->fields('n', array('nid'))
-    ->condition('uid', $account->id())
+    ->condition('uid', $account->uid)
     ->execute()
     ->fetchCol();
   entity_delete_multiple('node', $nodes);
   // Delete old revisions.
-  $revisions = db_query('SELECT DISTINCT vid FROM {node_field_revision} WHERE uid = :uid', array(':uid' => $account->id()))->fetchCol();
+  $revisions = db_query('SELECT DISTINCT vid FROM {node_field_revision} WHERE uid = :uid', array(':uid' => $account->uid))->fetchCol();
   foreach ($revisions as $revision) {
     node_revision_delete($revision);
   }
@@ -1116,7 +1163,64 @@ function theme_node_search_admin($variables) {
  * @see node_menu()
  */
 function _node_revision_access(EntityInterface $node, $op = 'view', $account = NULL, $langcode = NULL) {
-  return Drupal::service('access_check.node.revision')->checkAccess($node, $op, $account, $langcode);
+  $access = &drupal_static(__FUNCTION__, array());
+
+  $map = array(
+    'view' => 'view all revisions',
+    'update' => 'revert all revisions',
+    'delete' => 'delete all revisions',
+  );
+  $bundle = $node->bundle();
+  $type_map = array(
+    'view' => "view $bundle revisions",
+    'update' => "revert $bundle revisions",
+    'delete' => "delete $bundle revisions",
+  );
+
+  if (!$node || !isset($map[$op]) || !isset($type_map[$op])) {
+    // If there was no node to check against, or the $op was not one of the
+    // supported ones, we return access denied.
+    return FALSE;
+  }
+
+  if (!isset($account)) {
+    $account = $GLOBALS['user'];
+  }
+
+  // If no language code was provided, default to the node revision's langcode.
+  if (empty($langcode)) {
+    $langcode = $node->language()->id;
+  }
+
+  // Statically cache access by revision ID, language code, user account ID,
+  // and operation.
+  $cid = $node->getRevisionId() . ':' . $langcode . ':' . $account->id() . ':' . $op;
+
+  if (!isset($access[$cid])) {
+    // Perform basic permission checks first.
+    if (!user_access($map[$op], $account) && !user_access($type_map[$op], $account) && !user_access('administer nodes', $account)) {
+      return $access[$cid] = FALSE;
+    }
+
+    // There should be at least two revisions. If the vid of the given node
+    // and the vid of the default revision differ, then we already have two
+    // different revisions so there is no need for a separate database check.
+    // Also, if you try to revert to or delete the default revision, that's
+    // not good.
+    if ($node->isDefaultRevision() && (db_query('SELECT COUNT(*) FROM {node_field_revision} WHERE nid = :nid AND default_langcode = 1', array(':nid' => $node->id()))->fetchField() == 1 || $op == 'update' || $op == 'delete')) {
+      $access[$cid] = FALSE;
+    }
+    elseif (user_access('administer nodes', $account)) {
+      $access[$cid] = TRUE;
+    }
+    else {
+      // First check the access to the default revision and finally, if the
+      // node passed in is not the default revision then access to that, too.
+      $access[$cid] = node_access($op, node_load($node->id()), $account, $langcode) && ($node->isDefaultRevision() || node_access($op, $node, $account, $langcode));
+    }
+  }
+
+  return $access[$cid];
 }
 
 /**
@@ -1160,6 +1264,17 @@ function node_menu() {
     'type' => MENU_DEFAULT_LOCAL_TASK,
   );
 
+  $items['admin/reports/status/rebuild'] = array(
+    'title' => 'Rebuild permissions',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('node_configure_rebuild_confirm'),
+    // Any user than can potentially trigger a node_access_needs_rebuild(TRUE)
+    // has to be allowed access to the 'node access rebuild' confirm form.
+    'access arguments' => array('access administration pages'),
+    'type' => MENU_CALLBACK,
+    'file' => 'node.admin.inc',
+  );
+
   $items['admin/structure/types'] = array(
     'title' => 'Content types',
     'description' => 'Manage content types, including default status, front page promotion, comment settings, etc.',
@@ -1227,10 +1342,14 @@ function node_menu() {
   );
   $items['node/%node/delete'] = array(
     'title' => 'Delete',
-    'route_name' => 'node_delete_confirm',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('node_delete_confirm', 1),
+    'access callback' => 'node_access',
+    'access arguments' => array('delete', 1),
     'weight' => 10,
     'type' => MENU_LOCAL_TASK,
     'context' => MENU_CONTEXT_INLINE,
+    'file' => 'node.pages.inc',
   );
   $items['node/%node/revisions'] = array(
     'title' => 'Revisions',
@@ -1251,11 +1370,19 @@ function node_menu() {
   );
   $items['node/%node/revisions/%node_revision/revert'] = array(
     'title' => 'Revert to earlier revision',
-    'route_name' => 'node_revision_revert_confirm',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('node_revision_revert_confirm', 3),
+    'access callback' => '_node_revision_access',
+    'access arguments' => array(3, 'update'),
+    'file' => 'node.pages.inc',
   );
   $items['node/%node/revisions/%node_revision/delete'] = array(
     'title' => 'Delete earlier revision',
-    'route_name' => 'node_revision_delete_confirm',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('node_revision_delete_confirm', 3),
+    'access callback' => '_node_revision_access',
+    'access arguments' => array(3, 'delete'),
+    'file' => 'node.pages.inc',
   );
   return $items;
 }
@@ -1345,7 +1472,7 @@ function node_get_recent($number = 10) {
     // If the user is able to view their own unpublished nodes, allow them
     // to see these in addition to published nodes. Check that they actually
     // have some unpublished nodes to view before adding the condition.
-    if (user_access('view own unpublished content') && $own_unpublished = db_query('SELECT DISTINCT nid FROM {node_field_data} WHERE uid = :uid AND status = :status', array(':uid' => $GLOBALS['user']->id(), ':status' => NODE_NOT_PUBLISHED))->fetchCol()) {
+    if (user_access('view own unpublished content') && $own_unpublished = db_query('SELECT DISTINCT nid FROM {node_field_data} WHERE uid = :uid AND status = :status', array(':uid' => $GLOBALS['user']->uid, ':status' => NODE_NOT_PUBLISHED))->fetchCol()) {
       $query->condition(db_or()
         ->condition('n.status', NODE_PUBLISHED)
         ->condition('n.nid', $own_unpublished, 'IN')
@@ -2028,24 +2155,16 @@ function node_form_system_themes_admin_form_submit($form, &$form_state) {
  * @see node_menu()
  */
 function node_access($op, $node, $account = NULL, $langcode = NULL) {
-  $access_controller = Drupal::entityManager()->getAccessController('node');
-
-  if ($op == 'create') {
-    if (!$node instanceof EntityInterface) {
-      $bundle = $node;
-    }
-    elseif ($node instanceof NodeTypeInterface) {
-      $bundle = $node->id();
-    }
-    else {
-      $bundle = $node->bundle();
-    }
-    return $access_controller->createAccess($bundle, $account, array('langcode' => $langcode));
+  if (!$node instanceof EntityInterface) {
+    $node = entity_create('node', array('type' => $node));
+  }
+  elseif ($node instanceof NodeTypeInterface) {
+    $node = entity_create('node', array('type' => $node->id()));
   }
 
   // If no language code was provided, default to the node's langcode.
   if (empty($langcode)) {
-    $langcode = $node->language()->id;
+    $langcode = $node->langcode;
     // If the Language module is enabled, try to use the language from content
     // negotiation.
     if (module_exists('language')) {
@@ -2059,7 +2178,14 @@ function node_access($op, $node, $account = NULL, $langcode = NULL) {
       }
     }
   }
-  return $access_controller->access($node, $op, $langcode, $account);
+
+  // Make sure that if an account is passed, that it is a fully loaded user
+  // object.
+  if ($account && !($account instanceof UserInterface)) {
+    $account = user_load($account->uid);
+  }
+
+  return entity_access_controller('node')->access($node, $op, $langcode, $account);
 }
 
 /**
@@ -2075,13 +2201,13 @@ function node_node_access($node, $op, $account) {
     }
 
     if ($op == 'update') {
-      if (user_access('edit any ' . $type . ' content', $account) || (user_access('edit own ' . $type . ' content', $account) && ($account->id() == $node->getAuthorId()))) {
+      if (user_access('edit any ' . $type . ' content', $account) || (user_access('edit own ' . $type . ' content', $account) && ($account->uid == $node->getAuthorId()))) {
         return NODE_ACCESS_ALLOW;
       }
     }
 
     if ($op == 'delete') {
-      if (user_access('delete any ' . $type . ' content', $account) || (user_access('delete own ' . $type . ' content', $account) && ($account->id() == $node->getAuthorId()))) {
+      if (user_access('delete any ' . $type . ' content', $account) || (user_access('delete own ' . $type . ' content', $account) && ($account->uid == $node->getAuthorId()))) {
         return NODE_ACCESS_ALLOW;
       }
     }
@@ -2220,21 +2346,41 @@ function node_access_view_all_nodes($account = NULL) {
     $account = $user;
   }
 
-  // Statically cache results in an array keyed by $account->id().
+  // Statically cache results in an array keyed by $account->uid.
   $access = &drupal_static(__FUNCTION__);
-  if (isset($access[$account->id()])) {
-    return $access[$account->id()];
+  if (isset($access[$account->uid])) {
+    return $access[$account->uid];
   }
 
   // If no modules implement the node access system, access is always TRUE.
   if (!module_implements('node_grants')) {
-    $access[$account->id()] = TRUE;
+    $access[$account->uid] = TRUE;
   }
   else {
-    $access[$account->id()] = Drupal::entityManager()->getAccessController('node')->checkAllGrants($account);
+    $query = db_select('node_access');
+    $query->addExpression('COUNT(*)');
+    $query
+      ->condition('nid', 0)
+      ->condition('grant_view', 1, '>=');
+
+    $grants = db_or();
+    foreach (node_access_grants('view', $account) as $realm => $gids) {
+      foreach ($gids as $gid) {
+        $grants->condition(db_and()
+          ->condition('gid', $gid)
+          ->condition('realm', $realm)
+        );
+      }
+    }
+    if (count($grants) > 0 ) {
+      $query->condition($grants);
+    }
+    $access[$account->uid] = $query
+      ->execute()
+      ->fetchField();
   }
 
-  return $access[$account->id()];
+  return $access[$account->uid];
 }
 
 
@@ -2301,8 +2447,159 @@ function node_query_node_access_alter(AlterableInterface $query) {
     }
   }
 
-  // Update the query for the given storage method.
-  Drupal::service('node.grant_storage')->alterQuery($query, $tables, $op, $account, $base_table);
+  // Find all instances of the base table being joined -- could appear
+  // more than once in the query, and could be aliased. Join each one to
+  // the node_access table.
+  $grants = node_access_grants($op, $account);
+  $base_table_found = FALSE;
+  foreach ($tables as $nalias => $tableinfo) {
+    $table = $tableinfo['table'];
+    if (!($table instanceof SelectInterface) && $table == $base_table) {
+      $base_table_found = TRUE;
+      // Set the subquery.
+      $subquery = db_select('node_access', 'na')
+       ->fields('na', array('nid'));
+
+      $grant_conditions = db_or();
+      // If any grant exists for the specified user, then user has access to the
+      // node for the specified operation.
+      foreach ($grants as $realm => $gids) {
+        foreach ($gids as $gid) {
+          $grant_conditions->condition(db_and()
+            ->condition('na.gid', $gid)
+            ->condition('na.realm', $realm)
+          );
+        }
+      }
+
+      // Attach conditions to the subquery for nodes.
+      if (count($grant_conditions->conditions())) {
+        $subquery->condition($grant_conditions);
+      }
+      $subquery->condition('na.grant_' . $op, 1, '>=');
+
+      // Add langcode-based filtering if this is a multilingual site.
+      if (language_multilingual()) {
+        // If no specific langcode to check for is given, use the grant entry
+        // which is set as a fallback.
+        // If a specific langcode is given, use the grant entry for it.
+        if ($langcode === FALSE) {
+          $subquery->condition('na.fallback', 1, '=');
+        }
+        else {
+          $subquery->condition('na.langcode', $langcode, '=');
+        }
+      }
+
+      $field = 'nid';
+      // Now handle entities.
+      $subquery->where("$nalias.$field = na.nid");
+
+      $query->exists($subquery);
+    }
+  }
+
+  // If we reached this point and did not find the defined base table, throw
+  // an exception.
+  if (!$base_table_found) {
+    throw new Exception(t('Query tagged for node access but the defined base_table @base_table was not found', array('@base_table' => $base_table)));
+  }
+}
+
+/**
+ * Gets the list of node access grants and writes them to the database.
+ *
+ * This function is called when a node is saved, and can also be called by
+ * modules if something other than a node save causes node access permissions to
+ * change. It collects all node access grants for the node from
+ * hook_node_access_records() implementations, allows these grants to be altered
+ * via hook_node_access_records_alter() implementations, and saves the collected
+ * and altered grants to the database.
+ *
+ * @param \Drupal\node\NodeInterface $node
+ *   The $node to acquire grants for.
+ * @param $delete
+ *   (optional) Whether to delete existing node access records before inserting
+ *   new ones. Defaults to TRUE.
+ */
+function node_access_acquire_grants(NodeInterface $node, $delete = TRUE) {
+  $grants = module_invoke_all('node_access_records', $node);
+  // Let modules alter the grants.
+  drupal_alter('node_access_records', $grants, $node);
+  // If no grants are set and the node is published, then use the default grant.
+  if (empty($grants) && $node->isPublished()) {
+    $grants[] = array('realm' => 'all', 'gid' => 0, 'grant_view' => 1, 'grant_update' => 0, 'grant_delete' => 0);
+  }
+  _node_access_write_grants($node, $grants, NULL, $delete);
+}
+
+/**
+ * Writes a list of grants to the database, deleting any previously saved ones.
+ *
+ * If a realm is provided, it will only delete grants from that realm, but it
+ * will always delete a grant from the 'all' realm. Modules that utilize
+ * node_access() can use this function when doing mass updates due to widespread
+ * permission changes.
+ *
+ * Note: Don't call this function directly from a contributed module. Call
+ * node_access_acquire_grants() instead.
+ *
+ * @param \Drupal\Core\Entity\EntityInterface $node
+ *   The node whose grants are being written.
+ * @param $grants
+ *   A list of grants to write. See hook_node_access_records() for the
+ *   expected structure of the grants array.
+ * @param $realm
+ *   (optional) If provided, read/write grants for that realm only. Defaults to
+ *   NULL.
+ * @param $delete
+ *   (optional) If false, does not delete records. This is only for optimization
+ *   purposes, and assumes the caller has already performed a mass delete of
+ *   some form. Defaults to TRUE.
+ *
+ * @see node_access_acquire_grants()
+ */
+function _node_access_write_grants(EntityInterface $node, $grants, $realm = NULL, $delete = TRUE) {
+  if ($delete) {
+    $query = db_delete('node_access')->condition('nid', $node->id());
+    if ($realm) {
+      $query->condition('realm', array($realm, 'all'), 'IN');
+    }
+    $query->execute();
+  }
+  // Only perform work when node_access modules are active.
+  if (!empty($grants) && count(module_implements('node_grants'))) {
+    $query = db_insert('node_access')->fields(array('nid', 'langcode', 'fallback', 'realm', 'gid', 'grant_view', 'grant_update', 'grant_delete'));
+    // If we have defined a granted langcode, use it. But if not, add a grant
+    // for every language this node is translated to.
+    foreach ($grants as $grant) {
+      if ($realm && $realm != $grant['realm']) {
+        continue;
+      }
+      if (isset($grant['langcode'])) {
+        $grant_languages = array($grant['langcode'] => language_load($grant['langcode']));
+      }
+      else {
+        $grant_languages = $node->getTranslationLanguages(TRUE);
+      }
+      foreach ($grant_languages as $grant_langcode => $grant_language) {
+        // Only write grants; denies are implicit.
+        if ($grant['grant_view'] || $grant['grant_update'] || $grant['grant_delete']) {
+          $grant['nid'] = $node->id();
+          $grant['langcode'] = $grant_langcode;
+          // The record with the original langcode is used as the fallback.
+          if ($grant['langcode'] == $node->langcode) {
+            $grant['fallback'] = 1;
+          }
+          else {
+            $grant['fallback'] = 0;
+          }
+          $query->values($grant);
+        }
+      }
+    }
+    $query->execute();
+  }
 }
 
 /**
@@ -2360,8 +2657,7 @@ function node_access_needs_rebuild($rebuild = NULL) {
  * @see node_access_needs_rebuild()
  */
 function node_access_rebuild($batch_mode = FALSE) {
-  $access_controller = Drupal::entityManager()->getAccessController('node');
-  $access_controller->deleteGrants();
+  db_delete('node_access')->execute();
   // Only recalculate if the site is using a node_access module.
   if (count(module_implements('node_grants'))) {
     if ($batch_mode) {
@@ -2379,22 +2675,29 @@ function node_access_rebuild($batch_mode = FALSE) {
       drupal_set_time_limit(240);
 
       // Rebuild newest nodes first so that recent content becomes available quickly.
-      $entity_query = Drupal::entityQuery('node');
-      $entity_query->sort('nid', 'DESC');
-      $nids = $entity_query->execute();
+      $nids = db_query("SELECT nid FROM {node} ORDER BY nid DESC")->fetchCol();
       foreach ($nids as $nid) {
         $node = node_load($nid, TRUE);
-        // To preserve database integrity, only write grants if the node
+        // To preserve database integrity, only acquire grants if the node
         // loads successfully.
         if (!empty($node)) {
-          $access_controller->writeGrants($node);
+          node_access_acquire_grants($node);
         }
       }
     }
   }
   else {
     // Not using any node_access modules. Add the default grant.
-    $access_controller->writeDefaultGrant();
+    db_insert('node_access')
+      ->fields(array(
+        'nid' => 0,
+        'realm' => 'all',
+        'gid' => 0,
+        'grant_view' => 1,
+        'grant_update' => 0,
+        'grant_delete' => 0,
+      ))
+      ->execute();
   }
 
   if (!isset($batch)) {
@@ -2419,22 +2722,18 @@ function _node_access_rebuild_batch_operation(&$context) {
     // Initiate multistep processing.
     $context['sandbox']['progress'] = 0;
     $context['sandbox']['current_node'] = 0;
-    $context['sandbox']['max'] = Drupal::entityQuery('node')->count()->execute();
+    $context['sandbox']['max'] = db_query('SELECT COUNT(DISTINCT nid) FROM {node}')->fetchField();
   }
 
   // Process the next 20 nodes.
   $limit = 20;
-  $nids = Drupal::entityQuery('node')
-    ->condition('nid', $context['sandbox']['current_node'], '>')
-    ->sort('nid', 'DESC')
-    ->range(0, $limit)
-    ->execute();
+  $nids = db_query_range("SELECT nid FROM {node} WHERE nid > :nid ORDER BY nid ASC", 0, $limit, array(':nid' => $context['sandbox']['current_node']))->fetchCol();
   $nodes = node_load_multiple($nids, TRUE);
   foreach ($nodes as $nid => $node) {
-    // To preserve database integrity, only write grants if the node
+    // To preserve database integrity, only acquire grants if the node
     // loads successfully.
     if (!empty($node)) {
-      Drupal::entityManager()->getAccessController('node')->writeGrants($node);
+      node_access_acquire_grants($node);
     }
     $context['sandbox']['progress']++;
     $context['sandbox']['current_node'] = $nid;
@@ -2480,7 +2779,7 @@ function node_requirements($phase) {
     // Only show rebuild button if there are either 0, or 2 or more, rows
     // in the {node_access} table, or if there are modules that
     // implement hook_node_grants().
-    $grant_count = Drupal::entityManager()->getAccessController('node')->countGrants();
+    $grant_count = db_query('SELECT COUNT(*) FROM {node_access}')->fetchField();
     if ($grant_count != 1 || count(module_implements('node_grants')) > 0) {
       $value = format_plural($grant_count, 'One permission in use', '@count permissions in use', array('@count' => $grant_count));
     }
diff --git a/core/modules/node/node.pages.inc b/core/modules/node/node.pages.inc
index 7dff75d..af8e1e7 100644
--- a/core/modules/node/node.pages.inc
+++ b/core/modules/node/node.pages.inc
@@ -87,7 +87,7 @@ function node_add($node_type) {
   $type = $node_type->type;
   $langcode = module_invoke('language', 'get_default_langcode', 'node', $type);
   $node = entity_create('node', array(
-    'uid' => $user->id(),
+    'uid' => $user->uid,
     'name' => (isset($user->name) ? $user->name : ''),
     'type' => $type,
     'langcode' => $langcode ? $langcode : language_default()->id,
@@ -114,7 +114,7 @@ function node_preview(EntityInterface $node) {
       // The use of isset() is mandatory in the context of user IDs, because
       // user ID 0 denotes the anonymous user.
       if ($user = user_load_by_name($node->name)) {
-        $node->uid = $user->id();
+        $node->uid = $user->uid;
       }
       else {
         $node->uid = 0; // anonymous user
@@ -181,6 +181,44 @@ function theme_node_preview($variables) {
 }
 
 /**
+ * Page callback: Form constructor for node deletion confirmation form.
+ *
+ * @param object $node
+ *   A node object.
+ *
+ * @return array
+ *   A form array.
+ *
+ * @see node_delete_confirm_submit()
+ * @see node_menu()
+ */
+function node_delete_confirm($form, &$form_state, $node) {
+  // Always provide entity id in the same form key as in the entity edit form.
+  $form['nid'] = array('#type' => 'value', '#value' => $node->nid);
+  return confirm_form($form,
+    t('Are you sure you want to delete %title?', array('%title' => $node->label())),
+    'node/' . $node->nid,
+    t('This action cannot be undone.'),
+    t('Delete'),
+    t('Cancel')
+  );
+}
+
+/**
+ * Form submission handler for node_delete_confirm().
+ */
+function node_delete_confirm_submit($form, &$form_state) {
+  if ($form_state['values']['confirm']) {
+    $node = node_load($form_state['values']['nid']);
+    $node->delete();
+    watchdog('content', '@type: deleted %title.', array('@type' => $node->type, '%title' => $node->label()));
+    drupal_set_message(t('@type %title has been deleted.', array('@type' => node_get_type_label($node), '%title' => $node->label())));
+  }
+
+  $form_state['redirect'] = '<front>';
+}
+
+/**
  * Page callback: Generates an overview table of older revisions of a node.
  *
  * @param object $node
@@ -215,7 +253,7 @@ function node_revision_overview($node) {
     if ($revision->current_vid > 0) {
       $username = array(
         '#theme' => 'username',
-        '#account' => user_load($revision->uid),
+        '#account' => $revision,
       );
       $row[] = array('data' => t('!date by !username', array('!date' => l(format_date($revision->revision_timestamp, 'short'), "node/$node->nid"), '!username' => drupal_render($username)))
                                . (($revision->log != '') ? '<p class="revision-log">' . filter_xss($revision->log) . '</p>' : ''),
@@ -225,7 +263,7 @@ function node_revision_overview($node) {
     else {
       $username = array(
         '#theme' => 'username',
-        '#account' => user_load($revision->uid),
+        '#account' => $revision,
       );
       $row[] = t('!date by !username', array('!date' => l(format_date($revision->revision_timestamp, 'short'), "node/$node->nid/revisions/$revision->vid/view"), '!username' => drupal_render($username)))
                . (($revision->log != '') ? '<p class="revision-log">' . filter_xss($revision->log) . '</p>' : '');
@@ -262,3 +300,80 @@ function node_revision_overview($node) {
 
   return $build;
 }
+
+/**
+ * Page callback: Form constructor for the reversion confirmation form.
+ *
+ * This form prevents against CSRF attacks.
+ *
+ * @param int $node_revision
+ *   The node revision ID.
+ *
+ * @return array
+ *   An array as expected by drupal_render().
+ *
+ * @see node_menu()
+ * @see node_revision_revert_confirm_submit()
+ * @ingroup forms
+ */
+function node_revision_revert_confirm($form, $form_state, $node_revision) {
+  $form['#node_revision'] = $node_revision;
+  return confirm_form($form, t('Are you sure you want to revert to the revision from %revision-date?', array('%revision-date' => format_date($node_revision->revision_timestamp))), 'node/' . $node_revision->nid . '/revisions', '', t('Revert'), t('Cancel'));
+}
+
+/**
+ * Form submission handler for node_revision_revert_confirm().
+ */
+function node_revision_revert_confirm_submit($form, &$form_state) {
+  $node_revision = $form['#node_revision'];
+  $node_revision->setNewRevision();
+  // Make this the new default revision for the node.
+  $node_revision->isDefaultRevision(TRUE);
+
+  // The revision timestamp will be updated when the revision is saved. Keep the
+  // original one for the confirmation message.
+  $original_revision_timestamp = $node_revision->revision_timestamp;
+
+  $node_revision->log = t('Copy of the revision from %date.', array('%date' => format_date($original_revision_timestamp)));
+
+  $node_revision->save();
+
+  watchdog('content', '@type: reverted %title revision %revision.', array('@type' => $node_revision->type, '%title' => $node_revision->label(), '%revision' => $node_revision->vid));
+  drupal_set_message(t('@type %title has been reverted back to the revision from %revision-date.', array('@type' => node_get_type_label($node_revision), '%title' => $node_revision->label(), '%revision-date' => format_date($original_revision_timestamp))));
+  $form_state['redirect'] = 'node/' . $node_revision->nid . '/revisions';
+}
+
+/**
+ * Page callback: Form constructor for the revision deletion confirmation form.
+ *
+ * This form prevents against CSRF attacks.
+ *
+ * @param $node_revision
+ *   The node revision ID.
+ *
+ * @return
+ *   An array as expected by drupal_render().
+ *
+ * @see node_menu()
+ * @see node_revision_delete_confirm_submit()
+ * @ingroup forms
+ */
+function node_revision_delete_confirm($form, $form_state, $node_revision) {
+  $form['#node_revision'] = $node_revision;
+  return confirm_form($form, t('Are you sure you want to delete the revision from %revision-date?', array('%revision-date' => format_date($node_revision->revision_timestamp))), 'node/' . $node_revision->nid . '/revisions', t('This action cannot be undone.'), t('Delete'), t('Cancel'));
+}
+
+/**
+ * Form submission handler for node_revision_delete_confirm().
+ */
+function node_revision_delete_confirm_submit($form, &$form_state) {
+  $node_revision = $form['#node_revision'];
+  node_revision_delete($node_revision->vid);
+
+  watchdog('content', '@type: deleted %title revision %revision.', array('@type' => $node_revision->type, '%title' => $node_revision->label(), '%revision' => $node_revision->vid));
+  drupal_set_message(t('Revision from %revision-date of @type %title has been deleted.', array('%revision-date' => format_date($node_revision->revision_timestamp), '@type' => node_get_type_label($node_revision), '%title' => $node_revision->label())));
+  $form_state['redirect'] = 'node/' . $node_revision->nid;
+  if (db_query('SELECT COUNT(DISTINCT vid) FROM {node_field_revision} WHERE nid = :nid', array(':nid' => $node_revision->nid))->fetchField() > 1) {
+    $form_state['redirect'] .= '/revisions';
+  }
+}
diff --git a/core/modules/node/node.routing.yml b/core/modules/node/node.routing.yml
index dfdc0a6..9204a2b 100644
--- a/core/modules/node/node.routing.yml
+++ b/core/modules/node/node.routing.yml
@@ -12,27 +12,6 @@ node_page_edit:
   requirements:
     _entity_access: 'node.update'
 
-node_delete_confirm:
-  pattern: '/node/{node}/delete'
-  defaults:
-    _entity_form: 'node.delete'
-  requirements:
-    _entity_access: 'node.delete'
-
-node_revision_revert_confirm:
-  pattern: '/node/{node}/revisions/{node_revision}/revert'
-  defaults:
-    _form: '\Drupal\node\Form\NodeRevisionRevertForm'
-  requirements:
-    _access_node_revision: 'update'
-
-node_revision_delete_confirm:
-  pattern: '/node/{node}/revisions/{node_revision}/delete'
-  defaults:
-    _form: '\Drupal\node\Form\NodeRevisionDeleteForm'
-  requirements:
-    _access_node_revision: 'delete'
-
 node_overview_types:
   pattern: '/admin/structure/types'
   defaults:
@@ -68,10 +47,3 @@ node_type_delete_confirm:
     _entity_form: 'node_type.delete'
   requirements:
     _entity_access: 'node_type.delete'
-
-node_configure_rebuild_confirm:
-  pattern: '/admin/reports/status/rebuild'
-  defaults:
-    _form: 'Drupal\node\Form\RebuildPermissionsForm'
-  requirements:
-    _permission: 'access administration pages'
diff --git a/core/modules/node/node.services.yml b/core/modules/node/node.services.yml
deleted file mode 100644
index ab49617..0000000
--- a/core/modules/node/node.services.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-services:
-  node.grant_storage:
-    class: Drupal\node\NodeGrantDatabaseStorage
-    arguments: ['@database', '@module_handler']
-  access_check.node.revision:
-    class: Drupal\node\Access\NodeRevisionAccessCheck
-    arguments: ['@plugin.manager.entity', '@database']
-    tags:
-      - { name: access_check }
diff --git a/core/modules/node/node.views.inc b/core/modules/node/node.views.inc
index b2d00a6..519fc21 100644
--- a/core/modules/node/node.views.inc
+++ b/core/modules/node/node.views.inc
@@ -622,21 +622,21 @@ function node_views_data() {
 /**
  * Implements hook_preprocess_node().
  */
-function node_row_node_view_preprocess_node(&$variables) {
-  $node = $variables['node'];
-  $options = $variables['view']->rowPlugin->options;
+function node_row_node_view_preprocess_node(&$vars) {
+  $node = $vars['node'];
+  $options = $vars['view']->rowPlugin->options;
 
   // Prevent the comment form from showing up if this is not a page display.
-  if ($variables['view_mode'] == 'full' && !$variables['view']->display_handler->hasPath()) {
+  if ($vars['view_mode'] == 'full' && !$vars['view']->display_handler->hasPath()) {
     $node->comment = FALSE;
   }
 
   if (!$options['links']) {
-    unset($variables['content']['links']);
+    unset($vars['content']['links']);
   }
 
   if (!empty($options['comments']) && user_access('access comments') && $node->comment) {
-    $variables['content']['comments'] = comment_node_page_additions($node);
+    $vars['content']['comments'] = comment_node_page_additions($node);
   }
 }
 
diff --git a/core/modules/node/tests/modules/node_access_test/node_access_test.module b/core/modules/node/tests/modules/node_access_test/node_access_test.module
index 6a9492c..8299456 100644
--- a/core/modules/node/tests/modules/node_access_test/node_access_test.module
+++ b/core/modules/node/tests/modules/node_access_test/node_access_test.module
@@ -17,13 +17,13 @@
 function node_access_test_node_grants($account, $op) {
   $grants = array();
   // First grant a grant to the author for own content.
-  $grants['node_access_test_author'] = array($account->id());
+  $grants['node_access_test_author'] = array($account->uid);
   if ($op == 'view' && user_access('node test view', $account)) {
     $grants['node_access_test'] = array(8888, 8889);
   }
 
   $no_access_uid = Drupal::state()->get('node_access_test.no_access_uid') ?: 0;
-  if ($op == 'view' && $account->id() == $no_access_uid) {
+  if ($op == 'view' && $account->uid == $no_access_uid) {
     $grants['node_access_all'] = array(0);
   }
   return $grants;
diff --git a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_field_type.yml b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_field_type.yml
index e6382e4..317ed91 100644
--- a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_field_type.yml
+++ b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_field_type.yml
@@ -10,7 +10,6 @@ display:
           field: type
           id: type
           table: node_field_data
-          provider: node
     display_plugin: default
     display_title: Master
     id: default
diff --git a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_filter_node_uid_revision.yml b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_filter_node_uid_revision.yml
index 2c0122b..f309a1b 100644
--- a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_filter_node_uid_revision.yml
+++ b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_filter_node_uid_revision.yml
@@ -17,7 +17,6 @@ display:
           table: node
           field: nid
           plugin_id: node
-          provider: node
       filter_groups:
         groups:
           1: AND
@@ -34,7 +33,6 @@ display:
           value:
             - '1'
           plugin_id: node_uid_revision
-          provider: node
       sorts: {  }
       pager:
         type: full
diff --git a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_bulk_form.yml b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_bulk_form.yml
index e0748bc..f5d998e 100644
--- a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_bulk_form.yml
+++ b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_bulk_form.yml
@@ -20,13 +20,11 @@ display:
           table: node
           field: node_bulk_form
           plugin_id: node_bulk_form
-          provider: node
         title:
           id: title
           table: node_field_data
           field: title
           plugin_id: node
-          provider: node
       sorts:
         nid:
           id: nid
@@ -34,7 +32,6 @@ display:
           field: nid
           order: ASC
           plugin_id: standard
-          provider: views
   page_1:
     display_plugin: page
     id: page_1
diff --git a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_revision_nid.yml b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_revision_nid.yml
index c4e06a3..09c8eab 100644
--- a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_revision_nid.yml
+++ b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_revision_nid.yml
@@ -11,34 +11,29 @@ display:
           field: nid
           required: true
           plugin_id: standard
-          provider: views
       fields:
         vid:
           id: vid
           table: node_field_revision
           field: vid
           plugin_id: standard
-          provider: views
         nid_1:
           id: nid_1
           table: node_field_revision
           field: nid
           plugin_id: standard
-          provider: views
         nid:
           id: nid
           table: node
           field: nid
           relationship: nid
           plugin_id: node
-          provider: node
       arguments:
         nid:
           id: nid
           table: node_field_revision
           field: nid
           plugin_id: node_nid
-          provider: node
     display_plugin: default
     display_title: Master
     id: default
diff --git a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_revision_vid.yml b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_revision_vid.yml
index 38664e1..553bfd2 100644
--- a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_revision_vid.yml
+++ b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_revision_vid.yml
@@ -11,34 +11,29 @@ display:
           field: vid
           required: true
           plugin_id: standard
-          provider: views
       fields:
         vid:
           id: vid
           table: node_field_revision
           field: vid
           plugin_id: standard
-          provider: views
         nid_1:
           id: nid_1
           table: node_field_revision
           field: nid
           plugin_id: standard
-          provider: views
         nid:
           id: nid
           table: node
           field: nid
           relationship: vid
           plugin_id: node
-          provider: node
       arguments:
         nid:
           id: nid
           table: node_field_revision
           field: nid
           plugin_id: node_nid
-          provider: node
     display_plugin: default
     display_title: Master
     id: default
diff --git a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_row_plugin.yml b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_row_plugin.yml
index e7bae25..814a7d1 100644
--- a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_row_plugin.yml
+++ b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_row_plugin.yml
@@ -22,7 +22,6 @@ display:
           table: node
           value: '1'
           plugin_id: boolean
-          provider: views
       pager:
         options:
           items_per_page: '10'
diff --git a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_view.yml b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_view.yml
index 5b734dd..e56c2d9 100644
--- a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_view.yml
+++ b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_view.yml
@@ -118,7 +118,6 @@ display:
           hide_alter_empty: '1'
           link_to_node: '0'
           plugin_id: node
-          provider: node
       filters:
         status:
           value: '1'
@@ -128,7 +127,6 @@ display:
           expose:
             operator: '0'
           group: '1'
-          provider: views
       sorts:
         created:
           id: created
@@ -142,7 +140,6 @@ display:
           expose:
             label: ''
           granularity: second
-          provider: views
       title: test_node_view
       header: {  }
       footer: {  }
@@ -190,7 +187,6 @@ display:
           transform_dash: '0'
           break_phrase: '0'
           plugin_id: node_type
-          provider: node
 label: test_node_view
 module: views
 id: test_node_view
diff --git a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_status_extra.yml b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_status_extra.yml
index 1944f59..094f8d4 100644
--- a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_status_extra.yml
+++ b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_status_extra.yml
@@ -76,7 +76,6 @@ display:
           hide_alter_empty: '1'
           link_to_node: '0'
           plugin_id: node
-          provider: node
       filters:
         status_extra:
           id: status_extra
@@ -114,7 +113,6 @@ display:
             default_group_multiple: {  }
             group_items: {  }
           plugin_id: node_status
-          provider: node
       sorts:
         nid:
           id: nid
@@ -122,18 +120,17 @@ display:
           field: nid
           order: ASC
           plugin_id: standard
-          provider: views
       filter_groups:
         operator: AND
         groups:
           1: AND
   page_1:
-    display_options:
-      path: test_status_extra
-    display_plugin: page
-    display_title: Page
-    id: page_1
-    position: '0'
+      display_options:
+        path: test_status_extra
+      display_plugin: page
+      display_title: Page
+      id: page_1
+      position: '0'
 base_field: nid
 status: '1'
 module: views
diff --git a/core/modules/overlay/lib/Drupal/overlay/Access/DismissMessageAccessCheck.php b/core/modules/overlay/lib/Drupal/overlay/Access/DismissMessageAccessCheck.php
deleted file mode 100644
index 3c74bab..0000000
--- a/core/modules/overlay/lib/Drupal/overlay/Access/DismissMessageAccessCheck.php
+++ /dev/null
@@ -1,43 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\overlay\Access\DismissMessageAccessCheck
- */
-
-namespace Drupal\overlay\Access;
-
-use Drupal\Core\Access\AccessCheckInterface;
-use Symfony\Component\Routing\Route;
-use Symfony\Component\HttpFoundation\Request;
-
-/**
- * Provides an access check for overlay user dismiss message routes.
- */
-class DismissMessageAccessCheck implements AccessCheckInterface {
-
-  /**
-   * {@inheritdoc}
-   */
-  public function applies(Route $route) {
-    return array_key_exists('_access_overlay_dismiss_message', $route->getRequirements());
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function access(Route $route, Request $request) {
-    $account = $request->attributes->get('account');
-    if (!user_access('access overlay', $account)) {
-      return static::DENY;
-    }
-    // It's unlikely, but possible that "access overlay" permission is granted
-    // to the anonymous role. In this case, we do not display the message to
-    // disable the overlay, so there is nothing to dismiss.
-    if (!$account->id()) {
-      return static::DENY;
-    }
-    return static::ALLOW;
-  }
-
-}
diff --git a/core/modules/overlay/lib/Drupal/overlay/Controller/OverlayController.php b/core/modules/overlay/lib/Drupal/overlay/Controller/OverlayController.php
deleted file mode 100644
index b834768..0000000
--- a/core/modules/overlay/lib/Drupal/overlay/Controller/OverlayController.php
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\overlay\Controller\OverlayController.
- */
-
-namespace Drupal\overlay\Controller;
-
-use Symfony\Component\HttpFoundation\Request;
-use Symfony\Component\HttpFoundation\RedirectResponse;
-use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
-
-/**
- * Controller routines for overlay routes.
- */
-class OverlayController {
-
-  /**
-   * Dismisses the overlay accessibility message for this user.
-   *
-   * @param \Symfony\Component\HttpFoundation\Request $request
-   *   The request object.
-   * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
-   *   Thrown when a non valid token was specified.
-   * @return \Symfony\Component\HttpFoundation\RedirectResponse
-   *   Redirects to the user's edit page.
-   *
-   */
-  public function overlayMessage(Request $request) {
-    $account = $request->attributes->get('account');
-
-    // @todo Integrate CSRF link token directly into routing system: http://drupal.org/node/1798296.
-    $token = $request->attributes->get('token');
-    if (!isset($token) || !drupal_valid_token($token, 'overlay')) {
-      throw new AccessDeniedHttpException();
-    }
-    $request->attributes->get('user.data')->set('overlay', $account->id(), 'message_dismissed', 1);
-    drupal_set_message(t('The message has been dismissed. You can change your overlay settings at any time by visiting your profile page.'));
-    // Destination is normally given. Go to the user profile as a fallback.
-    return new RedirectResponse(url('user/' . $account->id() . '/edit', array('absolute' => TRUE)));
-  }
-
-}
diff --git a/core/modules/overlay/lib/Drupal/overlay/EventSubscriber/OverlaySubscriber.php b/core/modules/overlay/lib/Drupal/overlay/EventSubscriber/OverlaySubscriber.php
index 86ed1d0..18d9086 100644
--- a/core/modules/overlay/lib/Drupal/overlay/EventSubscriber/OverlaySubscriber.php
+++ b/core/modules/overlay/lib/Drupal/overlay/EventSubscriber/OverlaySubscriber.php
@@ -78,7 +78,7 @@ public function onRequest(GetResponseEvent $event) {
 
     // Only act if the user has access to the overlay and a mode was not already
     // set. Other modules can also enable the overlay directly for other uses.
-    $user_data = $this->userData->get('overlay', $user->id(), 'enabled');
+    $user_data = $this->userData->get('overlay', $user->uid, 'enabled');
     $use_overlay = !isset($user_data) || $user_data;
     if (empty($mode) && user_access('access overlay') && $use_overlay) {
       $current_path = $request->attributes->get('system_path');
diff --git a/core/modules/overlay/overlay.module b/core/modules/overlay/overlay.module
index 3e6f989..40a0c76 100644
--- a/core/modules/overlay/overlay.module
+++ b/core/modules/overlay/overlay.module
@@ -35,6 +35,12 @@ function overlay_menu() {
     'access arguments' => array('access overlay'),
     'type' => MENU_CALLBACK,
   );
+  $items['overlay/dismiss-message'] = array(
+    'title' => '',
+    'page callback' => 'overlay_user_dismiss_message',
+    'access callback' => 'overlay_user_dismiss_message_access',
+    'type' => MENU_CALLBACK,
+  );
   return $items;
 }
 
@@ -214,6 +220,56 @@ function overlay_page_alter(&$page) {
 }
 
 /**
+ * Access callback: Determines access to dismiss the accessibility message.
+ *
+ * @return
+ *   TRUE if the user has permission to dismiss the accessibility message or if
+ *   the user is anonymous. FALSE if otherwise.
+ *
+ * @see overlay_user_dismiss_message()
+ * @see overlay_menu()
+ */
+function overlay_user_dismiss_message_access() {
+  global $user;
+  if (!user_access('access overlay')) {
+    return FALSE;
+  }
+  // It's unlikely, but possible that "access overlay" permission is granted to
+  // the anonymous role. In this case, we do not display the message to disable
+  // the overlay, so there is nothing to dismiss.
+  if (empty($user->uid)) {
+    return FALSE;
+  }
+  return TRUE;
+}
+
+/**
+ * Page callback: Dismisses the overlay accessibility message for this user.
+ *
+ * @return
+ *   A render array for a page containing a list of content.
+ *
+ * @see overlay_user_dismiss_message_access()
+ * @see overlay_menu()
+ */
+function overlay_user_dismiss_message() {
+  global $user;
+
+  // @todo CSRF tokens are validated in page callbacks rather than access
+  //   callbacks, because access callbacks are also invoked during menu link
+  //   generation. Add token support to routing: http://drupal.org/node/755584.
+  $token = Drupal::request()->query->get('token');
+  if (!isset($token) || !drupal_valid_token($token, 'overlay')) {
+    throw new AccessDeniedHttpException();
+  }
+
+  Drupal::service('user.data')->set('overlay', $user->uid, 'message_dismissed', 1);
+  drupal_set_message(t('The message has been dismissed. You can change your overlay settings at any time by visiting your profile page.'));
+  // Destination is normally given. Go to the user profile as a fallback.
+  return new RedirectResponse(url('user/' . $user->uid . '/edit', array('absolute' => TRUE)));
+}
+
+/**
  * Returns a renderable array representing a message for disabling the overlay.
  *
  * If the current user can access the overlay and has not previously indicated
@@ -230,11 +286,11 @@ function overlay_disable_message() {
   global $user;
 
   $build = array();
-  if ($user->isAnonymous() || !user_access('access overlay')) {
+  if (empty($user->uid) || !user_access('access overlay')) {
     return $build;
   }
 
-  $user_data = Drupal::service('user.data')->get('overlay', $user->id());
+  $user_data = Drupal::service('user.data')->get('overlay', $user->uid);
   if (empty($user_data['message_dismissed']) && (!isset($user_data['enabled']) || $user_data['enabled'])) {
     $build = array(
       '#theme' => 'overlay_disable_message',
@@ -243,7 +299,7 @@ function overlay_disable_message() {
       'profile_link' => array(
         '#type' => 'link',
         '#title' => t('If you have problems accessing administrative pages on this site, disable the overlay on your profile page.'),
-        '#href' => 'user/' . $user->id() . '/edit',
+        '#href' => 'user/' . $user->uid . '/edit',
         '#options' => array(
           'query' => drupal_get_destination(),
           'fragment' => 'edit-overlay-control',
diff --git a/core/modules/overlay/overlay.routing.yml b/core/modules/overlay/overlay.routing.yml
deleted file mode 100644
index 9f22f56..0000000
--- a/core/modules/overlay/overlay.routing.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-overlay_message:
-  pattern: '/overlay/dismiss-message'
-  defaults:
-    _controller: '\Drupal\overlay\Controller\OverlayController::overlayMessage'
-  requirements:
-    _access_overlay_dismiss_message: 'TRUE'
-
diff --git a/core/modules/overlay/overlay.services.yml b/core/modules/overlay/overlay.services.yml
index aed4378..b15e6cd 100644
--- a/core/modules/overlay/overlay.services.yml
+++ b/core/modules/overlay/overlay.services.yml
@@ -4,8 +4,3 @@ services:
     tags:
       - { name: event_subscriber }
     arguments: ['@content_negotiation', '@user.data', '@url_generator']
-
-  access_check.overlay.dismiss_message:
-    class: Drupal\overlay\Access\DismissMessageAccessCheck
-    tags:
-      - { name: access_check }
diff --git a/core/modules/path/lib/Drupal/path/Tests/PathLanguageTest.php b/core/modules/path/lib/Drupal/path/Tests/PathLanguageTest.php
index 4e37019..291b633 100644
--- a/core/modules/path/lib/Drupal/path/Tests/PathLanguageTest.php
+++ b/core/modules/path/lib/Drupal/path/Tests/PathLanguageTest.php
@@ -115,7 +115,7 @@ function testAliasTranslation() {
 
     // Change user language preference.
     $edit = array('preferred_langcode' => 'fr');
-    $this->drupalPost("user/" . $this->web_user->id() . "/edit", $edit, t('Save'));
+    $this->drupalPost("user/{$this->web_user->uid}/edit", $edit, t('Save'));
 
     // Check that the English alias works. In this situation French is the
     // current UI and content language, while URL language is English (since we
diff --git a/core/modules/php/lib/Drupal/php/Plugin/Filter/Php.php b/core/modules/php/lib/Drupal/php/Plugin/Filter/Php.php
index 88353ba..dd58116 100644
--- a/core/modules/php/lib/Drupal/php/Plugin/Filter/Php.php
+++ b/core/modules/php/lib/Drupal/php/Plugin/Filter/Php.php
@@ -58,7 +58,7 @@ public function tips($long = FALSE) {
       $output .= '<li>' . t('<p>To display the name of a registered user, use this instead:</p>
   <pre>
   global $user;
-  if ($user->isAuthenticated()) {
+  if ($user->uid) {
     print t(\'Welcome @name! Thank you for visiting.\', array(\'@name\' => user_format_name($user)));
   }
   else {
diff --git a/core/modules/picture/lib/Drupal/picture/PictureMappingAccessController.php b/core/modules/picture/lib/Drupal/picture/PictureMappingAccessController.php
index 2696100..5ee0ade 100644
--- a/core/modules/picture/lib/Drupal/picture/PictureMappingAccessController.php
+++ b/core/modules/picture/lib/Drupal/picture/PictureMappingAccessController.php
@@ -23,16 +23,9 @@ protected function checkAccess(EntityInterface $entity, $operation, $langcode, A
     if ($operation === 'view') {
       return TRUE;
     }
-    elseif (in_array($operation, array('update', 'delete'))) {
+    elseif (in_array($operation, array('create', 'update', 'delete'))) {
       return user_access('administer pictures', $account);
     }
   }
 
-  /**
-   * {@inheritdoc}
-   */
-  protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) {
-    return user_access('administer pictures', $account);
-  }
-
 }
diff --git a/core/modules/picture/lib/Drupal/picture/PictureMappingFormController.php b/core/modules/picture/lib/Drupal/picture/PictureMappingFormController.php
index 3c3ce34..4b93dc5 100644
--- a/core/modules/picture/lib/Drupal/picture/PictureMappingFormController.php
+++ b/core/modules/picture/lib/Drupal/picture/PictureMappingFormController.php
@@ -144,7 +144,7 @@ public function save(array $form, array &$form_state) {
     // another breakpoint group.
     if (!$picture_mapping->hasMappings()) {
       $uri = $picture_mapping->uri();
-      $form_state['redirect'] = $uri['path'];
+      $form_state['redirect'] = $uri['path'] . '/edit';
     }
     else {
       $form_state['redirect'] = 'admin/config/media/picturemapping';
diff --git a/core/modules/picture/lib/Drupal/picture/Tests/PictureAdminUITest.php b/core/modules/picture/lib/Drupal/picture/Tests/PictureAdminUITest.php
index e61cac6..114e30c 100644
--- a/core/modules/picture/lib/Drupal/picture/Tests/PictureAdminUITest.php
+++ b/core/modules/picture/lib/Drupal/picture/Tests/PictureAdminUITest.php
@@ -102,7 +102,7 @@ public function testPictureAdmin() {
     $this->assertText('mapping_one');
 
     // Edit the group.
-    $this->drupalGet('admin/config/media/picturemapping/mapping_one');
+    $this->drupalGet('admin/config/media/picturemapping/mapping_one/edit');
     $this->assertFieldByName('label', 'Mapping One');
     $this->assertFieldByName('breakpointGroup', 'atestset');
 
@@ -122,8 +122,8 @@ public function testPictureAdmin() {
       'mappings[custom.user.medium][1x]' => 'medium',
       'mappings[custom.user.large][1x]' => 'large',
     );
-    $this->drupalPost('admin/config/media/picturemapping/mapping_one', $edit, t('Save'));
-    $this->drupalGet('admin/config/media/picturemapping/mapping_one');
+    $this->drupalPost('admin/config/media/picturemapping/mapping_one/edit', $edit, t('Save'));
+    $this->drupalGet('admin/config/media/picturemapping/mapping_one/edit');
     $this->assertFieldByName('mappings[custom.user.small][1x]', 'thumbnail');
     $this->assertFieldByName('mappings[custom.user.small][2x]', '');
     $this->assertFieldByName('mappings[custom.user.medium][1x]', 'medium');
diff --git a/core/modules/picture/lib/Drupal/picture/Tests/PictureFieldDisplayTest.php b/core/modules/picture/lib/Drupal/picture/Tests/PictureFieldDisplayTest.php
index 8009241..b79ad21 100644
--- a/core/modules/picture/lib/Drupal/picture/Tests/PictureFieldDisplayTest.php
+++ b/core/modules/picture/lib/Drupal/picture/Tests/PictureFieldDisplayTest.php
@@ -182,8 +182,7 @@ public function _testPictureFieldFormatters($scheme) {
     $display->setComponent($field_name, $display_options)
       ->save();
 
-    $large_style = entity_load('image_style', 'large');
-    $this->drupalGet($large_style->buildUrl($image_uri));
+    $this->drupalGet(image_style_url('large', $image_uri));
     $image_info['uri'] = $image_uri;
     $image_info['width'] = 480;
     $image_info['height'] = 240;
@@ -195,7 +194,7 @@ public function _testPictureFieldFormatters($scheme) {
     if ($scheme == 'private') {
       // Log out and try to access the file.
       $this->drupalLogout();
-      $this->drupalGet($large_style->buildUrl($image_uri));
+      $this->drupalGet(image_style_url('large', $image_uri));
       $this->assertResponse('403', 'Access denied to image style thumbnail as anonymous user.');
     }
   }
diff --git a/core/modules/picture/picture.module b/core/modules/picture/picture.module
index 6863bfb..deba3b0 100644
--- a/core/modules/picture/picture.module
+++ b/core/modules/picture/picture.module
@@ -64,7 +64,7 @@ function picture_menu() {
     'route_name' => 'picture_mapping_page_add',
     'type' => MENU_LOCAL_ACTION,
   );
-  $items['admin/config/media/picturemapping/%picture_mapping'] = array(
+  $items['admin/config/media/picturemapping/%picture_mapping/edit'] = array(
     'title' => 'Edit picture mapping',
     'route_name' => 'picture_mapping_page_edit',
   );
@@ -225,7 +225,7 @@ function theme_picture($variables) {
 
   // Fallback image, output as source with media query.
   $sources[] = array(
-    'src' => entity_load('image_style', $variables['style_name'])->buildUrl($variables['uri']),
+    'src' => image_style_url($variables['style_name'], $variables['uri']),
     'dimensions' => picture_get_image_dimensions($variables),
   );
 
@@ -244,7 +244,7 @@ function theme_picture($variables) {
       // Only one image, use src.
       if (count($new_sources) == 1) {
         $sources[] = array(
-          'src' => entity_load('image_style', $new_sources[0]['style_name'])->buildUrl($new_sources[0]['uri']),
+          'src' => image_style_url($new_sources[0]['style_name'], $new_sources[0]['uri']),
           'dimensions' => picture_get_image_dimensions($new_sources[0]),
           'media' => $breakpoint->mediaQuery,
         );
@@ -253,7 +253,7 @@ function theme_picture($variables) {
         // Multiple images, use srcset.
         $srcset = array();
         foreach ($new_sources as $new_source) {
-          $srcset[] = entity_load('image_style', $new_source['style_name'])->buildUrl($new_source['uri']) . ' ' . $new_source['#multiplier'];
+          $srcset[] = image_style_url($new_source['style_name'], $new_source['uri']) . ' ' . $new_source['#multiplier'];
         }
         $sources[] = array(
           'srcset' => implode(', ', $srcset),
@@ -338,7 +338,7 @@ function picture_get_image_dimensions($variables) {
     'height' => $variables['height'],
   );
 
-  entity_load('image_style', $variables['style_name'])->transformDimensions($dimensions);
+  image_style_transform_dimensions($variables['style_name'], $dimensions);
 
   return $dimensions;
 }
diff --git a/core/modules/picture/picture.routing.yml b/core/modules/picture/picture.routing.yml
index e01bb81..c953029 100644
--- a/core/modules/picture/picture.routing.yml
+++ b/core/modules/picture/picture.routing.yml
@@ -13,7 +13,7 @@ picture_mapping_page_add:
     _permission: 'administer pictures'
 
 picture_mapping_page_edit:
-  pattern: '/admin/config/media/picturemapping/{picture_mapping}'
+  pattern: '/admin/config/media/picturemapping/{picture_mapping}/edit'
   defaults:
     _entity_form: 'picture_mapping.edit'
   requirements:
diff --git a/core/modules/rdf/lib/Drupal/rdf/CommonDataConverter.php b/core/modules/rdf/lib/Drupal/rdf/CommonDataConverter.php
deleted file mode 100644
index e27f48b..0000000
--- a/core/modules/rdf/lib/Drupal/rdf/CommonDataConverter.php
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-/**
- * @file
- * Contains \Drupal\rdf\CommonDataConverter.
- */
-
-namespace Drupal\rdf;
-
-/**
- * Contains methods for common data conversions.
- */
-class CommonDataConverter {
-
-  /**
-   * Provides a passthrough to place unformatted values in content attributes.
-   *
-   * @param mixed $data
-   *   The data to be placed in the content attribute.
-   *
-   * @return mixed
-   *   Returns the data.
-   */
-  static function rawValue($data) {
-    return $data;
-  }
-}
diff --git a/core/modules/rdf/lib/Drupal/rdf/SchemaOrgDataConverter.php b/core/modules/rdf/lib/Drupal/rdf/SchemaOrgDataConverter.php
deleted file mode 100644
index b646d5b..0000000
--- a/core/modules/rdf/lib/Drupal/rdf/SchemaOrgDataConverter.php
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-/**
- * @file
- * Contains \Drupal\rdf\SchemaOrgDataConverter.
- */
-
-namespace Drupal\rdf;
-
-
-class SchemaOrgDataConverter {
-
-  /**
-   * Converts an interaction count to a string with the interaction type.
-   *
-   * Schema.org defines a number of different interaction types.
-   *
-   * @param int $count
-   *   The interaction count.
-   *
-   * @return string
-   *   The formatted string.
-   *
-   * @see http://schema.org/UserInteraction
-   * @todo Support other interaction types, see https://drupal.org/node/2020001
-   */
-  static function interactionCount($count) {
-    return "UserComment:$count";
-  }
-}
diff --git a/core/modules/rdf/lib/Drupal/rdf/Tests/CommentAttributesTest.php b/core/modules/rdf/lib/Drupal/rdf/Tests/CommentAttributesTest.php
index 345ae8c..8c6319a 100644
--- a/core/modules/rdf/lib/Drupal/rdf/Tests/CommentAttributesTest.php
+++ b/core/modules/rdf/lib/Drupal/rdf/Tests/CommentAttributesTest.php
@@ -54,7 +54,6 @@ public function setUp() {
     $comment_count_mapping = array(
       'properties' => array('sioc:num_replies'),
       'datatype' => 'xsd:integer',
-      'datatype_callback' => 'Drupal\rdf\CommonDataConverter::rawValue',
     );
     $article_mapping->setFieldMapping('comment_count', $comment_count_mapping)->save();
 
@@ -70,7 +69,7 @@ public function setUp() {
     $mapping = rdf_get_mapping('comment', 'comment_node_article');
     $mapping->setBundleMapping(array('types' => array('sioc:Post', 'sioct:Comment')))->save();
     $field_mappings = array(
-      'subject' => array(
+      'title' => array(
         'properties' => array('dc:title'),
       ),
       'created' => array(
@@ -109,8 +108,8 @@ public function setUp() {
    */
   public function testNumberOfCommentsRdfaMarkup() {
     // Posts 2 comments on behalf of registered user.
-    $this->saveComment($this->node->nid, $this->web_user->id());
-    $this->saveComment($this->node->nid, $this->web_user->id());
+    $this->saveComment($this->node->nid, $this->web_user->uid);
+    $this->saveComment($this->node->nid, $this->web_user->uid);
 
     // Tests number of comments in teaser view.
     $this->drupalLogin($this->web_user);
@@ -144,7 +143,7 @@ public function testNumberOfCommentsRdfaMarkup() {
    */
   public function testCommentRdfaMarkup() {
     // Posts comment #1 on behalf of registered user.
-    $comment1 = $this->saveComment($this->node->nid, $this->web_user->id());
+    $comment1 = $this->saveComment($this->node->nid, $this->web_user->uid);
 
     // Tests comment #1 with access to the user profile.
     $this->drupalLogin($this->web_user);
@@ -187,12 +186,12 @@ public function testCommentRdfaMarkup() {
   public function testCommentReplyOfRdfaMarkup() {
     // Posts comment #1 on behalf of registered user.
     $this->drupalLogin($this->web_user);
-    $comment_1 = $this->saveComment($this->node->nid, $this->web_user->id());
+    $comment_1 = $this->saveComment($this->node->nid, $this->web_user->uid);
 
     $comment_1_uri = url('comment/' . $comment_1->id(), array('absolute' => TRUE));
 
     // Posts a reply to the first comment.
-    $comment_2 = $this->saveComment($this->node->nid, $this->web_user->id(), NULL, $comment_1->id());
+    $comment_2 = $this->saveComment($this->node->nid, $this->web_user->uid, NULL, $comment_1->id());
     $comment_2_uri = url('comment/' . $comment_2->id(), array('absolute' => TRUE));
 
     $parser = new \EasyRdf_Parser_Rdfa();
@@ -252,7 +251,7 @@ function _testBasicCommentRdfaMarkup($graph, $comment, $account = array()) {
       'value' => $comment->subject->value,
       'lang' => 'en',
     );
-    $this->assertTrue($graph->hasProperty($comment_uri, 'http://purl.org/dc/terms/title', $expected_value), 'Comment subject found in RDF output (dc:title).');
+    $this->assertTrue($graph->hasProperty($comment_uri, 'http://purl.org/dc/terms/title', $expected_value), 'Comment title found in RDF output (dc:title).');
 
     // Comment date.
     $expected_value = array(
diff --git a/core/modules/rdf/lib/Drupal/rdf/Tests/ImageFieldAttributesTest.php b/core/modules/rdf/lib/Drupal/rdf/Tests/ImageFieldAttributesTest.php
index a622a8c..338ddfb 100644
--- a/core/modules/rdf/lib/Drupal/rdf/Tests/ImageFieldAttributesTest.php
+++ b/core/modules/rdf/lib/Drupal/rdf/Tests/ImageFieldAttributesTest.php
@@ -101,7 +101,7 @@ function testNodeTeaser() {
 
     // Construct the node and image URIs for testing.
     $node_uri = url('node/' . $this->node->id(), array('absolute' => TRUE));
-    $image_uri = entity_load('image_style', 'medium')->buildUrl($this->file->getFileUri());
+    $image_uri = image_style_url('medium', $this->file->getFileUri());
 
     // Test relations from node to image.
     $expected_value = array(
diff --git a/core/modules/rdf/lib/Drupal/rdf/Tests/RdfaAttributesTest.php b/core/modules/rdf/lib/Drupal/rdf/Tests/RdfaAttributesTest.php
index e2de46a..314a4eb 100644
--- a/core/modules/rdf/lib/Drupal/rdf/Tests/RdfaAttributesTest.php
+++ b/core/modules/rdf/lib/Drupal/rdf/Tests/RdfaAttributesTest.php
@@ -84,28 +84,6 @@ function testDatatypeCallback() {
     $this->_testAttributes($expected_attributes, $mapping, $date);
   }
 
-
-  /**
-   * Test attribute creation for mappings which use data converters.
-   */
-  function testDatatypeCallbackWithConverter() {
-    $properties = array('schema:interactionCount');
-
-    $data = "23";
-    $content = "UserComment:23";
-
-    $mapping = array(
-      'properties' => $properties,
-      'datatype_callback' => 'Drupal\rdf\SchemaOrgDataConverter::interactionCount',
-    );
-    $expected_attributes = array(
-      'property' => $properties,
-      'content' => $content,
-    );
-
-    $this->_testAttributes($expected_attributes, $mapping, $data);
-  }
-
   /**
    * Test attribute creation for mappings which use 'rel'.
    */
diff --git a/core/modules/rdf/lib/Drupal/rdf/Tests/StandardProfileTest.php b/core/modules/rdf/lib/Drupal/rdf/Tests/StandardProfileTest.php
deleted file mode 100644
index 8abf538..0000000
--- a/core/modules/rdf/lib/Drupal/rdf/Tests/StandardProfileTest.php
+++ /dev/null
@@ -1,485 +0,0 @@
-<?php
-/**
- * @file
- * Contains \Drupal\rdf\Tests\StandardProfileTest
- */
-
-namespace Drupal\rdf\Tests;
-
-use Drupal\simpletest\WebTestBase;
-
-/**
- * Tests that the standard profile mappings are set and exposed as expected.
- */
-class StandardProfileTest extends WebTestBase {
-
-  public $profile = 'standard';
-
-  public static function getInfo() {
-    return array(
-      'name' => 'Standard profile RDF',
-      'description' => 'Tests the RDF mappings and RDFa markup of the standard profile.',
-      'group' => 'RDF',
-    );
-  }
-
-  public function setUp() {
-    parent::setUp();
-
-    $this->base_uri = url('<front>', array('absolute' => TRUE));
-
-    // Create two test users.
-    $this->adminUser = $this->drupalCreateUser(array(
-      'administer content types',
-      'administer comments',
-      'access comments',
-      'access content',
-    ));
-    $this->webUser = $this->drupalCreateUser(array(
-      'access comments',
-      'post comments',
-      'skip comment approval',
-      'access content',
-    ));
-
-    $this->drupalLogin($this->adminUser);
-
-    // Create term.
-    $this->term = entity_create('taxonomy_term', array(
-      'name' => $this->randomName(),
-      'description' => $this->randomName(),
-      'vid' => 'tags',
-    ));
-    $this->term->save();
-
-    // Create image.
-    file_unmanaged_copy(DRUPAL_ROOT . '/core/misc/druplicon.png', 'public://example.jpg');
-    $this->image = entity_create('file', array('uri' => 'public://example.jpg'));
-    $this->image->save();
-
-    // Create article.
-    $article_settings = array(
-      'type' => 'article',
-      'promote' => NODE_PROMOTED,
-      'field_image' => array(
-        array(
-          'target_id' => $this->image->id(),
-        ),
-      ),
-      'field_tags' => array(
-        array(
-          'target_id' => $this->term->id(),
-        ),
-      ),
-    );
-    $this->article = $this->drupalCreateNode($article_settings);
-    // Create second article to test teaser list.
-    $this->drupalCreateNode(array('type' => 'article', 'promote' => NODE_PROMOTED,));
-
-    // Create article comment.
-    $this->articleComment = $this->saveComment($this->article->id(), $this->webUser->id(), NULL, 0, 'comment_node_article');
-
-    // Create page.
-    $this->page = $this->drupalCreateNode(array('type' => 'page'));
-
-    // Set URIs.
-    // Image.
-    $image_file = file_load($this->article->get('field_image')->offsetGet(0)->get('target_id')->getValue());
-    $this->imageUri = entity_load('image_style', 'large')->buildUrl($image_file->getFileUri());
-    // Term.
-    $term_uri_info = $this->term->uri();
-    $this->termUri = url($term_uri_info['path'], array('absolute' => TRUE));
-    // Article.
-    $article_uri_info = $this->article->uri();
-    $this->articleUri = url($article_uri_info['path'], array('absolute' => TRUE));
-    // Page.
-    $page_uri_info = $this->page->uri();
-    $this->pageUri = url($page_uri_info['path'], array('absolute' => TRUE));
-    // Author.
-    $this->authorUri = url('user/' . $this->adminUser->id(), array('absolute' => TRUE));
-    // Comment.
-    $article_comment_uri_info = $this->articleComment->uri();
-    $this->articleCommentUri = url($article_comment_uri_info['path'], array('absolute' => TRUE));
-    // Commenter.
-    $commenter_uri_info = $this->webUser->uri();
-    $this->commenterUri = url($commenter_uri_info['path'], array('absolute' => TRUE));
-
-    $this->drupalLogout();
-  }
-
-  /**
-   * Test that data is exposed correctly when using standard profile.
-   *
-   * Because tests using standard profile take a very long time to run, and
-   * because there is no manipulation of config or data within the test, simply
-   * run all the tests from within this function.
-   */
-  public function testRdfaOutput() {
-    $this->_testFrontPageRDFa();
-    $this->_testArticleRDFa();
-    $this->_testPageRDFa();
-    $this->_testUserRDFa();
-    $this->_testTermRDFa();
-  }
-
-  /**
-   * Test that data is exposed in the front page teasers.
-   */
-  protected function _testFrontPageRDFa() {
-    // Feed the HTML into the parser.
-    $path = 'node';
-    $graph = $this->getRdfGraph($path);
-
-    // Ensure that both articles are listed.
-    $this->assertEqual(2, count($graph->allOfType('http://schema.org/Article')), 'Two articles found on front page.');
-
-    // Test interaction count.
-    $expected_value = array(
-      'type' => 'literal',
-      'value' => 'UserComment:1',
-      'lang' => 'en',
-    );
-    $this->assertTrue($graph->hasProperty($this->articleUri, 'http://schema.org/interactionCount', $expected_value), "Teaser comment count was found (schema:interactionCount).");
-
-    // Test the properties that are common between pages and articles and are
-    // displayed in full and teaser mode.
-    $this->_testCommonNodeProperties($graph, $this->article, "Teaser");
-    // Test properties that are displayed in both teaser and full mode.
-    $this->_testArticleProperties($graph, "Teaser");
-
-    // Title.
-    // @todo Once the title data is output consistently between full and teaser
-    // view modes, move this to _testCommonNodeProperties().
-    $title = $this->article->get('title')->offsetGet(0)->get('value')->getValue();
-    $expected_value = array(
-      'type' => 'literal',
-      // The teaser title parses with additional whitespace.
-      'value' => "
-        $title
-      ",
-      'lang' => 'en',
-    );
-    $this->assertTrue($graph->hasProperty($this->articleUri, 'http://schema.org/name', $expected_value), "Teaser title was found (schema:name).");
-
-    // @todo Once the image points to the original instead of the processed
-    // image, move this to testArticleProperties().
-    $image_file = file_load($this->article->get('field_image')->offsetGet(0)->get('target_id')->getValue());
-    $image_uri = entity_load('image_style', 'medium')->buildUrl($image_file->getFileUri());
-    $expected_value = array(
-      'type' => 'uri',
-      'value' => $image_uri,
-    );
-    $this->assertTrue($graph->hasProperty($this->articleUri, 'http://schema.org/image', $expected_value), "Teaser image was found (schema:image).");
-  }
-
-  /**
-   * Test that article data is exposed using RDFa.
-   *
-   * Two fields are not tested for output here. Changed date is not displayed
-   * on the page, so there is no test for output in node view. Comment count is
-   * displayed in teaser view, so it is tested in the front article tests.
-   */
-  protected function _testArticleRDFa() {
-    // Feed the HTML into the parser.
-    $uri_info = $this->article->uri();
-    $path = $uri_info['path'];
-    $graph = $this->getRdfGraph($path);
-
-    // Type.
-    $this->assertEqual($graph->type($this->articleUri), 'schema:Article', 'Article type was found (schema:Article).');
-
-    // Test the properties that are common between pages and articles.
-    $this->_testCommonNodeProperties($graph, $this->article, "Article");
-    // Test properties that are displayed in both teaser and full mode.
-    $this->_testArticleProperties($graph, "Article");
-    // Test the comment properties displayed on articles.
-    $this->_testNodeCommentProperties($graph);
-
-    // Title.
-    // @todo Once the title data is output consistently between full and teaser
-    // view modes, move this to _testCommonNodeProperties().
-    $expected_value = array(
-      'type' => 'literal',
-      'value' => $this->article->get('title')->offsetGet(0)->get('value')->getValue(),
-      'lang' => 'en',
-    );
-    $this->assertTrue($graph->hasProperty($this->articleUri, 'http://schema.org/name', $expected_value), "Article title was found (schema:name).");
-
-    // @todo Once the image points to the original instead of the processed
-    // image, move this to testArticleProperties().
-    $expected_value = array(
-      'type' => 'uri',
-      'value' => $this->imageUri,
-    );
-    $this->assertTrue($graph->hasProperty($this->articleUri, 'http://schema.org/image', $expected_value), "Article image was found (schema:image).");
-  }
-
-  /**
-   * Test that page data is exposed using RDFa.
-   *
-   * Two fields are not tested for output here. Changed date is not displayed
-   * on the page, so there is no test for output in node view. Comment count is
-   * displayed in teaser view, so it is tested in the front page tests.
-   */
-  protected function _testPageRDFa() {
-    // The standard profile hides the created date on pages. Revert display to
-    // true for testing.
-    variable_set('node_submitted_page', TRUE);
-
-    // Feed the HTML into the parser.
-    $uri_info = $this->page->uri();
-    $path = $uri_info['path'];
-    $graph = $this->getRdfGraph($path);
-
-    // Type.
-    $this->assertEqual($graph->type($this->pageUri), 'schema:WebPage', 'Page type was found (schema:WebPage).');
-
-    // Test the properties that are common between pages and articles.
-    $this->_testCommonNodeProperties($graph, $this->page, "Page");
-
-    // Title.
-    // @todo Once the title data is output consistently between full and teaser
-    // view modes, move this to _testCommonNodeProperties().
-    $expected_value = array(
-      'type' => 'literal',
-      'value' => $this->page->get('title')->offsetGet(0)->get('value')->getValue(),
-      'lang' => 'en',
-    );
-    $this->assertTrue($graph->hasProperty($this->pageUri, 'http://schema.org/name', $expected_value), "Page title was found (schema:name).");
-  }
-
-  /**
-   * Test that user data is exposed on user page.
-   */
-  function _testUserRDFa() {
-    $this->drupalLogin($this->root_user);
-
-    // Feed the HTML into the parser.
-    $uri_info = $this->adminUser->uri();
-    $path = $uri_info['path'];
-    $graph = $this->getRdfGraph($path);
-
-    // User type.
-    $this->assertEqual($graph->type($this->authorUri), 'schema:Person', "User type was found (schema:Person) on user page.");
-
-    // User name.
-    $expected_value = array(
-      'type' => 'literal',
-      'value' => $this->adminUser->name,
-    );
-    $this->assertTrue($graph->hasProperty($this->authorUri, 'http://schema.org/name', $expected_value), "User name was found (schema:name) on user page.");
-
-    $this->drupalLogout();
-  }
-
-  /**
-   * Test that term data is exposed on term page.
-   */
-  function _testTermRDFa() {
-    // Feed the HTML into the parser.
-    $uri_info = $this->term->uri();
-    $path = $uri_info['path'];
-    $graph = $this->getRdfGraph($path);
-
-    // Term type.
-    $this->assertEqual($graph->type($this->termUri), 'schema:Thing', "Term type was found (schema:Thing) on term page.");
-
-    // Term name.
-    $expected_value = array(
-      'type' => 'literal',
-      'value' => $this->term->get('name')->offsetGet(0)->get('value')->getValue(),
-      'lang' => 'en',
-    );
-    $this->assertTrue($graph->hasProperty($this->termUri, 'http://schema.org/name', $expected_value), "Term name was found (schema:name) on term page.");
-
-    // @todo Add test for term description once it is a field:
-    // https://drupal.org/node/569434
-  }
-
-  /**
-   * Test output for properties held in common between articles and pages.
-   *
-   * @param \EasyRdf_Graph $graph
-   *   The EasyRDF graph object.
-   * @param \Drupal\node\Plugin\Core\Entity\Node $node
-   *   The node being displayed.
-   * @param string $message_prefix
-   *   The word to use in the test assertion message.
-   */
-  function _testCommonNodeProperties($graph, $node, $message_prefix) {
-    $uri_info = $node->uri();
-    $uri = url($uri_info['path'], array('absolute' => TRUE));
-
-    // Created date.
-    $expected_value = array(
-      'type' => 'literal',
-      'value' => date_iso8601($node->get('created')->offsetGet(0)->get('value')->getValue()),
-      'lang' => 'en',
-    );
-    $this->assertTrue($graph->hasProperty($uri, 'http://schema.org/dateCreated', $expected_value), "$message_prefix created date was found (schema:dateCreated) in teaser.");
-
-    // Body.
-    $expected_value = array(
-      'type' => 'literal',
-      'value' => $node->get('body')->offsetGet(0)->get('value')->getValue(),
-      'lang' => 'en',
-    );
-    $this->assertTrue($graph->hasProperty($uri, 'http://schema.org/text', $expected_value), "$message_prefix body was found (schema:text) in teaser.");
-
-    // Author.
-    $expected_value = array(
-      'type' => 'uri',
-      'value' => $this->authorUri,
-    );
-    $this->assertTrue($graph->hasProperty($uri, 'http://schema.org/author', $expected_value), "$message_prefix author was found (schema:author) in teaser.");
-
-    // Author type.
-    $this->assertEqual($graph->type($this->authorUri), 'schema:Person', "$message_prefix author type was found (schema:Person).");
-
-    // Author name.
-    $expected_value = array(
-      'type' => 'literal',
-      'value' => $this->adminUser->name,
-    );
-    $this->assertTrue($graph->hasProperty($this->authorUri, 'http://schema.org/name', $expected_value), "$message_prefix author name was found (schema:name).");
-  }
-
-  /**
-   * Test output for article properties displayed in both view modes.
-   *
-   * @param \EasyRdf_Graph $graph
-   *   The EasyRDF graph object.
-   * @param string $message_prefix
-   *   The word to use in the test assertion message.
-   */
-  function _testArticleProperties($graph, $message_prefix) {
-    // Tags.
-    $expected_value = array(
-      'type' => 'uri',
-      'value' => $this->termUri,
-    );
-    $this->assertTrue($graph->hasProperty($this->articleUri, 'http://schema.org/about', $expected_value), "$message_prefix tag was found (schema:about).");
-
-    // Tag type.
-    $this->assertEqual($graph->type($this->termUri), 'schema:Thing', 'Tag type was found (schema:Thing).');
-
-    // Tag name.
-    $expected_value = array(
-      'type' => 'literal',
-      'value' => $this->term->get('name')->offsetGet(0)->get('value')->getValue(),
-      'lang' => 'en',
-    );
-    $this->assertTrue($graph->hasProperty($this->termUri, 'http://schema.org/name', $expected_value), "$message_prefix name was found (schema:name).");
-  }
-
-  /**
-   * Test output for comment properties on nodes in full page view mode.
-   *
-   * @param \EasyRdf_Graph $graph
-   *   The EasyRDF graph object.
-   */
-  function _testNodeCommentProperties($graph) {
-    // @todo Test relationship between comment and node once it is a field:
-    // https://drupal.org/node/731724
-    // Comment type.
-    $this->assertEqual($graph->type($this->articleCommentUri), 'schema:Comment', 'Comment type was found (schema:Comment).');
-
-    // Comment title.
-    $expected_value = array(
-      'type' => 'literal',
-      'value' => $this->articleComment->get('subject')->offsetGet(0)->get('value')->getValue(),
-      'lang' => 'en',
-    );
-    $this->assertTrue($graph->hasProperty($this->articleCommentUri, 'http://schema.org/name', $expected_value), 'Article comment title was found (schema:name).');
-
-    // Comment created date.
-    $expected_value = array(
-      'type' => 'literal',
-      'value' => date_iso8601($this->articleComment->get('created')->offsetGet(0)->get('value')->getValue()),
-      'lang' => 'en',
-    );
-    $this->assertTrue($graph->hasProperty($this->articleCommentUri, 'http://schema.org/dateCreated', $expected_value), 'Article comment created date was found (schema:dateCreated).');
-
-    // Comment body.
-    $text = $this->articleComment->get('comment_body')->offsetGet(0)->get('value')->getValue();
-    $expected_value = array(
-      'type' => 'literal',
-      // There is an extra carriage return in the when parsing comments as
-      // output by Bartik, so it must be added to the expected value.
-      'value' => "$text
-",
-      'lang' => 'en',
-    );
-    $this->assertTrue($graph->hasProperty($this->articleCommentUri, 'http://schema.org/text', $expected_value), 'Article comment body was found (schema:text).');
-
-    // Comment uid.
-    $expected_value = array(
-      'type' => 'uri',
-      'value' => $this->commenterUri,
-    );
-    $this->assertTrue($graph->hasProperty($this->articleCommentUri, 'http://schema.org/author', $expected_value), 'Article comment author was found (schema:author).');
-
-    // Comment author type.
-    $this->assertEqual($graph->type($this->commenterUri), 'schema:Person', 'Comment author type was found (schema:Person).');
-
-    // Comment author name.
-    $expected_value = array(
-      'type' => 'literal',
-      'value' => $this->webUser->get('name')->offsetGet(0)->get('value')->getValue(),
-    );
-    $this->assertTrue($graph->hasProperty($this->commenterUri, 'http://schema.org/name', $expected_value), 'Comment author name was found (schema:name).');
-  }
-
-  /**
-   * Creates a comment entity.
-   *
-   * @param int $nid
-   *   Node id which will hold the comment.
-   * @param int $uid
-   *   User id of the author of the comment. Can be NULL if $contact provided.
-   * @param mixed $contact
-   *   Set to NULL for no contact info, TRUE to ignore success checking, and
-   *   array of values to set contact info.
-   * @param int $pid
-   *   Comment id of the parent comment in a thread.
-   * @param string $bundle
-   *   The bundle of the comment.
-   *
-   * @return \Drupal\comment\Plugin\Core\Entity\Comment
-   *   The saved comment.
-   */
-  function saveComment($nid, $uid, $contact = NULL, $pid = 0, $bundle = '') {
-    $values = array(
-      'nid' => $nid,
-      'uid' => $uid,
-      'pid' => $pid,
-      'node_type' => $bundle,
-      'subject' => $this->randomName(),
-      'comment_body' => $this->randomName(),
-      'status' => 1,
-    );
-    if ($contact) {
-      $values += $contact;
-    }
-
-    $comment = entity_create('comment', $values);
-    $comment->save();
-    return $comment;
-  }
-
-  /**
-   * Get the EasyRdf_Graph object for a page.
-   *
-   * @param string $path
-   *   The relative path to the page being tested.
-   *
-   * @return \EasyRdf_Graph
-   *   The RDF graph object.
-   */
-  function getRdfGraph($path) {
-    $parser = new \EasyRdf_Parser_Rdfa();
-    $graph = new \EasyRdf_Graph();
-    $parser->parse($graph, $this->drupalGet($path), 'rdfa', $this->base_uri);
-    return $graph;
-  }
-}
diff --git a/core/modules/rdf/lib/Drupal/rdf/Tests/TaxonomyAttributesTest.php b/core/modules/rdf/lib/Drupal/rdf/Tests/TaxonomyAttributesTest.php
index 268a247..99390d3 100644
--- a/core/modules/rdf/lib/Drupal/rdf/Tests/TaxonomyAttributesTest.php
+++ b/core/modules/rdf/lib/Drupal/rdf/Tests/TaxonomyAttributesTest.php
@@ -77,8 +77,5 @@ function testTaxonomyTermRdfaAttributes() {
       'lang' => 'en',
     );
     $this->assertTrue($graph->hasProperty($term_uri, 'http://www.w3.org/2004/02/skos/core#prefLabel', $expected_value), 'Term label found in RDF output (skos:prefLabel).');
-
-    // @todo Add test for term description once it is a field:
-    // https://drupal.org/node/569434
   }
 }
diff --git a/core/modules/rdf/lib/Drupal/rdf/Tests/UserAttributesTest.php b/core/modules/rdf/lib/Drupal/rdf/Tests/UserAttributesTest.php
index c5ba5f8..8de5927 100644
--- a/core/modules/rdf/lib/Drupal/rdf/Tests/UserAttributesTest.php
+++ b/core/modules/rdf/lib/Drupal/rdf/Tests/UserAttributesTest.php
@@ -53,15 +53,15 @@ function testUserAttributesInMarkup() {
     $user2 = $this->drupalCreateUser();
     $this->drupalLogin($user1);
 
-    $account_uri = url('user/' . $user2->id(), array('absolute' => TRUE));
-    $person_uri = url('user/' . $user2->id(), array('fragment' => 'me', 'absolute' => TRUE));
+    $account_uri = url('user/' . $user2->uid, array('absolute' => TRUE));
+    $person_uri = url('user/' . $user2->uid, array('fragment' => 'me', 'absolute' => TRUE));
 
     // Parses the user profile page where the default bundle mapping for user
     // should be used.
     $parser = new \EasyRdf_Parser_Rdfa();
     $graph = new \EasyRdf_Graph();
     $base_uri = url('<front>', array('absolute' => TRUE));
-    $parser->parse($graph, $this->drupalGet('user/' . $user2->id()), 'rdfa', $base_uri);
+    $parser->parse($graph, $this->drupalGet('user/' . $user2->uid), 'rdfa', $base_uri);
 
     // Inspects RDF graph output.
     // User type.
@@ -76,6 +76,19 @@ function testUserAttributesInMarkup() {
       'value' => $user2->name,
     );
     $this->assertTrue($graph->hasProperty($account_uri, 'http://xmlns.com/foaf/0.1/name', $expected_value), 'User name found in RDF output (foaf:name).');
+    // Person type.
+    $expected_value = array(
+      'type' => 'uri',
+      'value' => 'http://xmlns.com/foaf/0.1/Person',
+    );
+    $this->assertTrue($graph->hasProperty($person_uri, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', $expected_value), 'Person type found in RDF output (foaf:Person).');
+    // Person relation to account.
+    $expected_value = array(
+      'type' => 'uri',
+      'value' => $account_uri,
+    );
+    $this->assertTrue($graph->hasProperty($person_uri, 'http://xmlns.com/foaf/0.1/account', $expected_value), 'Person relation to account found in RDF output (foaf:account).');
+
 
     // User 2 creates a node.
     $this->drupalLogin($user2);
diff --git a/core/modules/rdf/rdf.module b/core/modules/rdf/rdf.module
index 3c9bac3..6e33be1 100644
--- a/core/modules/rdf/rdf.module
+++ b/core/modules/rdf/rdf.module
@@ -92,7 +92,6 @@ function rdf_rdf_namespaces() {
     'foaf'     => 'http://xmlns.com/foaf/0.1/',
     'og'       => 'http://ogp.me/ns#',
     'rdfs'     => 'http://www.w3.org/2000/01/rdf-schema#',
-    'schema'   => 'http://schema.org/',
     'sioc'     => 'http://rdfs.org/sioc/ns#',
     'sioct'    => 'http://rdfs.org/sioc/types#',
     'skos'     => 'http://www.w3.org/2004/02/skos/core#',
@@ -175,7 +174,7 @@ function rdf_rdfa_attributes($mapping, $data = NULL) {
         // Convert $data to a specific format as per the callback function.
         if (isset($data) && !empty($mapping['datatype_callback'])) {
           $callback = $mapping['datatype_callback'];
-          $attributes['content'] = call_user_func($callback, $data);
+          $attributes['content'] = $callback($data);
         }
         if (isset($mapping['datatype'])) {
           $attributes['datatype'] = $mapping['datatype'];
@@ -296,7 +295,11 @@ function rdf_preprocess_node(&$variables) {
   if (isset($variables['node']->comment_count) && !empty($comment_count_mapping['properties'])) {
     // Annotates the 'x comments' link in teaser view.
     if (isset($variables['content']['links']['comment']['#links']['comment-comments'])) {
-      $comment_count_attributes = rdf_rdfa_attributes($comment_count_mapping, $variables['node']->comment_count);
+      $comment_count_attributes['property'] = $comment_count_mapping['properties'];
+      $comment_count_attributes['content'] = $variables['node']->comment_count;
+      if (isset($comment_count_mapping['datatype'])) {
+        $comment_count_attributes['datatype'] = $comment_count_mapping['datatype'];
+      }
       // According to RDFa parsing rule number 4, a new subject URI is created
       // from the href attribute if no rel/rev attribute is present. To get the
       // original node URL from the about attribute of the parent container we
@@ -344,18 +347,12 @@ function rdf_preprocess_field(&$variables) {
       // this field has a URI.
       if (isset($item['entity']->uri)) {
         if (!empty($element[$delta]['#image_style'])) {
-          $variables['item_attributes'][$delta]['resource'] = entity_load('image_style', $element[$delta]['#image_style'])->buildUrl($item['entity']->getFileUri());
+          $variables['item_attributes'][$delta]['resource'] = image_style_url($element[$delta]['#image_style'], $item['entity']->getFileUri());
         }
         else {
           $variables['item_attributes'][$delta]['resource'] = file_create_url($item['entity']->getFileUri());
         }
       }
-      // Convert the item_attributes for this field item back into an Attribute
-      // object for printing. This is necessary because at this time this
-      // preprocess function overwrites $variables['item_attributes'][$delta],
-      // which is initialized as an Attribute object in
-      // template_preprocess_field().
-      $variables['item_attributes'][$delta] = new Attribute($variables['item_attributes'][$delta]);
     }
   }
 }
@@ -378,6 +375,15 @@ function rdf_preprocess_user(&$variables) {
   // If we are on the user account page, add the relationship between the
   // sioc:UserAccount and the foaf:Person who holds the account.
   if (current_path() == $uri['path']) {
+    $account_holder_meta = array(
+      '#tag' => 'meta',
+      '#attributes' => array(
+        'about' => url($uri['path'], array_merge($uri['options'], array('fragment' => 'me'))),
+        'typeof' => array('foaf:Person'),
+        'rel' => array('foaf:account'),
+        'resource' => url($uri['path'], $uri['options']),
+      ),
+    );
     // Adds the markup for username as language neutral literal, see
     // rdf_preprocess_username().
     $name_mapping = $mapping->getPreparedFieldMapping('name');
@@ -393,6 +399,7 @@ function rdf_preprocess_user(&$variables) {
       );
       drupal_add_html_head($username_meta, 'rdf_user_username');
     }
+    drupal_add_html_head($account_holder_meta, 'rdf_user_account_holder');
   }
 }
 
@@ -498,7 +505,7 @@ function rdf_preprocess_comment(&$variables) {
     $variables['created'] .= $created_metadata_markup;
     $variables['submitted'] .= $created_metadata_markup;
   }
-  $title_mapping = $mapping->getPreparedFieldMapping('subject');
+  $title_mapping = $mapping->getPreparedFieldMapping('title');
   if (!empty($title_mapping)) {
     // Adds RDFa markup to the subject of the comment. Because the RDFa markup
     // is added to an <h3> tag which might contain HTML code, we specify an
@@ -510,8 +517,6 @@ function rdf_preprocess_comment(&$variables) {
 
   // Annotates the parent relationship between the current comment and the node
   // it belongs to. If available, the parent comment is also annotated.
-  // @todo When comments are turned into fields, this should be changed.
-  // Currently there is no mapping relating a comment to its node.
   $pid_mapping = $mapping->getPreparedFieldMapping('pid');
   if (!empty($pid_mapping)) {
     // Adds the relation to the parent node.
diff --git a/core/modules/rest/lib/Drupal/rest/Access/CSRFAccessCheck.php b/core/modules/rest/lib/Drupal/rest/Access/CSRFAccessCheck.php
index 0d9dd87..584be0c 100644
--- a/core/modules/rest/lib/Drupal/rest/Access/CSRFAccessCheck.php
+++ b/core/modules/rest/lib/Drupal/rest/Access/CSRFAccessCheck.php
@@ -21,7 +21,6 @@ class CSRFAccessCheck implements AccessCheckInterface {
    */
   public function applies(Route $route) {
     $requirements = $route->getRequirements();
-
     if (array_key_exists('_access_rest_csrf', $requirements)) {
       if (isset($requirements['_method'])) {
         // There could be more than one method requirement separated with '|'.
@@ -37,6 +36,7 @@ public function applies(Route $route) {
       // safe side.
       return TRUE;
     }
+    return FALSE;
   }
 
   /**
@@ -50,7 +50,7 @@ public function access(Route $route, Request $request) {
     // 2. the user was successfully authenticated and
     // 3. the request comes with a session cookie.
     if (!in_array($method, array('GET', 'HEAD', 'OPTIONS', 'TRACE'))
-      && $GLOBALS['user']->isAuthenticated()
+      && user_is_logged_in()
       && $cookie
     ) {
       $csrf_token = $request->headers->get('X-CSRF-Token');
diff --git a/core/modules/rest/lib/Drupal/rest/Plugin/rest/resource/EntityResource.php b/core/modules/rest/lib/Drupal/rest/Plugin/rest/resource/EntityResource.php
index 504fc59..f1195de 100644
--- a/core/modules/rest/lib/Drupal/rest/Plugin/rest/resource/EntityResource.php
+++ b/core/modules/rest/lib/Drupal/rest/Plugin/rest/resource/EntityResource.php
@@ -71,11 +71,7 @@ public function get($id) {
    *
    * @throws \Symfony\Component\HttpKernel\Exception\HttpException
    */
-  public function post($id, EntityInterface $entity = NULL) {
-    if ($entity == NULL) {
-      throw new BadRequestHttpException(t('No entity content received.'));
-    }
-
+  public function post($id, EntityInterface $entity) {
     if (!$entity->access('create')) {
       throw new AccessDeniedHttpException();
     }
@@ -121,11 +117,7 @@ public function post($id, EntityInterface $entity = NULL) {
    *
    * @throws \Symfony\Component\HttpKernel\Exception\HttpException
    */
-  public function patch($id, EntityInterface $entity = NULL) {
-    if ($entity == NULL) {
-      throw new BadRequestHttpException(t('No entity content received.'));
-    }
-
+  public function patch($id, EntityInterface $entity) {
     if (empty($id)) {
       throw new NotFoundHttpException();
     }
diff --git a/core/modules/rest/lib/Drupal/rest/Tests/CreateTest.php b/core/modules/rest/lib/Drupal/rest/Tests/CreateTest.php
index 4ccc0b6..42c2950 100644
--- a/core/modules/rest/lib/Drupal/rest/Tests/CreateTest.php
+++ b/core/modules/rest/lib/Drupal/rest/Tests/CreateTest.php
@@ -88,10 +88,6 @@ public function testCreate() {
     $this->httpRequest('entity/' . $entity_type, 'POST', 'kaboom!', $this->defaultMimeType);
     $this->assertResponse(400);
 
-    // Try to send no data at all, which does not make sense on POST requests.
-    $this->httpRequest('entity/' . $entity_type, 'POST', NULL, $this->defaultMimeType);
-    $this->assertResponse(400);
-
     // Try to create an entity without the CSRF token.
     $this->curlExec(array(
       CURLOPT_HTTPGET => FALSE,
diff --git a/core/modules/rest/lib/Drupal/rest/Tests/UpdateTest.php b/core/modules/rest/lib/Drupal/rest/Tests/UpdateTest.php
index eca41bc..25d56c9 100644
--- a/core/modules/rest/lib/Drupal/rest/Tests/UpdateTest.php
+++ b/core/modules/rest/lib/Drupal/rest/Tests/UpdateTest.php
@@ -104,10 +104,6 @@ public function testPatchUpdate() {
     $entity->field_test_text->value = $this->randomString();
     $entity->save();
 
-    // Try to send no data at all, which does not make sense on PATCH requests.
-    $this->httpRequest('entity/' . $entity_type . '/' . $entity->id(), 'PATCH', NULL, $this->defaultMimeType);
-    $this->assertResponse(400);
-
     // Try to update a non-existing entity with ID 9999.
     $this->httpRequest('entity/' . $entity_type . '/9999', 'PATCH', $serialized, $this->defaultMimeType);
     $this->assertResponse(404);
diff --git a/core/modules/rest/tests/modules/rest_test_views/test_views/views.view.test_serializer_display_entity.yml b/core/modules/rest/tests/modules/rest_test_views/test_views/views.view.test_serializer_display_entity.yml
index 13d90aa..89fc66d 100644
--- a/core/modules/rest/tests/modules/rest_test_views/test_views/views.view.test_serializer_display_entity.yml
+++ b/core/modules/rest/tests/modules/rest_test_views/test_views/views.view.test_serializer_display_entity.yml
@@ -32,7 +32,6 @@ display:
           field: id
           order: DESC
           plugin_id: date
-          provider: views
       title: 'Test serialize'
       arguments: {  }
   rest_export_1:
diff --git a/core/modules/rest/tests/modules/rest_test_views/test_views/views.view.test_serializer_display_field.yml b/core/modules/rest/tests/modules/rest_test_views/test_views/views.view.test_serializer_display_field.yml
index 029c34a..1149476 100644
--- a/core/modules/rest/tests/modules/rest_test_views/test_views/views.view.test_serializer_display_field.yml
+++ b/core/modules/rest/tests/modules/rest_test_views/test_views/views.view.test_serializer_display_field.yml
@@ -32,7 +32,6 @@ display:
           field: name
           label: ''
           plugin_id: string
-          provider: views_test_data
         nothing:
           id: nothing
           table: views
@@ -46,13 +45,11 @@ display:
             alter_text: '1'
             text: TEST
           plugin_id: custom
-          provider: views
         created:
           id: created
           table: views_test_data
           field: created
           plugin_id: date
-          provider: views_test_data
       sorts:
         created:
           id: created
@@ -60,7 +57,6 @@ display:
           field: created
           order: DESC
           plugin_id: date
-          provider: views_test_data
       title: 'Test serialize'
       arguments: {  }
   rest_export_1:
diff --git a/core/modules/search/lib/Drupal/search/Plugin/views/argument/Search.php b/core/modules/search/lib/Drupal/search/Plugin/views/argument/Search.php
index 96810a6..6159534 100644
--- a/core/modules/search/lib/Drupal/search/Plugin/views/argument/Search.php
+++ b/core/modules/search/lib/Drupal/search/Plugin/views/argument/Search.php
@@ -65,7 +65,7 @@ public function query($group_by = FALSE) {
         'left_table' => $search_index,
         'left_field' => 'word',
       );
-      $join = \Drupal::service()->get('plugin.manager.views.join')->createInstance('standard', $definition);
+      $join = drupal_container()->get('plugin.manager.views.join')->createInstance('standard', $definition);
       $search_total = $this->query->addRelationship('search_total', $join, $search_index);
 
       $this->search_score = $this->query->addField('', "SUM($search_index.score * $search_total.count)", 'score', array('aggregate' => TRUE));
diff --git a/core/modules/search/lib/Drupal/search/Plugin/views/field/Score.php b/core/modules/search/lib/Drupal/search/Plugin/views/field/Score.php
index 9293694..26e28f1 100644
--- a/core/modules/search/lib/Drupal/search/Plugin/views/field/Score.php
+++ b/core/modules/search/lib/Drupal/search/Plugin/views/field/Score.php
@@ -80,7 +80,7 @@ public function query() {
     }
   }
 
-  public function render($values) {
+  function render($values) {
     // Only render if we exist.
     if (isset($this->tableAlias)) {
       return parent::render($values);
diff --git a/core/modules/search/lib/Drupal/search/Plugin/views/filter/Search.php b/core/modules/search/lib/Drupal/search/Plugin/views/filter/Search.php
index 7461bdd..6ca3089 100644
--- a/core/modules/search/lib/Drupal/search/Plugin/views/filter/Search.php
+++ b/core/modules/search/lib/Drupal/search/Plugin/views/filter/Search.php
@@ -145,7 +145,7 @@ public function query() {
         'left_table' => $search_index,
         'left_field' => 'word',
       );
-      $join = \Drupal::service()->get('plugin.manager.views.join')->createInstance('standard', $definition);
+      $join = drupal_container()->get('plugin.manager.views.join')->createInstance('standard', $definition);
 
       $search_total = $this->query->addRelationship('search_total', $join, $search_index);
 
diff --git a/core/modules/search/lib/Drupal/search/Plugin/views/row/SearchRow.php b/core/modules/search/lib/Drupal/search/Plugin/views/row/SearchRow.php
index f12e2c6..1e42b80 100644
--- a/core/modules/search/lib/Drupal/search/Plugin/views/row/SearchRow.php
+++ b/core/modules/search/lib/Drupal/search/Plugin/views/row/SearchRow.php
@@ -42,7 +42,7 @@ public function buildOptionsForm(&$form, &$form_state) {
   /**
    * Override the behavior of the render() function.
    */
-  public function render($row) {
+  function render($row) {
     return array(
       '#theme' => $this->themeFunctions(),
       '#view' => $this->view,
diff --git a/core/modules/search/search.module b/core/modules/search/search.module
index fce4630..083fb05 100644
--- a/core/modules/search/search.module
+++ b/core/modules/search/search.module
@@ -625,7 +625,7 @@ function search_index($sid, $module, $text, $langcode) {
         if ($tagname == 'a') {
           // Check if link points to a node on this site
           if (preg_match($node_regexp, $value, $match)) {
-            $path = Drupal::service('path.alias_manager')->getSystemPath($match[1]);
+            $path = drupal_container()->get('path.alias_manager')->getSystemPath($match[1]);
             if (preg_match('!(?:node|book)/(?:view/)?([0-9]+)!i', $path, $match)) {
               $linknid = $match[1];
               if ($linknid > 0) {
diff --git a/core/modules/serialization/lib/Drupal/serialization/Tests/EntitySerializationTest.php b/core/modules/serialization/lib/Drupal/serialization/Tests/EntitySerializationTest.php
index c8a4862..46ad0cc 100644
--- a/core/modules/serialization/lib/Drupal/serialization/Tests/EntitySerializationTest.php
+++ b/core/modules/serialization/lib/Drupal/serialization/Tests/EntitySerializationTest.php
@@ -54,7 +54,7 @@ protected function setUp() {
     // Create a test entity to serialize.
     $this->values = array(
       'name' => $this->randomName(),
-      'user_id' => $GLOBALS['user']->id(),
+      'user_id' => $GLOBALS['user']->uid,
       'field_test_text' => array(
         'value' => $this->randomName(),
         'format' => 'full_html',
diff --git a/core/modules/serialization/lib/Drupal/serialization/Tests/SerializationTest.php b/core/modules/serialization/lib/Drupal/serialization/Tests/SerializationTest.php
index 10c500c..9dee10a 100644
--- a/core/modules/serialization/lib/Drupal/serialization/Tests/SerializationTest.php
+++ b/core/modules/serialization/lib/Drupal/serialization/Tests/SerializationTest.php
@@ -7,13 +7,10 @@
 
 namespace Drupal\serialization\Tests;
 
-use Drupal\simpletest\DrupalUnitTestBase;
+use Drupal\simpletest\WebTestBase;
 use Symfony\Component\Serializer\Exception\UnexpectedValueException;
 
-/**
- * Tests generic registration of module provided normalizers and encoders.
- */
-class SerializationTest extends DrupalUnitTestBase {
+class SerializationTest extends WebTestBase {
 
   /**
    * Modules to enable.
@@ -59,7 +56,6 @@ public function testSerializerComponentRegistration() {
       $this->fail('The serializer was expected to throw an exception for an unsupported format, but did not.');
     }
     catch (UnexpectedValueException $e) {
-      $this->pass('The serializer threw an exception for an unsupported format.');
     }
   }
 }
diff --git a/core/modules/shortcut/css/shortcut.theme.css b/core/modules/shortcut/css/shortcut.theme.css
index 35ea588..f45a375 100644
--- a/core/modules/shortcut/css/shortcut.theme.css
+++ b/core/modules/shortcut/css/shortcut.theme.css
@@ -6,25 +6,34 @@
 /**
  * Toolbar.
  */
-.toolbar-icon-shortcut:before {
+.icon-shortcut:before {
   background-image: url(../images/shortcut.png);
 }
-.toolbar-icon-shortcut:active:before,
-.toolbar-icon-shortcut.active:before {
+.icon-shortcut:active:before,
+.icon-shortcut.active:before {
   background-image: url(../images/shortcut-active.png);
 }
+.toolbar .tray.horizontal.shortcuts .menu {
+  float: left;
+}
 .edit-shortcuts {
   display: block;
 }
-.toolbar .toolbar-tray-vertical .edit-shortcuts {
+.toolbar .vertical .edit-shortcuts {
   text-align: right;
   padding: 1em;
 }
-.toolbar .toolbar-tray-horizontal .edit-shortcuts {
+.toolbar .horizontal .edit-shortcuts {
   float: left; /* LTR */
 }
-[dir="rtl"] .toolbar .toolbar-tray-horizontal .edit-shortcuts {
+[dir="rtl"] .toolbar .horizontal .edit-shortcuts {
+  border-left: 0 none;
+  border-right: 1px solid #d9d9d9;
   float: right;
+  margin-left: 0;
+  margin-right: 0.3333em;
+  padding-left: 0.3333em;
+  padding-right: 0.6667em;
 }
 
 /**
diff --git a/core/modules/shortcut/lib/Drupal/shortcut/Access/LinkDeleteAccessCheck.php b/core/modules/shortcut/lib/Drupal/shortcut/Access/LinkDeleteAccessCheck.php
index 6fad35c..d6b454a 100644
--- a/core/modules/shortcut/lib/Drupal/shortcut/Access/LinkDeleteAccessCheck.php
+++ b/core/modules/shortcut/lib/Drupal/shortcut/Access/LinkDeleteAccessCheck.php
@@ -7,20 +7,20 @@
 
 namespace Drupal\shortcut\Access;
 
-use Drupal\Core\Access\StaticAccessCheckInterface;
+use Drupal\Core\Access\AccessCheckInterface;
 use Symfony\Component\Routing\Route;
 use Symfony\Component\HttpFoundation\Request;
 
 /**
  * Provides an access check for shortcut link delete routes.
  */
-class LinkDeleteAccessCheck implements StaticAccessCheckInterface {
+class LinkDeleteAccessCheck implements AccessCheckInterface {
 
   /**
    * {@inheritdoc}
    */
-  public function appliesTo() {
-    return array('_access_shortcut_link_delete');
+  public function applies(Route $route) {
+    return array_key_exists('_access_shortcut_link_delete', $route->getRequirements());
   }
 
   /**
diff --git a/core/modules/shortcut/lib/Drupal/shortcut/Plugin/Menu/LocalAction/AddShortcutSetLocalAction.php b/core/modules/shortcut/lib/Drupal/shortcut/Plugin/Menu/LocalAction/AddShortcutSetLocalAction.php
deleted file mode 100644
index 65abdf0..0000000
--- a/core/modules/shortcut/lib/Drupal/shortcut/Plugin/Menu/LocalAction/AddShortcutSetLocalAction.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\shortcut\Plugin\Menu\AddShortcutSetLocalAction.
- */
-
-namespace Drupal\shortcut\Plugin\Menu\LocalAction;
-
-use Drupal\Core\Annotation\Translation;
-use Drupal\Core\Annotation\Menu\LocalAction;
-use Drupal\Core\Menu\LocalActionBase;
-
-/**
- * @LocalAction(
- *   id = "shortcut_set_add_local_action",
- *   route_name = "shortcut_set_add",
- *   title = @Translation("Add shortcut set"),
- *   appears_on = {"shortcut_set_admin"}
- * )
- */
-class AddShortcutSetLocalAction extends LocalActionBase {
-
-}
diff --git a/core/modules/shortcut/lib/Drupal/shortcut/ShortcutAccessController.php b/core/modules/shortcut/lib/Drupal/shortcut/ShortcutAccessController.php
index 572423e..da0e616 100644
--- a/core/modules/shortcut/lib/Drupal/shortcut/ShortcutAccessController.php
+++ b/core/modules/shortcut/lib/Drupal/shortcut/ShortcutAccessController.php
@@ -21,7 +21,6 @@ class ShortcutAccessController extends EntityAccessController {
    */
   protected function checkAccess(EntityInterface $entity, $operation, $langcode, AccountInterface $account) {
     switch ($operation) {
-      case 'create':
       case 'update':
         if (user_access('administer shortcuts', $account)) {
           return TRUE;
diff --git a/core/modules/shortcut/lib/Drupal/shortcut/ShortcutStorageController.php b/core/modules/shortcut/lib/Drupal/shortcut/ShortcutStorageController.php
index bae0e5c..a7150b1 100644
--- a/core/modules/shortcut/lib/Drupal/shortcut/ShortcutStorageController.php
+++ b/core/modules/shortcut/lib/Drupal/shortcut/ShortcutStorageController.php
@@ -45,7 +45,7 @@ public function deleteAssignedShortcutSets(Shortcut $entity) {
    */
   public function assignUser($shortcut_set, $account) {
     db_merge('shortcut_set_users')
-      ->key(array('uid' => $account->id()))
+      ->key(array('uid' => $account->uid))
       ->fields(array('set_name' => $shortcut_set->id()))
       ->execute();
     drupal_static_reset('shortcut_current_displayed_set');
@@ -56,7 +56,7 @@ public function assignUser($shortcut_set, $account) {
    */
   public function unassignUser($account) {
     $deleted = db_delete('shortcut_set_users')
-      ->condition('uid', $account->id())
+      ->condition('uid', $account->uid)
       ->execute();
     return (bool) $deleted;
   }
@@ -67,7 +67,7 @@ public function unassignUser($account) {
   public function getAssignedToUser($account) {
     $query = db_select('shortcut_set_users', 'ssu');
     $query->fields('ssu', array('set_name'));
-    $query->condition('ssu.uid', $account->id());
+    $query->condition('ssu.uid', $account->uid);
     return $query->execute()->fetchField();
   }
 
diff --git a/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutSetsTest.php b/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutSetsTest.php
index b02cd56..8a55dfd 100644
--- a/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutSetsTest.php
+++ b/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutSetsTest.php
@@ -29,7 +29,7 @@ function testShortcutSetAdd() {
     $new_set = $this->generateShortcutSet($this->randomName());
     $sets = entity_load_multiple('shortcut');
     $this->assertTrue(isset($sets[$new_set->id()]), 'Successfully created a shortcut set.');
-    $this->drupalGet('user/' . $this->admin_user->id() . '/shortcuts');
+    $this->drupalGet('user/' . $this->admin_user->uid . '/shortcuts');
     $this->assertText($new_set->label(), 'Generated shortcut set was listed as a choice on the user account page.');
   }
 
@@ -41,7 +41,7 @@ function testShortcutSetSwitchOwn() {
 
     // Attempt to switch the default shortcut set to the newly created shortcut
     // set.
-    $this->drupalPost('user/' . $this->admin_user->id() . '/shortcuts', array('set' => $new_set->id()), t('Change set'));
+    $this->drupalPost('user/' . $this->admin_user->uid . '/shortcuts', array('set' => $new_set->id()), t('Change set'));
     $this->assertResponse(200);
     $current_set = shortcut_current_displayed_set($this->admin_user);
     $this->assertTrue($new_set->id() == $current_set->id(), 'Successfully switched own shortcut set.');
@@ -67,7 +67,7 @@ function testShortcutSetSwitchCreate() {
       'id' => strtolower($this->randomName()),
       'label' => $this->randomString(),
     );
-    $this->drupalPost('user/' . $this->admin_user->id() . '/shortcuts', $edit, t('Change set'));
+    $this->drupalPost('user/' . $this->admin_user->uid . '/shortcuts', $edit, t('Change set'));
     $current_set = shortcut_current_displayed_set($this->admin_user);
     $this->assertNotEqual($current_set->id(), $this->set->id(), 'A shortcut set can be switched to at the same time as it is created.');
     $this->assertEqual($current_set->label(), $edit['label'], 'The new set is correctly assigned to the user.');
@@ -78,7 +78,7 @@ function testShortcutSetSwitchCreate() {
    */
   function testShortcutSetSwitchNoSetName() {
     $edit = array('set' => 'new');
-    $this->drupalPost('user/' . $this->admin_user->id() . '/shortcuts', $edit, t('Change set'));
+    $this->drupalPost('user/' . $this->admin_user->uid . '/shortcuts', $edit, t('Change set'));
     $this->assertText(t('The new set label is required.'));
     $current_set = shortcut_current_displayed_set($this->admin_user);
     $this->assertEqual($current_set->id(), $this->set->id(), 'Attempting to switch to a new shortcut set without providing a set name does not succeed.');
@@ -167,7 +167,7 @@ function testShortcutSetCreateWithSetName() {
     $new_set = $this->generateShortcutSet($random_name, $random_name, TRUE);
     $sets = entity_load_multiple('shortcut');
     $this->assertTrue(isset($sets[$random_name]), 'Successfully created a shortcut set with a defined set name.');
-    $this->drupalGet('user/' . $this->admin_user->id() . '/shortcuts');
+    $this->drupalGet('user/' . $this->admin_user->uid . '/shortcuts');
     $this->assertText($new_set->label(), 'Generated shortcut set was listed as a choice on the user account page.');
   }
 }
diff --git a/core/modules/shortcut/shortcut.admin.inc b/core/modules/shortcut/shortcut.admin.inc
index 30530af..a75c4e1 100644
--- a/core/modules/shortcut/shortcut.admin.inc
+++ b/core/modules/shortcut/shortcut.admin.inc
@@ -55,7 +55,7 @@ function shortcut_set_switch($form, &$form_state, $account = NULL) {
 
     $form['set'] = array(
       '#type' => 'radios',
-      '#title' => $user->id() == $account->id() ? t('Choose a set of shortcuts to use') : t('Choose a set of shortcuts for this user'),
+      '#title' => $user->uid == $account->uid ? t('Choose a set of shortcuts to use') : t('Choose a set of shortcuts for this user'),
       '#options' => $options,
       '#default_value' => $current_set->id(),
     );
@@ -85,7 +85,7 @@ function shortcut_set_switch($form, &$form_state, $account = NULL) {
       '#required' => FALSE,
     );
 
-    if ($user->id() != $account->id()) {
+    if ($user->uid != $account->uid) {
       $default_set = shortcut_default_set($account);
       $form['new']['#description'] = t('The new set is created by copying items from the %default set.', array('%default' => $default_set->label()));
     }
@@ -147,7 +147,7 @@ function shortcut_set_switch_submit($form, &$form_state) {
       '%set_name' => $set->label(),
       '@switch-url' => url(current_path()),
     );
-    if ($account->id() == $user->id()) {
+    if ($account->uid == $user->uid) {
       // Only administrators can create new shortcut sets, so we know they have
       // access to switch back.
       drupal_set_message(t('You are now using the new %set_name shortcut set. You can edit it from this page or <a href="@switch-url">switch back to a different one.</a>', $replacements));
@@ -164,7 +164,7 @@ function shortcut_set_switch_submit($form, &$form_state) {
       '%user' => $account->name,
       '%set_name' => $set->label(),
     );
-    drupal_set_message($account->id() == $user->id() ? t('You are now using the %set_name shortcut set.', $replacements) : t('%user is now using the %set_name shortcut set.', $replacements));
+    drupal_set_message($account->uid == $user->uid ? t('You are now using the %set_name shortcut set.', $replacements) : t('%user is now using the %set_name shortcut set.', $replacements));
   }
 
   // Assign the shortcut set to the provided user account.
@@ -172,6 +172,14 @@ function shortcut_set_switch_submit($form, &$form_state) {
 }
 
 /**
+ * Page callback: provides the shortcut set creation form.
+ */
+function shortcut_set_add() {
+  $entity = entity_create('shortcut', array());
+  return Drupal::entityManager()->getForm($entity);
+}
+
+/**
  * Form callback: builds the form for adding a new shortcut link.
  *
  * @param $form
diff --git a/core/modules/shortcut/shortcut.module b/core/modules/shortcut/shortcut.module
index c23577c..c58bf8a 100644
--- a/core/modules/shortcut/shortcut.module
+++ b/core/modules/shortcut/shortcut.module
@@ -32,7 +32,7 @@ function shortcut_help($path, $arg) {
     case 'admin/config/user-interface/shortcut':
     case 'admin/config/user-interface/shortcut/%':
       if (user_access('switch shortcut sets')) {
-        $output = '<p>' . t('Define which shortcut set you are using on the <a href="@shortcut-link">Shortcuts tab</a> of your account page.', array('@shortcut-link' => url("user/{$user->id()}/shortcuts"))) . '</p>';
+        $output = '<p>' . t('Define which shortcut set you are using on the <a href="@shortcut-link">Shortcuts tab</a> of your account page.', array('@shortcut-link' => url("user/{$user->uid}/shortcuts"))) . '</p>';
         return $output;
       }
   }
@@ -91,8 +91,10 @@ function shortcut_menu() {
   );
   $items['admin/config/user-interface/shortcut/add-set'] = array(
     'title' => 'Add shortcut set',
-    'route_name' => 'shortcut_set_add',
-    'type' => MENU_SIBLING_LOCAL_TASK,
+    'page callback' => 'shortcut_set_add',
+    'access arguments' => array('administer shortcuts'),
+    'type' => MENU_LOCAL_ACTION,
+    'file' => 'shortcut.admin.inc',
   );
   $items['admin/config/user-interface/shortcut/manage/%shortcut_set'] = array(
     'title' => 'Edit shortcuts',
@@ -206,7 +208,7 @@ function shortcut_set_switch_access($account = NULL) {
     return FALSE;
   }
 
-  if (!isset($account) || $user->id() == $account->id()) {
+  if (!isset($account) || $user->uid == $account->uid) {
     // Users with the 'switch shortcut sets' permission can switch their own
     // shortcuts sets.
     return TRUE;
@@ -327,8 +329,8 @@ function shortcut_current_displayed_set($account = NULL) {
     $account = $user;
   }
   // Try to return a shortcut set from the static cache.
-  if (isset($shortcut_sets[$account->id()])) {
-    return $shortcut_sets[$account->id()];
+  if (isset($shortcut_sets[$account->uid])) {
+    return $shortcut_sets[$account->uid];
   }
   // If none was found, try to find a shortcut set that is explicitly assigned
   // to this user.
@@ -343,7 +345,7 @@ function shortcut_current_displayed_set($account = NULL) {
     $shortcut_set = shortcut_default_set($account);
   }
 
-  $shortcut_sets[$account->id()] = $shortcut_set;
+  $shortcut_sets[$account->uid] = $shortcut_set;
   return $shortcut_set;
 }
 
@@ -534,7 +536,7 @@ function shortcut_toolbar() {
         '#options' => array(
           'attributes' => array(
             'title' => t('Shortcuts'),
-            'class' => array('toolbar-icon', 'toolbar-icon-shortcut'),
+            'class' => array('icon', 'icon-shortcut'),
           ),
         ),
       ),
diff --git a/core/modules/shortcut/shortcut.routing.yml b/core/modules/shortcut/shortcut.routing.yml
index e6bb718..dbd1376 100644
--- a/core/modules/shortcut/shortcut.routing.yml
+++ b/core/modules/shortcut/shortcut.routing.yml
@@ -19,13 +19,6 @@ shortcut_set_admin:
   requirements:
     _permission: 'administer shortcuts'
 
-shortcut_set_add:
-  pattern: '/admin/config/user-interface/shortcut/add-set'
-  defaults:
-    _entity_form: 'shortcut.add'
-  requirements:
-    _entity_create_access: 'shortcut'
-
 shortcut_set_edit:
   pattern: '/admin/config/user-interface/shortcut/manage/{shortcut}/edit'
   defaults:
diff --git a/core/modules/simpletest/files/css_test_files/comment_hacks.css b/core/modules/simpletest/files/css_test_files/comment_hacks.css
new file mode 100644
index 0000000..8b12d6c
--- /dev/null
+++ b/core/modules/simpletest/files/css_test_files/comment_hacks.css
@@ -0,0 +1,80 @@
+/*
+* A sample css file, designed to test the effectiveness and stability
+* of function <code>drupal_load_stylesheet_content()</code>.
+*
+*/
+/*
+A large comment block to test for segfaults and speed. This is 60K a's. Extreme but useful to demonstrate flaws in comment striping regexp. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa*/
+.test1 { display:block;}
+
+/* A multiline IE-mac hack (v.2) taken fron Zen theme*/
+/* Hides from IE-mac \*/
+html .clear-block {
+ height: 1%;
+}
+.clear-block {
+ display: block;
+ font:italic bold 12px/30px Georgia, serif;
+}
+
+/* End hide from IE-mac */
+.test2 { display:block; }
+
+/* v1 of the commented backslash hack. This \ character between rules appears to have the effect
+that macIE5 ignores the following rule. Odd, but extremely useful. */
+.bkslshv1 { background-color: #c00; }
+.test3 { display:block; }
+
+/**************** A multiline, multistar comment ***************
+****************************************************************/
+.test4 { display:block;}
+
+/**************************************/
+.comment-in-double-quotes:before {
+  content: "/* ";
+}
+.this_rule_must_stay {
+  color: #f00;
+  background-color: #fff;
+}
+.comment-in-double-quotes:after {
+  content: " */";
+}
+/**************************************/
+.comment-in-single-quotes:before {
+  content: '/*';
+}
+.this_rule_must_stay {
+  color: #f00;
+  background-color: #fff;
+}
+.comment-in-single-quotes:after {
+  content: '*/';
+}
+/**************************************/
+.comment-in-mixed-quotes:before {
+  content: '"/*"';
+}
+.this_rule_must_stay {
+  color: #f00;
+  background-color: #fff;
+}
+.comment-in-mixed-quotes:after {
+  content: "'*/'";
+}
+/**************************************/
+.comment-in-quotes-with-escaped:before {
+  content: '/* \" \' */';
+}
+.this_rule_must_stay {
+  color: #f00;
+  background-color: #fff;
+}
+.comment-in-quotes-with-escaped:after {
+  content: "*/ \" \ '";
+}
+/************************************/
+/*
+"This has to go"
+'This has to go'
+*/
diff --git a/core/modules/simpletest/files/css_test_files/comment_hacks.css.optimized.css b/core/modules/simpletest/files/css_test_files/comment_hacks.css.optimized.css
new file mode 100644
index 0000000..4e6615a
--- /dev/null
+++ b/core/modules/simpletest/files/css_test_files/comment_hacks.css.optimized.css
@@ -0,0 +1 @@
+.test1{display:block;}html .clear-block{height:1%;}.clear-block{display:block;font:italic bold 12px/30px Georgia,serif;}.test2{display:block;}.bkslshv1{background-color:#c00;}.test3{display:block;}.test4{display:block;}.comment-in-double-quotes:before{content:"/* ";}.this_rule_must_stay{color:#f00;background-color:#fff;}.comment-in-double-quotes:after{content:" */";}.comment-in-single-quotes:before{content:'/*';}.this_rule_must_stay{color:#f00;background-color:#fff;}.comment-in-single-quotes:after{content:'*/';}.comment-in-mixed-quotes:before{content:'"/*"';}.this_rule_must_stay{color:#f00;background-color:#fff;}.comment-in-mixed-quotes:after{content:"'*/'";}.comment-in-quotes-with-escaped:before{content:'/* \" \' */';}.this_rule_must_stay{color:#f00;background-color:#fff;}.comment-in-quotes-with-escaped:after{content:"*/ \" \ '";}
diff --git a/core/modules/simpletest/files/css_test_files/comment_hacks.css.unoptimized.css b/core/modules/simpletest/files/css_test_files/comment_hacks.css.unoptimized.css
new file mode 100644
index 0000000..8b12d6c
--- /dev/null
+++ b/core/modules/simpletest/files/css_test_files/comment_hacks.css.unoptimized.css
@@ -0,0 +1,80 @@
+/*
+* A sample css file, designed to test the effectiveness and stability
+* of function <code>drupal_load_stylesheet_content()</code>.
+*
+*/
+/*
+A large comment block to test for segfaults and speed. This is 60K a's. Extreme but useful to demonstrate flaws in comment striping regexp. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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zen theme*/
+/* Hides from IE-mac \*/
+html .clear-block {
+ height: 1%;
+}
+.clear-block {
+ display: block;
+ font:italic bold 12px/30px Georgia, serif;
+}
+
+/* End hide from IE-mac */
+.test2 { display:block; }
+
+/* v1 of the commented backslash hack. This \ character between rules appears to have the effect
+that macIE5 ignores the following rule. Odd, but extremely useful. */
+.bkslshv1 { background-color: #c00; }
+.test3 { display:block; }
+
+/**************** A multiline, multistar comment ***************
+****************************************************************/
+.test4 { display:block;}
+
+/**************************************/
+.comment-in-double-quotes:before {
+  content: "/* ";
+}
+.this_rule_must_stay {
+  color: #f00;
+  background-color: #fff;
+}
+.comment-in-double-quotes:after {
+  content: " */";
+}
+/**************************************/
+.comment-in-single-quotes:before {
+  content: '/*';
+}
+.this_rule_must_stay {
+  color: #f00;
+  background-color: #fff;
+}
+.comment-in-single-quotes:after {
+  content: '*/';
+}
+/**************************************/
+.comment-in-mixed-quotes:before {
+  content: '"/*"';
+}
+.this_rule_must_stay {
+  color: #f00;
+  background-color: #fff;
+}
+.comment-in-mixed-quotes:after {
+  content: "'*/'";
+}
+/**************************************/
+.comment-in-quotes-with-escaped:before {
+  content: '/* \" \' */';
+}
+.this_rule_must_stay {
+  color: #f00;
+  background-color: #fff;
+}
+.comment-in-quotes-with-escaped:after {
+  content: "*/ \" \ '";
+}
+/************************************/
+/*
+"This has to go"
+'This has to go'
+*/
diff --git a/core/modules/simpletest/files/css_test_files/css_input_with_import.css b/core/modules/simpletest/files/css_test_files/css_input_with_import.css
new file mode 100644
index 0000000..87afcb3
--- /dev/null
+++ b/core/modules/simpletest/files/css_test_files/css_input_with_import.css
@@ -0,0 +1,30 @@
+
+
+@import "import1.css";
+@import "import2.css";
+
+body {
+  margin: 0;
+  padding: 0;
+  background: #edf5fa;
+  font: 76%/170% Verdana, sans-serif;
+  color: #494949;
+}
+
+.this .is .a .test {
+  font: 1em/100% Verdana, sans-serif;
+  color: #494949;
+}
+.this
+.is
+.a
+.test {
+font: 1em/100% Verdana, sans-serif;
+color: #494949;
+}
+
+textarea, select {
+  font: 1em/160% Verdana, sans-serif;
+  color: #494949;
+}
+
diff --git a/core/modules/simpletest/files/css_test_files/css_input_with_import.css.optimized.css b/core/modules/simpletest/files/css_test_files/css_input_with_import.css.optimized.css
new file mode 100644
index 0000000..698d9aa
--- /dev/null
+++ b/core/modules/simpletest/files/css_test_files/css_input_with_import.css.optimized.css
@@ -0,0 +1,6 @@
+ul,select{font:1em/160% Verdana,sans-serif;color:#494949;}.ui-icon{background-image:url(images/icon.png);}
+p,select{font:1em/160% Verdana,sans-serif;color:#494949;}
+body{margin:0;padding:0;background:#edf5fa;font:76%/170% Verdana,sans-serif;color:#494949;}.this .is .a .test{font:1em/100% Verdana,sans-serif;color:#494949;}.this
+.is
+.a
+.test{font:1em/100% Verdana,sans-serif;color:#494949;}textarea,select{font:1em/160% Verdana,sans-serif;color:#494949;}
diff --git a/core/modules/simpletest/files/css_test_files/css_input_with_import.css.unoptimized.css b/core/modules/simpletest/files/css_test_files/css_input_with_import.css.unoptimized.css
new file mode 100644
index 0000000..4c905f5
--- /dev/null
+++ b/core/modules/simpletest/files/css_test_files/css_input_with_import.css.unoptimized.css
@@ -0,0 +1,30 @@
+
+
+
+
+
+body {
+  margin: 0;
+  padding: 0;
+  background: #edf5fa;
+  font: 76%/170% Verdana, sans-serif;
+  color: #494949;
+}
+
+.this .is .a .test {
+  font: 1em/100% Verdana, sans-serif;
+  color: #494949;
+}
+.this
+.is
+.a
+.test {
+font: 1em/100% Verdana, sans-serif;
+color: #494949;
+}
+
+textarea, select {
+  font: 1em/160% Verdana, sans-serif;
+  color: #494949;
+}
+
diff --git a/core/modules/simpletest/files/css_test_files/css_input_without_import.css b/core/modules/simpletest/files/css_test_files/css_input_without_import.css
new file mode 100644
index 0000000..118dfa4
--- /dev/null
+++ b/core/modules/simpletest/files/css_test_files/css_input_without_import.css
@@ -0,0 +1,65 @@
+
+/**
+ * @file Basic css that does not use import
+ */
+
+
+body {
+  margin: 0;
+  padding: 0;
+  background: #edf5fa;
+  font: 76%/170% Verdana, sans-serif;
+  color: #494949;
+}
+
+.this .is .a .test {
+  font: 1em/100% Verdana, sans-serif;
+  color: #494949;
+}
+
+/**
+ * CSS spec says that all whitespace is valid whitespace, so this selector
+ * should be just as good as the one above.
+ */
+.this
+.is
+.a
+.test {
+font: 1em/100% Verdana, sans-serif;
+color: #494949;
+}
+
+some :pseudo .thing {
+  border-radius: 3px;
+}
+
+::-moz-selection {
+  background: #000;
+  color:#fff;
+
+}
+::selection {
+  background: #000;
+  color: #fff;
+}
+
+@media print {
+  * {
+    background: #000 !important;
+    color: #fff !important;
+  }
+  @page {
+    margin: 0.5cm;
+  }
+}
+
+@media screen and (max-device-width: 480px) {
+  background: #000;
+  color: #fff;
+}
+
+textarea, select {
+  font: 1em/160% Verdana, sans-serif;
+  color: #494949;
+}
+
diff --git a/core/modules/simpletest/files/css_test_files/css_input_without_import.css.optimized.css b/core/modules/simpletest/files/css_test_files/css_input_without_import.css.optimized.css
new file mode 100644
index 0000000..6296378
--- /dev/null
+++ b/core/modules/simpletest/files/css_test_files/css_input_without_import.css.optimized.css
@@ -0,0 +1,4 @@
+body{margin:0;padding:0;background:#edf5fa;font:76%/170% Verdana,sans-serif;color:#494949;}.this .is .a .test{font:1em/100% Verdana,sans-serif;color:#494949;}.this
+.is
+.a
+.test{font:1em/100% Verdana,sans-serif;color:#494949;}some :pseudo .thing{border-radius:3px;}::-moz-selection{background:#000;color:#fff;}::selection{background:#000;color:#fff;}@media print{*{background:#000 !important;color:#fff !important;}@page{margin:0.5cm;}}@media screen and (max-device-width:480px){background:#000;color:#fff;}textarea,select{font:1em/160% Verdana,sans-serif;color:#494949;}
diff --git a/core/modules/simpletest/files/css_test_files/css_input_without_import.css.unoptimized.css b/core/modules/simpletest/files/css_test_files/css_input_without_import.css.unoptimized.css
new file mode 100644
index 0000000..118dfa4
--- /dev/null
+++ b/core/modules/simpletest/files/css_test_files/css_input_without_import.css.unoptimized.css
@@ -0,0 +1,65 @@
+
+/**
+ * @file Basic css that does not use import
+ */
+
+
+body {
+  margin: 0;
+  padding: 0;
+  background: #edf5fa;
+  font: 76%/170% Verdana, sans-serif;
+  color: #494949;
+}
+
+.this .is .a .test {
+  font: 1em/100% Verdana, sans-serif;
+  color: #494949;
+}
+
+/**
+ * CSS spec says that all whitespace is valid whitespace, so this selector
+ * should be just as good as the one above.
+ */
+.this
+.is
+.a
+.test {
+font: 1em/100% Verdana, sans-serif;
+color: #494949;
+}
+
+some :pseudo .thing {
+  border-radius: 3px;
+}
+
+::-moz-selection {
+  background: #000;
+  color:#fff;
+
+}
+::selection {
+  background: #000;
+  color: #fff;
+}
+
+@media print {
+  * {
+    background: #000 !important;
+    color: #fff !important;
+  }
+  @page {
+    margin: 0.5cm;
+  }
+}
+
+@media screen and (max-device-width: 480px) {
+  background: #000;
+  color: #fff;
+}
+
+textarea, select {
+  font: 1em/160% Verdana, sans-serif;
+  color: #494949;
+}
+
diff --git a/core/modules/simpletest/files/css_test_files/import1.css b/core/modules/simpletest/files/css_test_files/import1.css
new file mode 100644
index 0000000..3d5842e
--- /dev/null
+++ b/core/modules/simpletest/files/css_test_files/import1.css
@@ -0,0 +1,6 @@
+
+ul, select {
+  font: 1em/160% Verdana, sans-serif;
+  color: #494949;
+}
+.ui-icon{background-image: url(images/icon.png);}
\ No newline at end of file
diff --git a/core/modules/simpletest/files/css_test_files/import2.css b/core/modules/simpletest/files/css_test_files/import2.css
new file mode 100644
index 0000000..367eb57
--- /dev/null
+++ b/core/modules/simpletest/files/css_test_files/import2.css
@@ -0,0 +1,5 @@
+
+p, select {
+  font: 1em/160% Verdana, sans-serif;
+  color: #494949;
+}
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php
index 54305c0..e54e121 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php
@@ -2,7 +2,7 @@
 
 /**
  * @file
- * Contains \Drupal\simpletest\DrupalUnitTestBase.
+ * Contains Drupal\simpletest\DrupalUnitTestBase.
  */
 
 namespace Drupal\simpletest;
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/Form/SimpletestResultsForm.php b/core/modules/simpletest/lib/Drupal/simpletest/Form/SimpletestResultsForm.php
index 3eb42ce..35c0ce6 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/Form/SimpletestResultsForm.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/Form/SimpletestResultsForm.php
@@ -48,39 +48,31 @@ public static function create(ContainerInterface $container) {
   public function __construct(Connection $database) {
     $this->database = $database;
     // Initialize image mapping property.
-    $image_pass = array(
-      '#theme' => 'image',
-      '#uri' => 'core/misc/watchdog-ok.png',
-      '#width' => 18,
-      '#height' => 18,
-      '#alt' => t('Pass'),
-    );
-    $image_fail = array(
-      '#theme' => 'image',
-      '#uri' => 'core/misc/watchdog-error.png',
-      '#width' => 18,
-      '#height' => 18,
-      '#alt' => t('Fail'),
-    );
-    $image_exception = array(
-      '#theme' => 'image',
-      '#uri' => 'core/misc/watchdog-warning.png',
-      '#width' => 18,
-      '#height' => 18,
-      '#alt' => t('Exception'),
-    );
-    $image_debug = array(
-      '#theme' => 'image',
-      '#uri' => 'core/misc/watchdog-warning.png',
-      '#width' => 18,
-      '#height' => 18,
-      '#alt' => t('Debug'),
-    );
     $this->statusImageMap = array(
-      'pass' => drupal_render($image_pass),
-      'fail' => drupal_render($image_fail),
-      'exception' => drupal_render($image_exception),
-      'debug' => drupal_render($image_debug),
+      'pass' => theme('image', array(
+        'uri' => 'core/misc/watchdog-ok.png',
+        'width' => 18,
+        'height' => 18,
+        'alt' => t('Pass')
+      )),
+      'fail' => theme('image', array(
+        'uri' => 'core/misc/watchdog-error.png',
+        'width' => 18,
+        'height' => 18,
+        'alt' => t('Fail')
+      )),
+      'exception' => theme('image', array(
+        'uri' => 'core/misc/watchdog-warning.png',
+        'width' => 18,
+        'height' => 18,
+        'alt' => t('Exception')
+      )),
+      'debug' => theme('image', array(
+        'uri' => 'core/misc/watchdog-warning.png',
+        'width' => 18,
+        'height' => 18,
+        'alt' => t('Debug')
+      )),
     );
   }
 
@@ -95,8 +87,7 @@ public function getFormID() {
    * {@inheritdoc}
    */
   public function buildForm(array $form, array &$form_state, $test_id = NULL) {
-    // Make sure there are test results to display and a re-run is not being
-    // performed.
+    // Make sure there are test results to display and a re-run is not being performed.
     $results = array();
 
     if (is_numeric($test_id) && !$results = $this->getResults($test_id)) {
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
index 4780e85..3eb5c84 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
@@ -2,7 +2,7 @@
 
 /**
  * @file
- * Definition of \Drupal\simpletest\TestBase.
+ * Definition of Drupal\simpletest\TestBase.
  */
 
 namespace Drupal\simpletest;
@@ -23,8 +23,8 @@
 /**
  * Base class for Drupal tests.
  *
- * Do not extend this class directly, use either
- * \Drupal\simpletest\WebTestBaseBase or \Drupal\simpletest\UnitTestBaseBase.
+ * Do not extend this class directly, use either Drupal\simpletest\WebTestBaseBase
+ * or Drupal\simpletest\UnitTestBaseBase.
  */
 abstract class TestBase {
   /**
@@ -273,14 +273,14 @@ protected function assert($status, $message = '', $group = 'Other', array $calle
    * the test case has been destroyed, such as PHP fatal errors. The caller
    * information is not automatically gathered since the caller is most likely
    * inserting the assertion on behalf of other code. In all other respects
-   * the method behaves just like \Drupal\simpletest\TestBase::assert() in terms
+   * the method behaves just like Drupal\simpletest\TestBase::assert() in terms
    * of storing the assertion.
    *
    * @return
    *   Message ID of the stored assertion.
    *
-   * @see \Drupal\simpletest\TestBase::assert()
-   * @see \Drupal\simpletest\TestBase::deleteAssert()
+   * @see Drupal\simpletest\TestBase::assert()
+   * @see Drupal\simpletest\TestBase::deleteAssert()
    */
   public static function insertAssert($test_id, $test_class, $status, $message = '', $group = 'Other', array $caller = array()) {
     // Convert boolean status to string status.
@@ -319,7 +319,7 @@ public static function insertAssert($test_id, $test_class, $status, $message = '
    * @return
    *   TRUE if the assertion was deleted, FALSE otherwise.
    *
-   * @see \Drupal\simpletest\TestBase::insertAssert()
+   * @see Drupal\simpletest\TestBase::insertAssert()
    */
   public static function deleteAssert($message_id) {
     return (bool) self::getDatabaseConnection()
@@ -331,7 +331,7 @@ public static function deleteAssert($message_id) {
   /**
    * Returns the database connection to the site running Simpletest.
    *
-   * @return \Drupal\Core\Database\Connection
+   * @return Drupal\Core\Database\Connection
    *   The database connection to use for inserting assertions.
    */
   public static function getDatabaseConnection() {
@@ -369,9 +369,7 @@ protected function getAssertionCall() {
   }
 
   /**
-   * Check to see if a value is not false.
-   *
-   * False values are: empty string, 0, NULL, and FALSE.
+   * Check to see if a value is not false (not an empty string, 0, NULL, or FALSE).
    *
    * @param $value
    *   The value on which the assertion is to be done.
@@ -392,9 +390,7 @@ protected function assertTrue($value, $message = '', $group = 'Other') {
   }
 
   /**
-   * Check to see if a value is false.
-   *
-   * False values are: empty string, 0, NULL, and FALSE.
+   * Check to see if a value is false (an empty string, 0, NULL, or FALSE).
    *
    * @param $value
    *   The value on which the assertion is to be done.
@@ -993,7 +989,7 @@ protected function rebuildContainer() {
   }
 
   /**
-   * Deletes created files, database tables, and reverts environment changes.
+   * Deletes created files, database tables, and reverts all environment changes.
    *
    * This method needs to be invoked for both unit and integration tests.
    *
@@ -1132,8 +1128,7 @@ protected function exceptionHandler($exception) {
       'line' => $exception->getLine(),
       'file' => $exception->getFile(),
     ));
-    // The exception message is run through check_plain()
-    // by _drupal_decode_exception().
+    // The exception message is run through check_plain() by _drupal_decode_exception().
     $decoded_exception = _drupal_decode_exception($exception);
     unset($decoded_exception['backtrace']);
     $message = format_string('%type: !message in %function (line %line of %file). <pre class="backtrace">!backtrace</pre>', $decoded_exception + array(
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/Tests/BrokenSetUpTest.php b/core/modules/simpletest/lib/Drupal/simpletest/Tests/BrokenSetUpTest.php
index b2ba376..af9303a 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/Tests/BrokenSetUpTest.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/Tests/BrokenSetUpTest.php
@@ -2,7 +2,7 @@
 
 /**
  * @file
- * Definition of \Drupal\simpletest\Tests\BrokenSetUpTest.
+ * Definition of Drupal\simpletest\Tests\BrokenSetUpTest.
  */
 
 namespace Drupal\simpletest\Tests;
@@ -13,11 +13,11 @@
  * Tests a test case that does not run parent::setUp() in its setUp() method.
  *
  * If a test case does not call parent::setUp(), running
- * \Drupal\simpletest\WebTestBase::tearDown() would destroy the main site's
+ * Drupal\simpletest\WebTestBase::tearDown() would destroy the main site's
  * database tables. Therefore, we ensure that tests which are not set up
  * properly are skipped.
  *
- * @see \Drupal\simpletest\WebTestBase
+ * @see Drupal\simpletest\WebTestBase
  */
 class BrokenSetUpTest extends WebTestBase {
 
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/Tests/BrowserTest.php b/core/modules/simpletest/lib/Drupal/simpletest/Tests/BrowserTest.php
index 41c166c..0e27818 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/Tests/BrowserTest.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/Tests/BrowserTest.php
@@ -2,7 +2,7 @@
 
 /**
  * @file
- * Definition of \Drupal\simpletest\Tests\BrowserTest.
+ * Definition of Drupal\simpletest\Tests\BrowserTest.
  */
 
 namespace Drupal\simpletest\Tests;
@@ -22,7 +22,7 @@ public static function getInfo() {
   }
 
   /**
-   * Test \Drupal\simpletest\WebTestBase::getAbsoluteUrl().
+   * Test Drupal\simpletest\WebTestBase::getAbsoluteUrl().
    */
   function testGetAbsoluteUrl() {
     $url = 'user/login';
@@ -52,8 +52,6 @@ function testXPathEscaping() {
 <body>
 <a href="link1">A "weird" link, just to bother the dumb "XPath 1.0"</a>
 <a href="link2">A second "even more weird" link, in memory of George O'Malley</a>
-<a href="link3">A \$third$ link, so weird it's worth $1 million</a>
-<a href="link4">A fourth link, containing alternative \\1 regex backreferences \\2</a>
 </body>
 </html>
 EOF;
@@ -65,11 +63,5 @@ function testXPathEscaping() {
 
     $urls = $this->xpath('//a[text()=:text]', array(':text' => 'A second "even more weird" link, in memory of George O\'Malley'));
     $this->assertEqual($urls[0]['href'], 'link2', 'Match with mixed single and double quotes.');
-
-    $urls = $this->xpath('//a[text()=:text]', array(':text' => 'A $third$ link, so weird it\'s worth $1 million'));
-    $this->assertEqual($urls[0]['href'], 'link3', 'Match with a regular expression back reference symbol (dollar sign).');
-
-    $urls = $this->xpath('//a[text()=:text]', array(':text' => 'A fourth link, containing alternative \\1 regex backreferences \\2'));
-    $this->assertEqual($urls[0]['href'], 'link4', 'Match with another regular expression back reference symbol (double backslash).');
   }
 }
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php b/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php
index 58da4c3..a7be5be 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php
@@ -2,7 +2,7 @@
 
 /**
  * @file
- * Contains \Drupal\simpletest\Tests\DrupalUnitTestBaseTest.
+ * Contains Drupal\simpletest\Tests\DrupalUnitTestBaseTest.
  */
 
 namespace Drupal\simpletest\Tests;
@@ -104,7 +104,7 @@ function testEnableModulesInstall() {
   }
 
   /**
-   * Tests installing modules with DependencyInjection services.
+   * Tests installing modules via enableModules() with DepedencyInjection services.
    */
   function testEnableModulesInstallContainer() {
     // Install Node module.
@@ -195,7 +195,7 @@ function testInstallConfig() {
   }
 
   /**
-   * Tests that the module list is retained after enabling/installing/disabling.
+   * Tests that the module list is retained after enabling/installing/disabling modules.
    */
   function testEnableModulesFixedList() {
     // entity_test is loaded via $modules; its entity type should exist.
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/Tests/FolderTest.php b/core/modules/simpletest/lib/Drupal/simpletest/Tests/FolderTest.php
index 878bda7..fa9db2e 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/Tests/FolderTest.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/Tests/FolderTest.php
@@ -2,7 +2,7 @@
 
 /**
  * @file
- * Definition of \Drupal\simpletest\Tests\FolderTest.
+ * Definition of Drupal\simpletest\Tests\FolderTest.
  */
 
 namespace Drupal\simpletest\Tests;
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/Tests/InstallationProfileModuleTestsTest.php b/core/modules/simpletest/lib/Drupal/simpletest/Tests/InstallationProfileModuleTestsTest.php
index f1e7fa8..5af5c0d 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/Tests/InstallationProfileModuleTestsTest.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/Tests/InstallationProfileModuleTestsTest.php
@@ -2,7 +2,7 @@
 
 /**
  * @file
- * Definition of \Drupal\simpletest\Tests\InstallationProfileModuleTestsTest.
+ * Definition of Drupal\simpletest\Tests\InstallationProfileModuleTestsTest.
  */
 
 namespace Drupal\simpletest\Tests;
@@ -31,7 +31,7 @@ class InstallationProfileModuleTestsTest extends WebTestBase {
    * - but still install the drupal_system_listing_compatible_test.module
    *   contained in the Testing profile.
    *
-   * @see \Drupal\drupal_system_listing_compatible_test\Tests\SystemListingCompatibleTest
+   * @see Drupal\drupal_system_listing_compatible_test\Tests\SystemListingCompatibleTest
    */
   protected $profile = 'testing';
 
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/Tests/MailCaptureTest.php b/core/modules/simpletest/lib/Drupal/simpletest/Tests/MailCaptureTest.php
index c16457d..95481d1 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/Tests/MailCaptureTest.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/Tests/MailCaptureTest.php
@@ -2,7 +2,7 @@
 
 /**
  * @file
- * Definition of \Drupal\simpletest\Tests\MailCaptureTest.
+ * Definition of Drupal\simpletest\Tests\MailCaptureTest.
  */
 
 namespace Drupal\simpletest\Tests;
@@ -77,9 +77,8 @@ function testMailSend() {
     $captured_emails = $this->drupalGetMails(array('id' => 'drupal_mail_test', 'subject' => $subject, 'from' => 'this_was_not_used@example.com'));
     $this->assertEqual(count($captured_emails), 0, 'No e-mails are returned when querying with an unused from address.', 'E-mail');
 
-    // Send the last e-mail again, so we can confirm that the
-    // drupalGetMails-filter correctly returns all e-mails with a given
-    // property/value.
+    // Send the last e-mail again, so we can confirm that the drupalGetMails-filter
+    // correctly returns all e-mails with a given property/value.
     drupal_mail_system('drupal_mail_test', $index)->mail($message);
     $captured_emails = $this->drupalGetMails(array('id' => 'drupal_mail_test_4'));
     $this->assertEqual(count($captured_emails), 2, 'All e-mails with the same id are returned when filtering by id.', 'E-mail');
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/Tests/MissingCheckedRequirementsTest.php b/core/modules/simpletest/lib/Drupal/simpletest/Tests/MissingCheckedRequirementsTest.php
index db1928d..b43aece 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/Tests/MissingCheckedRequirementsTest.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/Tests/MissingCheckedRequirementsTest.php
@@ -2,7 +2,7 @@
 
 /**
  * @file
- * Definition of \Drupal\simpletest\Tests\MissingCheckedRequirementsTest.
+ * Definition of Drupal\simpletest\Tests\MissingCheckedRequirementsTest.
  */
 
 namespace Drupal\simpletest\Tests;
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/Tests/MissingDependentModuleUnitTest.php b/core/modules/simpletest/lib/Drupal/simpletest/Tests/MissingDependentModuleUnitTest.php
index 08874bd..7cd0a76 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/Tests/MissingDependentModuleUnitTest.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/Tests/MissingDependentModuleUnitTest.php
@@ -2,7 +2,7 @@
 
 /**
  * @file
- * Definition of \Drupal\simpletest\Tests\MissingDependentModuleUnitTest.
+ * Definition of Drupal\simpletest\Tests\MissingDependentModuleUnitTest.
  */
 
 namespace Drupal\simpletest\Tests;
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/Tests/OtherInstallationProfileModuleTestsTest.php b/core/modules/simpletest/lib/Drupal/simpletest/Tests/OtherInstallationProfileModuleTestsTest.php
index 1b87a17..7f01be2 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/Tests/OtherInstallationProfileModuleTestsTest.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/Tests/OtherInstallationProfileModuleTestsTest.php
@@ -2,7 +2,7 @@
 
 /**
  * @file
- * Definition of \Drupal\simpletest\Tests\OtherInstallationProfileModuleTestsTest.
+ * Definition of Drupal\simpletest\Tests\OtherInstallationProfileModuleTestsTest.
  */
 
 namespace Drupal\simpletest\Tests;
@@ -30,7 +30,7 @@ class OtherInstallationProfileModuleTestsTest extends WebTestBase {
    * which should not be found.
    *
    * @see SimpleTestInstallationProfileModuleTestsTestCase
-   * @see \Drupal\drupal_system_listing_compatible_test\Tests\SystemListingCompatibleTest
+   * @see Drupal\drupal_system_listing_compatible_test\Tests\SystemListingCompatibleTest
    */
   protected $profile = 'minimal';
 
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/Tests/SimpleTestTest.php b/core/modules/simpletest/lib/Drupal/simpletest/Tests/SimpleTestTest.php
index 846d587..7631016 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/Tests/SimpleTestTest.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/Tests/SimpleTestTest.php
@@ -2,7 +2,7 @@
 
 /**
  * @file
- * Definition of \Drupal\simpletest\Tests\SimpleTestTest.
+ * Definition of Drupal\simpletest\Tests\SimpleTestTest.
  */
 
 namespace Drupal\simpletest\Tests;
@@ -25,9 +25,8 @@ class SimpleTestTest extends WebTestBase {
   protected $childTestResults;
 
   /**
-   * Stores the test ID from each test run for comparison.
-   *
-   * Used to ensure they are incrementing.
+   * Store the test ID from each test run for comparison, to ensure they are
+   * incrementing.
    */
   protected $test_ids = array();
 
@@ -132,7 +131,8 @@ function testUserAgentValidation() {
   }
 
   /**
-   * Ensures the tests selected through the web interface are run and displayed.
+   * Make sure that tests selected through the web interface are run and
+   * that the results are displayed correctly.
    */
   function testWebTestRunner() {
     $this->pass = t('SimpleTest pass.');
@@ -141,8 +141,7 @@ function testWebTestRunner() {
     $this->invalid_permission = 'invalid permission';
 
     if ($this->inCURL()) {
-      // Only run following code if this test is running itself through a CURL
-      // request.
+      // Only run following code if this test is running itself through a CURL request.
       $this->stubTest();
     }
     else {
@@ -216,9 +215,9 @@ function confirmStubTestResults() {
     // Check that the backtracing code works for specific assert function.
     $this->assertAssertion('This is nothing.', 'Other', 'Pass', 'SimpleTestTest.php', 'Drupal\simpletest\Tests\SimpleTestTest->stubTest()');
 
-    // Check that errors that occur inside PHP internal functions are correctly
-    // reported. The exact error message differs between PHP versions so we
-    // check only the function name 'array_key_exists'.
+    // Check that errors that occur inside PHP internal functions are correctly reported.
+    // The exact error message differs between PHP versions so we check only
+    // the function name 'array_key_exists'.
     $this->assertAssertion('array_key_exists', 'Warning', 'Fail', 'SimpleTestTest.php', 'Drupal\simpletest\Tests\SimpleTestTest->stubTest()');
 
     $this->assertAssertion("Debug: 'Foo'", 'Debug', 'Fail', 'SimpleTestTest.php', 'Drupal\simpletest\Tests\SimpleTestTest->stubTest()');
@@ -242,7 +241,8 @@ function getTestIdFromResults() {
   }
 
   /**
-   * Asserts that an assertion with specified values is displayed in results.
+   * Assert that an assertion with the specified values is displayed
+   * in the test results.
    *
    * @param string $message Assertion message.
    * @param string $type Assertion type.
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/UnitTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/UnitTestBase.php
index b869360..d7bd225 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/UnitTestBase.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/UnitTestBase.php
@@ -35,10 +35,10 @@ function __construct($test_id = NULL) {
   /**
    * Sets up unit test environment.
    *
-   * Unlike \Drupal\simpletest\WebTestBase::setUp(), UnitTestBase::setUp() does
-   * not install modules because tests are performed without accessing the
-   * database. Any required files must be explicitly included by the child class
-   * setUp() method.
+   * Unlike Drupal\simpletest\WebTestBase::setUp(), UnitTestBase::setUp() does not
+   * install modules because tests are performed without accessing the database.
+   * Any required files must be explicitly included by the child class setUp()
+   * method.
    */
   protected function setUp() {
     global $conf;
@@ -60,7 +60,7 @@ protected function setUp() {
 
     // Change the database prefix.
     // All static variables need to be reset before the database prefix is
-    // changed, since \Drupal\Core\Utility\CacheArray implementations attempt to
+    // changed, since Drupal\Core\Utility\CacheArray implementations attempt to
     // write back to persistent caches when they are destructed.
     $this->changeDatabasePrefix();
     if (!$this->setupDatabasePrefix) {
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
index f0aa5fd..8e295b3 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
@@ -2,14 +2,13 @@
 
 /**
  * @file
- * Definition of \Drupal\simpletest\WebTestBase.
+ * Definition of Drupal\simpletest\WebTestBase.
  */
 
 namespace Drupal\simpletest;
 
 use Drupal\Component\Utility\Crypt;
 use Drupal\Component\Utility\NestedArray;
-use Drupal\Component\Utility\String;
 use Drupal\Core\DrupalKernel;
 use Drupal\Core\Database\Database;
 use Drupal\Core\Database\ConnectionNotDefinedException;
@@ -73,16 +72,14 @@
   protected $content;
 
   /**
-   * The plain-text content of the currently-loaded page.
+   * The content of the page currently loaded in the internal browser (plain text version).
    *
    * @var string
    */
   protected $plainTextContent;
 
   /**
-   * The value of Drupal.settings for the currently-loaded page.
-   *
-   * Drupal.settings refers to the Drupal.settings JavaScript variable.
+   * The value of the Drupal.settings JavaScript variable for the page currently loaded in the internal browser.
    *
    * @var Array
    */
@@ -113,27 +110,27 @@
   /**
    * Additional cURL options.
    *
-   * \Drupal\simpletest\WebTestBase itself never sets this but always obeys what
-   * is set.
+   * Drupal\simpletest\WebTestBase itself never sets this but always obeys what is
+   * set.
    */
   protected $additionalCurlOptions = array();
 
   /**
-   * The original user, before it was changed to a clean uid = 1 for testing.
+   * The original user, before it was changed to a clean uid = 1 for testing purposes.
    *
    * @var object
    */
   protected $originalUser = NULL;
 
   /**
-   * The original shutdown handlers array, before it was cleaned for testing.
+   * The original shutdown handlers array, before it was cleaned for testing purposes.
    *
    * @var array
    */
   protected $originalShutdownCallbacks = array();
 
   /**
-   * HTTP authentication method.
+   * HTTP authentication method
    */
   protected $httpauth_method = CURLAUTH_BASIC;
 
@@ -173,7 +170,7 @@
   protected $kernel;
 
   /**
-   * Constructor for \Drupal\simpletest\WebTestBase.
+   * Constructor for Drupal\simpletest\WebTestBase.
    */
   function __construct($test_id = NULL) {
     parent::__construct($test_id);
@@ -269,11 +266,11 @@ protected function drupalCreateNode(array $settings = array()) {
     // logged in user if available, or else the user running the test.
     if (!isset($settings['uid'])) {
       if ($this->loggedInUser) {
-        $settings['uid'] = $this->loggedInUser->id();
+        $settings['uid'] = $this->loggedInUser->uid;
       }
       else {
         global $user;
-        $settings['uid'] = $user->id();
+        $settings['uid'] = $user->uid;
       }
     }
 
@@ -322,8 +319,7 @@ protected function drupalCreateContentType(array $values = array()) {
 
     $this->assertEqual($status, SAVED_NEW, t('Created content type %type.', array('%type' => $type->id())));
 
-    // Reset permissions so that permissions for this content type are
-    // available.
+    // Reset permissions so that permissions for this content type are available.
     $this->checkPermissions(array(), TRUE);
 
     return $type;
@@ -381,11 +377,10 @@ protected function drupalPlaceBlock($plugin_id, array $settings = array()) {
   }
 
   /**
-   * Gets a list files that can be used in tests.
+   * Get a list files that can be used in tests.
    *
    * @param $type
-   *   File type, possible values: 'binary', 'html', 'image', 'javascript',
-   *   'php', 'sql', 'text'.
+   *   File type, possible values: 'binary', 'html', 'image', 'javascript', 'php', 'sql', 'text'.
    * @param $size
    *   File size in bytes to match. Please check the tests/files folder.
    * @return
@@ -487,8 +482,8 @@ protected function drupalCreateUser(array $permissions = array(), $name = NULL)
     $account = entity_create('user', $edit);
     $account->save();
 
-    $this->assertTrue($account->id(), String::format('User created with name %name and pass %pass', array('%name' => $edit['name'], '%pass' => $edit['pass'])), 'User login');
-    if (!$account->id()) {
+    $this->assertTrue(!empty($account->uid), t('User created with name %name and pass %pass', array('%name' => $edit['name'], '%pass' => $edit['pass'])), t('User login'));
+    if (empty($account->uid)) {
       return FALSE;
     }
 
@@ -610,7 +605,7 @@ protected function checkPermissions(array $permissions, $reset = FALSE) {
    *   $this->drupalLogin($account);
    *   // Load real user object.
    *   $pass_raw = $account->pass_raw;
-   *   $account = user_load($account->id());
+   *   $account = user_load($account->uid);
    *   $account->pass_raw = $pass_raw;
    * @endcode
    *
@@ -662,19 +657,17 @@ protected function drupalGetToken($value = '') {
     return Crypt::hmacBase64($value, $this->session_id . $private_key);
   }
 
-  /**
-   * Logs a user out of the internal browser and confirms.
-   *
-   * Confirms logout by checking the login page.
+  /*
+   * Logs a user out of the internal browser, then check the login page to confirm logout.
    */
   protected function drupalLogout() {
     // Make a request to the logout page, and redirect to the user page, the
     // idea being if you were properly logged out you should be seeing a login
     // screen.
     $this->drupalGet('user/logout', array('query' => array('destination' => 'user')));
-    $this->assertResponse(200, 'User was logged out.');
-    $pass = $this->assertField('name', 'Username field found.', 'Logout');
-    $pass = $pass && $this->assertField('pass', 'Password field found.', 'Logout');
+    $this->assertResponse(200, t('User was logged out.'));
+    $pass = $this->assertField('name', t('Username field found.'), t('Logout'));
+    $pass = $pass && $this->assertField('pass', t('Password field found.'), t('Logout'));
 
     if ($pass) {
       // @see WebTestBase::drupalUserIsLoggedIn()
@@ -687,7 +680,7 @@ protected function drupalLogout() {
    * Sets up a Drupal site for running functional and integration tests.
    *
    * Generates a random database prefix and installs Drupal with the specified
-   * installation profile in \Drupal\simpletest\WebTestBase::$profile into the
+   * installation profile in Drupal\simpletest\WebTestBase::$profile into the
    * prefixed database. Afterwards, installs any additional modules specified by
    * the test.
    *
@@ -700,9 +693,9 @@ protected function drupalLogout() {
    *   List of modules to enable for the duration of the test. This can be
    *   either a single array or a variable number of string arguments.
    *
-   * @see \Drupal\simpletest\WebTestBase::prepareDatabasePrefix()
-   * @see \Drupal\simpletest\WebTestBase::changeDatabasePrefix()
-   * @see \Drupal\simpletest\WebTestBase::prepareEnvironment()
+   * @see Drupal\simpletest\WebTestBase::prepareDatabasePrefix()
+   * @see Drupal\simpletest\WebTestBase::changeDatabasePrefix()
+   * @see Drupal\simpletest\WebTestBase::prepareEnvironment()
    */
   protected function setUp() {
     global $user, $conf;
@@ -729,7 +722,7 @@ protected function setUp() {
 
     // Change the database prefix.
     // All static variables need to be reset before the database prefix is
-    // changed, since \Drupal\Core\Utility\CacheArray implementations attempt to
+    // changed, since Drupal\Core\Utility\CacheArray implementations attempt to
     // write back to persistent caches when they are destructed.
     $this->changeDatabasePrefix();
     if (!$this->setupDatabasePrefix) {
@@ -899,7 +892,7 @@ protected function writeSettings($settings) {
   }
 
   /**
-   * Overrides \Drupal\simpletest\TestBase::rebuildContainer().
+   * Overrides Drupal\simpletest\TestBase::rebuildContainer().
    */
   protected function rebuildContainer() {
     parent::rebuildContainer();
@@ -909,11 +902,11 @@ protected function rebuildContainer() {
   }
 
   /**
-   * Resets all data structures after having enabled new modules.
+   * Reset all data structures after having enabled new modules.
    *
-   * This method is called by \Drupal\simpletest\WebTestBase::setUp() after
-   * enabling the requested modules. It must be called again when additional
-   * modules are enabled later.
+   * This method is called by Drupal\simpletest\WebTestBase::setUp() after enabling
+   * the requested modules. It must be called again when additional modules
+   * are enabled later.
    */
   protected function resetAll() {
     // Clear all database and static caches and rebuild data structures.
@@ -926,33 +919,27 @@ protected function resetAll() {
   }
 
   /**
-   * Refreshes the in-memory set of variables.
-   *
-   * Useful after a page request is made that changes a variable in a different
-   * thread.
+   * Refresh the in-memory set of variables. Useful after a page request is made
+   * that changes a variable in a different thread.
    *
-   * In other words calling a settings page with $this->drupalPost() with a
-   * changed value would update a variable to reflect that change, but in the
-   * thread that made the call (thread running the test) the changed variable
-   * would not be picked up.
+   * In other words calling a settings page with $this->drupalPost() with a changed
+   * value would update a variable to reflect that change, but in the thread that
+   * made the call (thread running the test) the changed variable would not be
+   * picked up.
    *
-   * This method clears the variables cache and loads a fresh copy from the
-   * database to ensure that the most up-to-date set of variables is loaded.
+   * This method clears the variables cache and loads a fresh copy from the database
+   * to ensure that the most up-to-date set of variables is loaded.
    */
   protected function refreshVariables() {
     global $conf;
     cache('bootstrap')->delete('variables');
     $conf = variable_initialize();
-    // Clear the tag cache.
-    drupal_static_reset('Drupal\Core\Cache\CacheBackendInterface::tagCache');
     drupal_container()->get('config.factory')->reset();
   }
 
   /**
-   * Cleans up after testing.
-   *
-   * Deletes created files and temporary files directory, deletes the tables
-   * created by setUp(), and resets the database prefix.
+   * Delete created files and temporary files directory, delete the tables created by setUp(),
+   * and reset the database prefix.
    */
   protected function tearDown() {
     // Destroy the testing kernel.
@@ -994,10 +981,8 @@ protected function curlInitialize() {
         CURLOPT_URL => $base_url,
         CURLOPT_FOLLOWLOCATION => FALSE,
         CURLOPT_RETURNTRANSFER => TRUE,
-        // Required to make the tests run on HTTPS.
-        CURLOPT_SSL_VERIFYPEER => FALSE,
-        // Required to make the tests run on HTTPS.
-        CURLOPT_SSL_VERIFYHOST => FALSE,
+        CURLOPT_SSL_VERIFYPEER => FALSE, // Required to make the tests run on HTTPS.
+        CURLOPT_SSL_VERIFYHOST => FALSE, // Required to make the tests run on HTTPS.
         CURLOPT_HEADERFUNCTION => array(&$this, 'curlHeaderCallback'),
         CURLOPT_USERAGENT => $this->databasePrefix,
       );
@@ -1115,8 +1100,8 @@ protected function curlExec($curl_options, $redirect = FALSE) {
       '@status' => $status,
       '!length' => format_size(strlen($this->drupalGetContent()))
     );
-    $message = String::format('!method @url returned @status (!length).', $message_vars);
-    $this->assertTrue($this->drupalGetContent() !== FALSE, $message, 'Browser');
+    $message = t('!method @url returned @status (!length).', $message_vars);
+    $this->assertTrue($this->drupalGetContent() !== FALSE, $message, t('Browser'));
     return $this->drupalGetContent();
   }
 
@@ -1144,10 +1129,9 @@ protected function curlHeaderCallback($curlHandler, $header) {
 
     // Errors are being sent via X-Drupal-Assertion-* headers,
     // generated by _drupal_log_error() in the exact form required
-    // by \Drupal\simpletest\WebTestBase::error().
+    // by Drupal\simpletest\WebTestBase::error().
     if (preg_match('/^X-Drupal-Assertion-[0-9]+: (.*)$/', $header, $matches)) {
-      // Call \Drupal\simpletest\WebTestBase::error() with the parameters from
-      // the header.
+      // Call Drupal\simpletest\WebTestBase::error() with the parameters from the header.
       call_user_func_array(array(&$this, 'error'), unserialize(urldecode($matches[1])));
     }
 
@@ -1228,8 +1212,7 @@ protected function drupalGet($path, array $options = array(), array $headers = a
     // previous options.
     $url = $this->container->get('url_generator')->generateFromPath($path, $options);
     $out = $this->curlExec(array(CURLOPT_HTTPGET => TRUE, CURLOPT_URL => $url, CURLOPT_NOBODY => FALSE, CURLOPT_HTTPHEADER => $headers));
-    // Ensure that any changes to variables in the other thread are picked up.
-    $this->refreshVariables();
+    $this->refreshVariables(); // Ensure that any changes to variables in the other thread are picked up.
 
     // Replace original page output with new output from redirected page(s).
     if ($new = $this->checkForMetaRefresh()) {
@@ -1267,7 +1250,7 @@ protected function drupalGetJSON($path, array $options = array(), array $headers
   }
 
   /**
-   * Requests a Drupal path in drupal_ajax format and JSON-decodes the response.
+   * Requests a Drupal path in drupal_ajax format, and JSON decodes the response.
    */
   protected function drupalGetAJAX($path, array $options = array(), array $headers = array()) {
     $headers[] = 'Accept: application/vnd.drupal-ajax';
@@ -1275,8 +1258,7 @@ protected function drupalGetAJAX($path, array $options = array(), array $headers
   }
 
   /**
-   * Executes a POST request on a Drupal page.
-   *
+   * Execute a POST request on a Drupal page.
    * It will be done as usual POST request with SimpleBrowser.
    *
    * @param $path
@@ -1417,12 +1399,10 @@ protected function drupalPost($path, $edit, $submit, array $options = array(), a
             $post = implode('&', $post) . $extra_post;
           }
           $out = $this->curlExec(array(CURLOPT_URL => $action, CURLOPT_POST => TRUE, CURLOPT_POSTFIELDS => $post, CURLOPT_HTTPHEADER => $headers));
-          // Ensure that any changes to variables in the other thread are picked
-          // up.
+          // Ensure that any changes to variables in the other thread are picked up.
           $this->refreshVariables();
 
-          // Replace original page output with new output from redirected
-          // page(s).
+          // Replace original page output with new output from redirected page(s).
           if ($new = $this->checkForMetaRefresh()) {
             $out = $new;
           }
@@ -1654,10 +1634,9 @@ protected function cronRun() {
   }
 
   /**
-   * Checks for meta refresh tag and if found call drupalGet() recursively.
-   *
-   * This function looks for the http-equiv attribute to be set to "Refresh" and
-   * is case-sensitive.
+   * Check for meta refresh tag and if found call drupalGet() recursively. This
+   * function looks for the http-equiv attribute to be set to "Refresh"
+   * and is case-sensitive.
    *
    * @return
    *   Either the new page content or FALSE.
@@ -1693,8 +1672,7 @@ protected function drupalHead($path, array $options = array(), array $headers =
     $options['absolute'] = TRUE;
     $url = $this->container->get('url_generator')->generateFromPath($path, $options);
     $out = $this->curlExec(array(CURLOPT_NOBODY => TRUE, CURLOPT_URL => $url, CURLOPT_HTTPHEADER => $headers));
-    // Ensure that any changes to variables in the other thread are picked up.
-    $this->refreshVariables();
+    $this->refreshVariables(); // Ensure that any changes to variables in the other thread are picked up.
 
     if ($this->dumpHeaders) {
       $this->verbose('GET request to: ' . $path .
@@ -1706,10 +1684,9 @@ protected function drupalHead($path, array $options = array(), array $headers =
   }
 
   /**
-   * Handles form input related to drupalPost().
-   *
-   * Ensure that the specified fields exist and attempt to create POST data in
-   * the correct manner for the particular field type.
+   * Handle form input related to drupalPost(). Ensure that the specified fields
+   * exist and attempt to create POST data in the correct manner for the particular
+   * field type.
    *
    * @param $post
    *   Reference to array of post values.
@@ -1900,21 +1877,14 @@ protected function buildXPathQuery($xpath, array $args = array()) {
         // Return the string.
         $value = count($parts) > 1 ? 'concat(' . implode(', \'"\', ', $parts) . ')' : $parts[0];
       }
-
-      // Use preg_replace_callback() instead of preg_replace() to prevent the
-      // regular expression engine from trying to substitute backreferences.
-      $replacement = function ($matches) use ($value) {
-        return $value;
-      };
-      $xpath = preg_replace_callback('/' . preg_quote($placeholder) . '\b/', $replacement, $xpath);
+      $xpath = preg_replace('/' . preg_quote($placeholder) . '\b/', $value, $xpath);
     }
     return $xpath;
   }
 
   /**
-   * Performs an xpath search on the contents of the internal browser.
-   *
-   * The search is relative to the root element (HTML tag normally) of the page.
+   * Perform an xpath search on the contents of the internal browser. The search
+   * is relative to the root element (HTML tag normally) of the page.
    *
    * @param $xpath
    *   The xpath string to use in the search.
@@ -1962,9 +1932,8 @@ protected function getAllOptions(SimpleXMLElement $element) {
   }
 
   /**
-   * Passes if a link with the specified label is found.
-   *
-   * An optional link index may be passed.
+   * Pass if a link with the specified label is found, and optional with the
+   * specified index.
    *
    * @param $label
    *   Text between the anchor tags.
@@ -1989,7 +1958,7 @@ protected function assertLink($label, $index = 0, $message = '', $group = 'Other
   }
 
   /**
-   * Passes if a link with the specified label is not found.
+   * Pass if a link with the specified label is not found.
    *
    * @param $label
    *   Text between the anchor tags.
@@ -2014,7 +1983,7 @@ protected function assertNoLink($label, $message = '', $group = 'Other') {
   }
 
   /**
-   * Passes if a link containing a given href (part) is found.
+   * Pass if a link containing a given href (part) is found.
    *
    * @param $href
    *   The full or partial value of the 'href' attribute of the anchor tag.
@@ -2040,7 +2009,7 @@ protected function assertLinkByHref($href, $index = 0, $message = '', $group = '
   }
 
   /**
-   * Passes if a link containing a given href (part) is not found.
+   * Pass if a link containing a given href (part) is not found.
    *
    * @param $href
    *   The full or partial value of the 'href' attribute of the anchor tag.
@@ -2085,7 +2054,7 @@ protected function clickLink($label, $index = 0) {
       $url_target = $this->getAbsoluteUrl($urls[$index]['href']);
     }
 
-    $this->assertTrue(isset($urls[$index]), String::format('Clicked link %label (@url_target) from @url_before', array('%label' => $label, '@url_target' => $url_target, '@url_before' => $url_before)), 'Browser');
+    $this->assertTrue(isset($urls[$index]), t('Clicked link %label (@url_target) from @url_before', array('%label' => $label, '@url_target' => $url_target, '@url_before' => $url_before)), t('Browser'));
 
     if (isset($url_target)) {
       return $this->drupalGet($url_target);
@@ -2134,12 +2103,11 @@ protected function getUrl() {
   }
 
   /**
-   * Gets the HTTP response headers of the requested page.
-   *
-   * Normally we are only interested in the headers returned by the last
-   * request. However, if a page is redirected or HTTP authentication is in use,
-   * multiple requests will be required to retrieve the page. Headers from all
-   * requests may be requested by passing TRUE to this function.
+   * Gets the HTTP response headers of the requested page. Normally we are only
+   * interested in the headers returned by the last request. However, if a page
+   * is redirected or HTTP authentication is in use, multiple requests will be
+   * required to retrieve the page. Headers from all requests may be requested
+   * by passing TRUE to this function.
    *
    * @param $all_requests
    *   Boolean value specifying whether to return headers from all requests
@@ -2185,12 +2153,11 @@ protected function drupalGetHeaders($all_requests = FALSE) {
   }
 
   /**
-   * Gets the value of an HTTP response header.
-   *
-   * If multiple requests were required to retrieve the page, only the headers
-   * from the last request will be checked by default. However, if TRUE is
-   * passed as the second argument, all requests will be processed from last to
-   * first until the header is found.
+   * Gets the value of an HTTP response header. If multiple requests were
+   * required to retrieve the page, only the headers from the last request will
+   * be checked by default. However, if TRUE is passed as the second argument,
+   * all requests will be processed from last to first until the header is
+   * found.
    *
    * @param $name
    *   The name of the header to retrieve. Names are case-insensitive (see RFC
@@ -2229,9 +2196,7 @@ protected function drupalGetContent() {
   }
 
   /**
-   * Gets the value of Drupal.settings for the currently-loaded page.
-   *
-   * Drupal.settings refers to the Drupal.settings JavaScript variable.
+   * Gets the value of the Drupal.settings JavaScript variable for the currently loaded page.
    */
   protected function drupalGetSettings() {
     return $this->drupalSettings;
@@ -2241,8 +2206,7 @@ protected function drupalGetSettings() {
    * Gets an array containing all e-mails sent during this test case.
    *
    * @param $filter
-   *   An array containing key/value pairs used to filter the e-mails that are
-   *   returned.
+   *   An array containing key/value pairs used to filter the e-mails that are returned.
    * @return
    *   An array containing e-mail messages captured during the current test.
    */
@@ -2263,14 +2227,13 @@ protected function drupalGetMails($filter = array()) {
   }
 
   /**
-   * Sets the raw HTML content.
+   * Sets the raw HTML content. This can be useful when a page has been fetched
+   * outside of the internal browser and assertions need to be made on the
+   * returned page.
    *
-   * This can be useful when a page has been fetched outside of the internal
-   * browser and assertions need to be made on the returned page.
-   *
-   * A good example would be when testing HTTP request made by Drupal. After
-   * fetching the page the content can be set and page elements can be checked
-   * to ensure that the function worked properly.
+   * A good example would be when testing HTTP request made by Drupal. After fetching
+   * the page the content can be set and page elements can be checked to ensure
+   * that the function worked properly.
    */
   protected function drupalSetContent($content, $url = 'internal:') {
     $this->content = $content;
@@ -2284,16 +2247,14 @@ protected function drupalSetContent($content, $url = 'internal:') {
   }
 
   /**
-   * Sets the value of Drupal.settings for the currently-loaded page.
-   *
-   * Drupal.settings refers to the Drupal.settings JavaScript variable.
+   * Sets the value of the Drupal.settings JavaScript variable for the currently loaded page.
    */
   protected function drupalSetSettings($settings) {
     $this->drupalSettings = $settings;
   }
 
   /**
-   * Passes if the internal browser's URL matches the given path.
+   * Pass if the internal browser's URL matches the given path.
    *
    * @param $path
    *   The expected system path.
@@ -2323,9 +2284,8 @@ protected function assertUrl($path, array $options = array(), $message = '', $gr
   }
 
   /**
-   * Passes if the raw text IS found on the loaded page, fail otherwise.
-   *
-   * Raw text refers to the raw HTML that the page generated.
+   * Pass if the raw text IS found on the loaded page, fail otherwise. Raw text
+   * refers to the raw HTML that the page generated.
    *
    * @param $raw
    *   Raw (HTML) string to look for.
@@ -2349,9 +2309,8 @@ protected function assertRaw($raw, $message = '', $group = 'Other') {
   }
 
   /**
-   * Passes if the raw text is NOT found on the loaded page, fail otherwise.
-   *
-   * Raw text refers to the raw HTML that the page generated.
+   * Pass if the raw text is NOT found on the loaded page, fail otherwise. Raw text
+   * refers to the raw HTML that the page generated.
    *
    * @param $raw
    *   Raw (HTML) string to look for.
@@ -2375,11 +2334,9 @@ protected function assertNoRaw($raw, $message = '', $group = 'Other') {
   }
 
   /**
-   * Passes if the text IS found on the text version of the page.
-   *
-   * The text version is the equivalent of what a user would see when viewing
-   * through a web browser. In other words the HTML has been filtered out of the
-   * contents.
+   * Pass if the text IS found on the text version of the page. The text version
+   * is the equivalent of what a user would see when viewing through a web browser.
+   * In other words the HTML has been filtered out of the contents.
    *
    * @param $text
    *   Plain text to look for.
@@ -2400,11 +2357,9 @@ protected function assertText($text, $message = '', $group = 'Other') {
   }
 
   /**
-   * Passes if the text is NOT found on the text version of the page.
-   *
-   * The text version is the equivalent of what a user would see when viewing
-   * through a web browser. In other words the HTML has been filtered out of the
-   * contents.
+   * Pass if the text is NOT found on the text version of the page. The text version
+   * is the equivalent of what a user would see when viewing through a web browser.
+   * In other words the HTML has been filtered out of the contents.
    *
    * @param $text
    *   Plain text to look for.
@@ -2456,7 +2411,7 @@ protected function assertTextHelper($text, $message = '', $group, $not_exists) {
   }
 
   /**
-   * Passes if the text is found ONLY ONCE on the text version of the page.
+   * Pass if the text is found ONLY ONCE on the text version of the page.
    *
    * The text version is the equivalent of what a user would see when viewing
    * through a web browser. In other words the HTML has been filtered out of
@@ -2481,7 +2436,7 @@ protected function assertUniqueText($text, $message = '', $group = 'Other') {
   }
 
   /**
-   * Passes if the text is found MORE THAN ONCE on the text version of the page.
+   * Pass if the text is found MORE THAN ONCE on the text version of the page.
    *
    * The text version is the equivalent of what a user would see when viewing
    * through a web browser. In other words the HTML has been filtered out of
@@ -2522,8 +2477,7 @@ protected function assertNoUniqueText($text, $message = '', $group = 'Other') {
    *   translate this string. Defaults to 'Other'; most tests do not override
    *   this default.
    * @param $be_unique
-   *   TRUE if this text should be found only once, FALSE if it should be found
-   *   more than once.
+   *   TRUE if this text should be found only once, FALSE if it should be found more than once.
    * @return
    *   TRUE on pass, FALSE on fail.
    */
@@ -2544,7 +2498,7 @@ protected function assertUniqueTextHelper($text, $message = '', $group, $be_uniq
   }
 
   /**
-   * Triggers a pass if the Perl regex pattern is found in the raw content.
+   * Will trigger a pass if the Perl regex pattern is found in the raw content.
    *
    * @param $pattern
    *   Perl regex to look for including the regex delimiters.
@@ -2568,7 +2522,7 @@ protected function assertPattern($pattern, $message = '', $group = 'Other') {
   }
 
   /**
-   * Triggers a pass if the perl regex pattern is not found in raw content.
+   * Will trigger a pass if the perl regex pattern is not present in raw content.
    *
    * @param $pattern
    *   Perl regex to look for including the regex delimiters.
@@ -2670,11 +2624,7 @@ protected function assertNoTitle($title, $message = '', $group = 'Other') {
    *   TRUE on pass, FALSE on fail.
    */
   protected function assertThemeOutput($callback, array $variables = array(), $expected, $message = '', $group = 'Other') {
-    $build = array('#theme' => $callback);
-    foreach($variables as $key => $variable) {
-      $build["#$key"] = $variable;
-    }
-    $output = drupal_render($build);
+    $output = theme($callback, $variables);
     $this->verbose('Variables:' . '<pre>' .  check_plain(var_export($variables, TRUE)) . '</pre>'
       . '<hr />' . 'Result:' . '<pre>' .  check_plain(var_export($output, TRUE)) . '</pre>'
       . '<hr />' . 'Expected:' . '<pre>' .  check_plain(var_export($expected, TRUE)) . '</pre>'
@@ -2804,7 +2754,7 @@ protected function assertNoFieldByXPath($xpath, $value = NULL, $message = '', $g
   }
 
   /**
-   * Asserts that a field exists with the given name and value.
+   * Asserts that a field exists in the current page with the given name and value.
    *
    * @param $name
    *   Name of field to assert.
@@ -2865,7 +2815,7 @@ protected function assertNoFieldByName($name, $value = '', $message = '', $group
   }
 
   /**
-   * Asserts that a field exists with the given id and value.
+   * Asserts that a field exists in the current page with the given id and value.
    *
    * @param $id
    *   Id of field to assert.
@@ -3142,7 +3092,7 @@ protected function assertNoDuplicateIds($message = '', $group = 'Other', $ids_to
   }
 
   /**
-   * Helper: Constructs an XPath for the given set of attributes and value.
+   * Helper function: construct an XPath for the given set of attributes and value.
    *
    * @param $attribute
    *   Field attributes.
@@ -3213,8 +3163,7 @@ protected function assertNoResponse($code, $message = '', $group = 'Browser') {
    * The field in $name must have the content described in $value.
    *
    * @param $name
-   *   Name of field or message property to assert. Examples: subject, body,
-   *   id, ...
+   *   Name of field or message property to assert. Examples: subject, body, id, ...
    * @param $value
    *   Value of the field to assert.
    * @param $message
diff --git a/core/modules/simpletest/simpletest.api.php b/core/modules/simpletest/simpletest.api.php
index e11c651..a982409 100644
--- a/core/modules/simpletest/simpletest.api.php
+++ b/core/modules/simpletest/simpletest.api.php
@@ -59,10 +59,9 @@ function hook_test_group_finished() {
  * This hook is called when an individual test has finished.
  *
  * @param
- *   $results The results of the test as gathered by
- *   \Drupal\simpletest\WebTestBase.
+ *   $results The results of the test as gathered by Drupal\simpletest\WebTestBase.
  *
- * @see \Drupal\simpletest\WebTestBase->results()
+ * @see Drupal\simpletest\WebTestBase->results()
  */
 function hook_test_finished($results) {
 }
diff --git a/core/modules/simpletest/simpletest.module b/core/modules/simpletest/simpletest.module
index 587b6c0..5461cab 100644
--- a/core/modules/simpletest/simpletest.module
+++ b/core/modules/simpletest/simpletest.module
@@ -319,11 +319,7 @@ function _simpletest_batch_operation($test_list_init, $test_id, &$context) {
   }
   $context['message'] = t('Processed test @num of @max - %test.', array('%test' => $info['name'], '@num' => $max - $size, '@max' => $max));
   $context['message'] .= '<div class="simpletest-' . ($test_results['#fail'] + $test_results['#exception'] ? 'fail' : 'pass') . '">Overall results: ' . _simpletest_format_summary_line($test_results) . '</div>';
-  $item_list = array(
-    '#theme' => 'item_list',
-    '#items' => $items,
-  );
-  $context['message'] .= drupal_render($item_list);
+  $context['message'] .= theme('item_list', array('items' => $items));
 
   // Save working values for the next iteration.
   $context['sandbox']['tests'] = $test_list;
@@ -530,7 +526,7 @@ function simpletest_classloader_register() {
     }
   }
 
-  // Register the core test directory so we can find \Drupal\UnitTestCase.
+  // Register the core test directory so we can find Drupal\UnitTestCase.
   drupal_classloader()->addPrefix('Drupal\\Tests', DRUPAL_ROOT . '/core/tests');
 
   // Manually register phpunit prefixes because they use a classmap instead of a
@@ -565,8 +561,7 @@ function simpletest_generate_file($filename, $width, $lines, $type = 'binary-tex
         break;
     }
   }
-  // Add \n for symmetrical file.
-  $text = wordwrap($text, $width - 1, "\n", TRUE) . "\n";
+  $text = wordwrap($text, $width - 1, "\n", TRUE) . "\n"; // Add \n for symmetrical file.
 
   // Create filename.
   file_put_contents('public://' . $filename . '.txt', $text);
@@ -592,7 +587,8 @@ function simpletest_clean_environment() {
 }
 
 /**
- * Remove prefixed tables from the database from crashed tests.
+ * Removed prefixed tables from the database that are left over from crashed
+ * tests.
  */
 function simpletest_clean_database() {
   $tables = db_find_tables(Database::getConnection()->prefixTables('{simpletest}') . '%');
diff --git a/core/modules/simpletest/simpletest.theme.inc b/core/modules/simpletest/simpletest.theme.inc
index 31cbb02..57355b5 100644
--- a/core/modules/simpletest/simpletest.theme.inc
+++ b/core/modules/simpletest/simpletest.theme.inc
@@ -6,7 +6,7 @@
  */
 
 /**
- * Returns an HTML table for a test list generated by simpletest_test_form().
+ * Returns HTML for a test list generated by simpletest_test_form() into a table.
  *
  * @param $variables
  *   An associative array containing:
@@ -27,28 +27,10 @@ function theme_simpletest_test_table($variables) {
   );
 
   // Define the images used to expand/collapse the test groups.
-  $image_collapsed = array(
-    '#theme' => 'image',
-    '#uri' => 'core/misc/menu-collapsed.png',
-    '#width' => '7',
-    '#height' => '7',
-    '#alt' => t('Expand'),
-    '#title' => t('Expand'),
-    '#suffix' => '<a href="#" class="simpletest-collapse">(' . t('Expand') . ')</a>',
-  );
-  $image_extended = array(
-    '#theme' => 'image',
-    '#uri' => 'core/misc/menu-expanded.png',
-    '#width' => '7',
-    '#height' => '7',
-    '#alt' => t('Collapse'),
-    '#title' => t('Collapse'),
-    '#suffix' => ' <a href="#" class="simpletest-collapse">(' . t('Collapse') . ')</a>',
-   );
   $js = array(
     'images' => array(
-      drupal_render($image_collapsed),
-      drupal_render($image_extended),
+      theme('image', array('uri' => 'core/misc/menu-collapsed.png', 'width' => 7, 'height' => 7, 'alt' => t('Expand'), 'title' => t('Expand'))) . ' <a href="#" class="simpletest-collapse">(' . t('Expand') . ')</a>',
+      theme('image', array('uri' => 'core/misc/menu-expanded.png', 'width' => 7, 'height' => 7, 'alt' => t('Collapse'), 'title' => t('Collapse'))) . ' <a href="#" class="simpletest-collapse">(' . t('Collapse') . ')</a>',
     ),
   );
 
@@ -138,13 +120,7 @@ function theme_simpletest_test_table($variables) {
     return '<strong>' . t('No tests to display.') . '</strong>';
   }
   else {
-    $simpletest_form_table = array(
-      '#theme' => 'table',
-      '#header' => $header,
-      '#rows' => $rows,
-      '#attributes' => array('id' => 'simpletest-form-table'),
-    );
-    return drupal_render($simpletest_form_table);
+    return theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'simpletest-form-table')));
   }
 }
 
diff --git a/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsAdminTest.php b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsAdminTest.php
index 949206f..af45ffd 100644
--- a/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsAdminTest.php
+++ b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsAdminTest.php
@@ -61,7 +61,7 @@ function setUp() {
     }
     $this->privileged_user = $this->drupalCreateUser(array('administer statistics', 'view post access counter', 'create page content'));
     $this->drupalLogin($this->privileged_user);
-    $this->test_node = $this->drupalCreateNode(array('type' => 'page', 'uid' => $this->privileged_user->id()));
+    $this->test_node = $this->drupalCreateNode(array('type' => 'page', 'uid' => $this->privileged_user->uid));
     $this->client = \Drupal::httpClient();
     $this->client->setConfig(array('curl.options' => array(CURLOPT_TIMEOUT => 10)));
   }
diff --git a/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsLoggingTest.php b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsLoggingTest.php
index 76551c7..86c7b42 100644
--- a/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsLoggingTest.php
+++ b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsLoggingTest.php
@@ -51,7 +51,7 @@ function setUp() {
     $this->auth_user = $this->drupalCreateUser(array('access content', 'create page content', 'edit own page content'));
 
     // Ensure we have a node page to access.
-    $this->node = $this->drupalCreateNode(array('title' => $this->randomName(255), 'uid' => $this->auth_user->id()));
+    $this->node = $this->drupalCreateNode(array('title' => $this->randomName(255), 'uid' => $this->auth_user->uid));
 
     // Enable page caching.
     $config = config('system.performance');
diff --git a/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsReportsTest.php b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsReportsTest.php
index 9a6b22f..b897f99 100644
--- a/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsReportsTest.php
+++ b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsReportsTest.php
@@ -28,7 +28,7 @@ function testPopularContentBlock() {
     $this->container->get('plugin.manager.block')->clearCachedDefinitions();
 
     // Visit a node to have something show up in the block.
-    $node = $this->drupalCreateNode(array('type' => 'page', 'uid' => $this->blocking_user->id()));
+    $node = $this->drupalCreateNode(array('type' => 'page', 'uid' => $this->blocking_user->uid));
     $this->drupalGet('node/' . $node->nid);
     // Manually calling statistics.php, simulating ajax behavior.
     $nid = $node->nid;
diff --git a/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsTokenReplaceTest.php b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsTokenReplaceTest.php
index 56246cd..f13d5cb 100644
--- a/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsTokenReplaceTest.php
+++ b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsTokenReplaceTest.php
@@ -30,7 +30,7 @@ function testStatisticsTokenReplacement() {
     // Create user and node.
     $user = $this->drupalCreateUser(array('create page content'));
     $this->drupalLogin($user);
-    $node = $this->drupalCreateNode(array('type' => 'page', 'uid' => $user->id()));
+    $node = $this->drupalCreateNode(array('type' => 'page', 'uid' => $user->uid));
 
     // Hit the node.
     $this->drupalGet('node/' . $node->nid);
diff --git a/core/modules/statistics/tests/modules/statistics_test_views/test_views/views.view.test_statistics_integration.yml b/core/modules/statistics/tests/modules/statistics_test_views/test_views/views.view.test_statistics_integration.yml
index 798357e..dc3c7a9 100644
--- a/core/modules/statistics/tests/modules/statistics_test_views/test_views/views.view.test_statistics_integration.yml
+++ b/core/modules/statistics/tests/modules/statistics_test_views/test_views/views.view.test_statistics_integration.yml
@@ -45,7 +45,6 @@ display:
           hide_empty: '0'
           empty_zero: '0'
           link_to_node: '1'
-          provider: node
         timestamp:
           id: timestamp
           table: node_counter
@@ -97,7 +96,6 @@ display:
           date_format: html_year
           custom_date_format: ''
           timezone: ''
-          provider: views
         totalcount:
           id: totalcount
           table: node_counter
@@ -155,7 +153,6 @@ display:
           format_plural_plural: '@count'
           prefix: ''
           suffix: ''
-          provider: views
         daycount:
           id: daycount
           table: node_counter
@@ -213,7 +210,6 @@ display:
           format_plural_plural: '@count'
           prefix: ''
           suffix: ''
-          provider: views
       filters:
         status:
           value: '1'
@@ -223,14 +219,12 @@ display:
           expose:
             operator: '0'
           group: '1'
-          provider: views
       sorts:
         created:
           id: created
           table: node_field_data
           field: created
           order: DESC
-          provider: views
   page_1:
     display_plugin: page
     id: page_1
diff --git a/core/modules/system/config/schema/system.data_types.schema.yml b/core/modules/system/config/schema/system.data_types.schema.yml
index 7c5a420..15e4c63 100644
--- a/core/modules/system/config/schema/system.data_types.schema.yml
+++ b/core/modules/system/config/schema/system.data_types.schema.yml
@@ -78,3 +78,25 @@ filter:
     status:
       type: boolean
       label: 'Enabled'
+
+# Date format with name and pattern.
+date_format:
+  type: mapping
+  label: 'Date Format'
+  mapping:
+    name:
+      type: label
+      label: 'Name'
+    pattern:
+      type: mapping
+      label: 'Format string'
+      mapping:
+        php:
+          type: label
+          label: 'PHP date format'
+        intl:
+          type: label
+          label: 'International'
+    locked:
+      type: boolean
+      label: 'Locked'
diff --git a/core/modules/system/config/schema/system.schema.yml b/core/modules/system/config/schema/system.schema.yml
index d44927d..d41d414 100644
--- a/core/modules/system/config/schema/system.schema.yml
+++ b/core/modules/system/config/schema/system.schema.yml
@@ -90,45 +90,12 @@ system.date:
         default:
           type: string
           label: 'Default country'
-    langcode:
-      type: string
-      label: 'Default language'
-
-system.date_format.*:
-  type: mapping
-  label: 'Date format'
-  mapping:
-    id:
-      type: string
-      label: 'Date format identifier'
-    uuid:
-      type: string
-      label: 'UUID'
-    label:
-      type: label
-      label: 'Date format label'
-    status:
-      type: boolean
-      label: 'Enabled'
-    locked:
-      type: boolean
-      label: 'Locked'
-    locales:
+    formats:
       type: sequence
-      label: 'Languages'
+      label: 'Date formats'
       sequence:
-        - type: string
-          label: 'Language'
-    pattern:
-      type: mapping
-      label: 'Format string'
-      mapping:
-        php:
-          type: string
-          label: 'PHP date format'
-        intl:
-          type: string
-          label: 'Intl date format'
+        - type: date_format
+          label: 'Date format'
     langcode:
       type: string
       label: 'Default language'
@@ -161,23 +128,6 @@ system.filter:
         - type: string
           label: 'Protocol'
 
-system.language.types:
-  type: mapping
-  label: 'Language types'
-  mapping:
-    all:
-      type: sequence
-      label: 'All language types'
-      sequence:
-        - type: string
-          label: 'Language type'
-    configurable:
-      type: sequence
-      label: 'Configurable language types'
-      sequence:
-        - type: string
-          label: 'Language type'
-
 system.logging:
   type: mapping
   label: 'Logging settings'
diff --git a/core/modules/system/config/system.date.yml b/core/modules/system/config/system.date.yml
index 55a35c1..55c6e75 100644
--- a/core/modules/system/config/system.date.yml
+++ b/core/modules/system/config/system.date.yml
@@ -1,3 +1,64 @@
 first_day: '0'
 country:
   default: ''
+formats:
+  long:
+    name: 'Default Long Date'
+    pattern:
+      php: 'l, F j, Y - H:i'
+      intl: 'EEEE, LLLL d, yyyy - kk:mm'
+    locked: 0
+  medium:
+    name: 'Default Medium Date'
+    pattern:
+      php: 'D, m/d/Y - H:i'
+      intl: 'ccc, MM/dd/yyyy - kk:mm'
+    locked: 0
+  short:
+    name: 'Default Short Date'
+    pattern:
+      php: 'm/d/Y - H:i'
+      intl: 'MM/dd/yyyy - kk:mm'
+    locked: 0
+  html_datetime:
+    name: 'HTML Datetime'
+    pattern:
+      php: 'Y-m-d\TH:i:sO'
+      intl: 'yyyy-MM-dd''T''kk:mm:ssZZ'
+    locked: 1
+  html_date:
+    name: 'HTML Date'
+    pattern:
+      php: 'Y-m-d'
+      intl: 'yyyy-MM-dd'
+    locked: 1
+  html_time:
+    name: 'HTML Time'
+    pattern:
+      php: 'H:i:s'
+      intl: 'H:mm:ss'
+    locked: 1
+  html_yearless_date:
+    name: 'HTML Yearless date'
+    pattern:
+      php: 'm-d'
+      intl: 'MM-d'
+    locked: 1
+  html_week:
+    name: 'HTML Week'
+    pattern:
+      php: 'Y-\WW'
+      intl: 'Y-''W''WW'
+    locked: 1
+  html_month:
+    name: 'HTML Month'
+    pattern:
+      php: 'Y-m'
+      intl: 'Y-MM'
+    locked: 1
+  html_year:
+    name: 'HTML Year'
+    pattern:
+      php: 'Y'
+      intl: 'Y'
+    locked: 1
diff --git a/core/modules/system/config/system.date_format.fallback.yml b/core/modules/system/config/system.date_format.fallback.yml
deleted file mode 100644
index a9e3eb1..0000000
--- a/core/modules/system/config/system.date_format.fallback.yml
+++ /dev/null
@@ -1,10 +0,0 @@
-id: fallback
-uuid: cf0ad071-ded7-4750-b008-8c74f200ff8d
-label: 'Fallback date format'
-status: '1'
-langcode: en
-locked: '1'
-locales: {  }
-pattern:
-  php: 'D, m/d/Y - H:i'
-  intl: 'ccc, MM/dd/yyyy - kk:mm'
diff --git a/core/modules/system/config/system.date_format.html_date.yml b/core/modules/system/config/system.date_format.html_date.yml
deleted file mode 100644
index 6d4e004..0000000
--- a/core/modules/system/config/system.date_format.html_date.yml
+++ /dev/null
@@ -1,10 +0,0 @@
-id: html_date
-uuid: f4028e7f-3ed8-4737-8f27-39b618214a1f
-label: 'HTML Date'
-status: '1'
-langcode: en
-locked: '1'
-locales: {  }
-pattern:
-  php: Y-m-d
-  intl: yyyy-MM-dd
diff --git a/core/modules/system/config/system.date_format.html_datetime.yml b/core/modules/system/config/system.date_format.html_datetime.yml
deleted file mode 100644
index 624f935..0000000
--- a/core/modules/system/config/system.date_format.html_datetime.yml
+++ /dev/null
@@ -1,10 +0,0 @@
-id: html_datetime
-uuid: bfd7db46-607f-477f-9047-713c312dbb02
-label: 'HTML Datetime'
-status: '1'
-langcode: en
-locked: '1'
-locales: {  }
-pattern:
-  php: 'Y-m-d\TH:i:sO'
-  intl: 'yyyy-MM-dd''T''kk:mm:ssZZ'
diff --git a/core/modules/system/config/system.date_format.html_month.yml b/core/modules/system/config/system.date_format.html_month.yml
deleted file mode 100644
index 92fe715..0000000
--- a/core/modules/system/config/system.date_format.html_month.yml
+++ /dev/null
@@ -1,10 +0,0 @@
-id: html_month
-uuid: f85dd1b6-0edb-4024-a800-bb8c87805b2b
-label: 'HTML Month'
-status: '1'
-langcode: en
-locked: '1'
-locales: {  }
-pattern:
-  php: Y-m
-  intl: Y-MM
diff --git a/core/modules/system/config/system.date_format.html_time.yml b/core/modules/system/config/system.date_format.html_time.yml
deleted file mode 100644
index a2aaf35..0000000
--- a/core/modules/system/config/system.date_format.html_time.yml
+++ /dev/null
@@ -1,10 +0,0 @@
-id: html_time
-uuid: f8e87532-396e-4353-b02c-4493d2031bc6
-label: 'HTML Time'
-status: '1'
-langcode: en
-locked: '1'
-locales: {  }
-pattern:
-  php: 'H:i:s'
-  intl: 'H:mm:ss'
diff --git a/core/modules/system/config/system.date_format.html_week.yml b/core/modules/system/config/system.date_format.html_week.yml
deleted file mode 100644
index aa45e8e..0000000
--- a/core/modules/system/config/system.date_format.html_week.yml
+++ /dev/null
@@ -1,10 +0,0 @@
-id: html_week
-uuid: d14737ae-d1e0-436b-9225-37113d4c8c7c
-label: 'HTML Week'
-status: '1'
-langcode: en
-locked: '1'
-locales: {  }
-pattern:
-  php: Y-\WW
-  intl: 'Y-''W''WW'
diff --git a/core/modules/system/config/system.date_format.html_year.yml b/core/modules/system/config/system.date_format.html_year.yml
deleted file mode 100644
index 731cc5f..0000000
--- a/core/modules/system/config/system.date_format.html_year.yml
+++ /dev/null
@@ -1,10 +0,0 @@
-id: html_year
-uuid: a43b8034-a2f2-4507-9400-bed7d389265f
-label: 'HTML Year'
-status: '1'
-langcode: en
-locked: '1'
-locales: {  }
-pattern:
-  php: Y
-  intl: Y
diff --git a/core/modules/system/config/system.date_format.html_yearless_date.yml b/core/modules/system/config/system.date_format.html_yearless_date.yml
deleted file mode 100644
index 29240b2..0000000
--- a/core/modules/system/config/system.date_format.html_yearless_date.yml
+++ /dev/null
@@ -1,10 +0,0 @@
-id: html_yearless_date
-uuid: 623ab5ae-ebba-42cc-b100-a4ca10c77b2e
-label: 'HTML Yearless date'
-status: '1'
-langcode: en
-locked: '1'
-locales: {  }
-pattern:
-  php: m-d
-  intl: MM-d
diff --git a/core/modules/system/config/system.date_format.long.yml b/core/modules/system/config/system.date_format.long.yml
deleted file mode 100644
index 4c632c5..0000000
--- a/core/modules/system/config/system.date_format.long.yml
+++ /dev/null
@@ -1,10 +0,0 @@
-id: long
-uuid: 500ad047-44b4-429f-9b00-d54df9cbaa8c
-label: 'Default long date'
-status: '1'
-langcode: en
-locked: '0'
-locales: {  }
-pattern:
-  php: 'l, F j, Y - H:i'
-  intl: 'EEEE, LLLL d, yyyy - kk:mm'
diff --git a/core/modules/system/config/system.date_format.medium.yml b/core/modules/system/config/system.date_format.medium.yml
deleted file mode 100644
index 35946a8..0000000
--- a/core/modules/system/config/system.date_format.medium.yml
+++ /dev/null
@@ -1,10 +0,0 @@
-id: medium
-uuid: 17a8d708-e3b1-432d-9d36-542a97346a60
-label: 'Default medium date'
-status: '1'
-langcode: en
-locked: '0'
-locales: {  }
-pattern:
-  php: 'D, m/d/Y - H:i'
-  intl: 'ccc, MM/dd/yyyy - kk:mm'
diff --git a/core/modules/system/config/system.date_format.short.yml b/core/modules/system/config/system.date_format.short.yml
deleted file mode 100644
index e72c134..0000000
--- a/core/modules/system/config/system.date_format.short.yml
+++ /dev/null
@@ -1,10 +0,0 @@
-id: short
-uuid: a8ee7b86-5ef8-43a5-b200-d2e40e10cd58
-label: 'Default short date'
-status: '1'
-langcode: en
-locked: '0'
-locales: {  }
-pattern:
-  php: 'm/d/Y - H:i'
-  intl: 'MM/dd/yyyy - kk:mm'
diff --git a/core/modules/system/config/system.language.types.yml b/core/modules/system/config/system.language.types.yml
deleted file mode 100644
index 2b77d89..0000000
--- a/core/modules/system/config/system.language.types.yml
+++ /dev/null
@@ -1,6 +0,0 @@
-all:
-  - language_interface
-  - language_content
-  - language_url
-configurable:
-  - language_interface
diff --git a/core/modules/system/css/system.admin.css b/core/modules/system/css/system.admin.css
index 6dd62f3..131c0ca 100644
--- a/core/modules/system/css/system.admin.css
+++ b/core/modules/system/css/system.admin.css
@@ -93,45 +93,38 @@ small .admin-link:after {
 #system-modules td {
   vertical-align: top;
 }
+#system-modules .expand .inner {
+  background: transparent url(../../../misc/menu-collapsed.png) left .6em no-repeat;
+  margin-left: -12px;
+  padding-left: 12px;
+}
+#system-modules .expanded .expand .inner {
+  background: transparent url(../../../misc/menu-expanded.png) left .6em no-repeat;
+}
 #system-modules label {
   color: #1d1d1d;
   font-size: 1.15em;
 }
-#system-modules details {
+#system-modules .description {
+  cursor: pointer;
+}
+#system-modules .description .inner {
   color: #5c5c5b;
+  height: 20px;
   line-height: 20px;
   overflow: hidden; /* truncates descriptions if too long */
   text-overflow: ellipsis;
   white-space: nowrap;
 }
-#system-modules details[open] {
+#system-modules .expanded .description .inner {
   height: auto;
   overflow: visible;
   white-space: normal;
 }
-#system-modules details[open] summary .text {
+#system-modules .expanded .description .text {
   -webkit-hyphens: auto;
   -moz-hyphens: auto;
   hyphens: auto;
-  text-transform: none;
-}
-#system-modules td details a {
-  color: #5C5C5B;
-  border: 0px;
-}
-#system-modules td details {
-  border: 0px;
-  margin: 0px;
-  height: 20px;
-}
-#system-modules td details summary {
-  padding: 0px;
-  text-transform: none;
-  font-weight: normal;
-  cursor: default;
-}
-#system-modules td {
-  padding-left: 0px;
 }
 
 @media screen and (max-width: 40em) {
diff --git a/core/modules/system/css/system.module.css b/core/modules/system/css/system.module.css
index 6f33ee8..8b1795a 100644
--- a/core/modules/system/css/system.module.css
+++ b/core/modules/system/css/system.module.css
@@ -186,50 +186,25 @@ table.sticky-header {
  *
  * @see progress.js
  */
-.progress {
-  position: relative;
-}
-.progress__track {
+/* Bar */
+.progress .bar {
   background-color: #fff;
   border: 1px solid;
-  margin-top: 5px;
-  max-width: 100%;
-  min-width: 100px;
-  height: 16px;
-  background-color: #fff;
 }
-.progress__bar {
+.progress .filled {
   background-color: #000;
   height: 1.5em;
-  width: 3%;
-}
-.progress__description,
-.progress__percentage {
-  color: #555;
-  overflow: hidden;
-  font-size: .875em;
-  margin-top: 0.2em;
-}
-.progress__description {
-  float: left; /* LTR */
+  width: 5px;
 }
-[dir="rtl"] .progress__description {
-  float: right;
-}
-.progress__percentage {
+.progress .percentage {
   float: right; /* LTR */
 }
-[dir="rtl"] .progress__percentage {
+[dir="rtl"] .progress .percentage {
   float: left;
 }
-.progress--small .progress__track {
-  height: 7px;
-}
-.progress--small .progress__bar {
-  height: 7px;
-  background-size: 20px 20px;
+[dir="rtl"] .progress-disabled {
+  float: right;
 }
-
 /* Throbber */
 .ajax-progress {
   display: inline-block;
@@ -255,6 +230,16 @@ tr .ajax-progress-throbber .throbber {
 }
 
 /**
+ *  Keep form elements from overflowing their containers.
+ */
+input {
+  max-width: 100%;
+  -moz-box-sizing: border-box;
+  -webkit-box-sizing: border-box;
+  box-sizing: border-box;
+}
+
+/**
  * Inline items.
  */
 .container-inline div,
@@ -368,3 +353,25 @@ tr .ajax-progress-throbber .throbber {
 .align-justify {
   text-align: justify;
 }
+
+/**
+ * Block-level HTML5 display definition.
+ *
+ * Provides display values for browsers that don't recognize the new elements
+ * and therefore display them inline by default.
+ */
+article,
+aside,
+details,
+figcaption,
+figure,
+footer,
+header,
+hgroup,
+main,
+menu,
+nav,
+section,
+summary {
+  display: block;
+}
diff --git a/core/modules/system/css/system.theme.css b/core/modules/system/css/system.theme.css
index d3c52a3..ecf2239 100644
--- a/core/modules/system/css/system.theme.css
+++ b/core/modules/system/css/system.theme.css
@@ -4,6 +4,55 @@
  */
 
 /**
+ * HTML elements.
+ */
+fieldset {
+  border: 1px solid #ccc;
+  margin: 1em 0;
+  padding: 0.5em;
+}
+form {
+  margin: 0;
+  padding: 0;
+}
+button {
+  font-size: 1em;
+}
+hr {
+  border: 1px solid gray;
+  height: 1px;
+}
+img {
+  border: 0;
+}
+table {
+  border-collapse: collapse;
+  width: 100%;
+}
+th {
+  padding-right: 1em; /* LTR */
+  text-align: left; /* LTR */
+}
+[dir="rtl"] th {
+  text-align: right;
+  padding-left: 1em;
+  padding-right: 0;
+}
+thead > tr {
+  border-bottom: 1px solid #000;
+}
+tr {
+  border-bottom: 1px solid #ccc;
+  padding: 0.1em 0.6em;
+}
+caption {
+  text-align: left; /* LTR */
+}
+[dir="rtl"] caption {
+  text-align: right;
+}
+
+/**
  * Publishing status.
  */
 .unpublished {
@@ -58,6 +107,10 @@ tr.even .form-item {
 .form-item .description {
   font-size: 0.85em;
 }
+label {
+  display: block;
+  font-weight: bold;
+}
 label.option {
   display: inline;
   font-weight: normal;
@@ -127,7 +180,7 @@ abbr.form-required, abbr.tabledrag-changed, abbr.ajax-changed {
 }
 
 /**
- * More help link style.
+ * Markup generated by theme_more_help_link().
  */
 .more-help-link {
   text-align: right; /* LTR */
@@ -170,7 +223,6 @@ button.link {
   cursor: pointer;
   margin: 0;
   padding: 0;
-  font-size: 1em;
 }
 
 label button.link {
@@ -274,91 +326,17 @@ th.checkbox {
  *
  * @see progress.js
  */
-.progress__track {
-  border-color: #b3b3b3;
-  border-radius: 10em;
-  background-color: #f2f1eb;
-  background-image: -webkit-linear-gradient(#e7e7df, #f0f0f0);
-  background-image:    -moz-linear-gradient(#e7e7df, #f0f0f0);
-  background-image:      -o-linear-gradient(#e7e7df, #f0f0f0);
-  background-image:         linear-gradient(#e7e7df, #f0f0f0);
-  box-shadow: inset 0 1px 3px hsla(0, 0%, 0%, 0.16);
-}
-.progress__bar {
-  border: 1px #07629a solid;
-  background: #057ec9;
-  background-image:
-    -webkit-linear-gradient( top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15) ),
-    -webkit-linear-gradient( left top,
-      #0094f0 0%,
-      #0094f0 25%,
-      #007ecc 25%,
-      #007ecc 50%,
-      #0094f0 50%,
-      #0094f0 75%,
-      #0094f0 100% );
-  background-image:
-    -moz-linear-gradient( top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15) ),
-    -moz-linear-gradient( left top,
-      #0094f0 0%,
-      #0094f0 25%,
-      #007ecc 25%,
-      #007ecc 50%,
-      #0094f0 50%,
-      #0094f0 75%,
-      #0094f0 100% );
-  background-image:
-    -o-linear-gradient( top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15) ),
-    -o-linear-gradient( left top,
-      #0094f0 0%,
-      #0094f0 25%,
-      #007ecc 25%,
-      #007ecc 50%,
-      #0094f0 50%,
-      #0094f0 75%,
-      #0094f0 100% );
-  background-image:
-    linear-gradient( to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15) ),
-    linear-gradient( to right bottom,
-      #0094f0 0%,
-      #0094f0 25%,
-      #007ecc 25%,
-      #007ecc 50%,
-      #0094f0 50%,
-      #0094f0 75%,
-      #0094f0 100% );
-  background-size: 40px 40px;
-  margin-top: -1px;
-  margin-left: -1px;
-  padding: 0 1px;
-  height: 16px;
-  border-radius: 10em;
-  -webkit-animation: animate-stripes 3s linear infinite;
-  -moz-animation: animate-stripes 3s linear infinite;
-  -webkit-transition: width 0.5s ease-out;
-  -moz-transition: width 0.5s ease-out;
-  -ms-transition: width 0.5s ease-out;
-  -o-transition: width 0.5s ease-out;
-  transition: width 0.5s ease-out;
-}
-
-/**
- * Progress bar animations.
- */
-@-webkit-keyframes animate-stripes {
-  0% {background-position: 0 0, 0 0;} 100% {background-position: 0 0, -80px 0;}
-}
-@-moz-keyframes animate-stripes {
-  0% {background-position: 0 0, 0 0;} 100% {background-position: 0 0, -80px 0;}
-}
-@-o-keyframes animate-stripes {
-  0% {background-position: 0 0, 0 0;} 100% {background-position: 0 0, -80px 0;}
+.progress {
+  font-weight: bold;
 }
-@-ms-keyframes animate-stripes {
-  0% {background-position: 0 0, 0 0;} 100% {background-position: 0 0, -80px 0;}
+.progress .bar {
+  background: #ccc;
+  border-color: #666;
+  margin: 0 0.2em;
+  border-radius: 3px;
 }
-@keyframes animate-stripes {
-  0% {background-position: 0 0, 0 0;} 100% {background-position: 0 0, -80px 0;}
+.progress .filled {
+  background: #0072b9 url(../../../misc/progress.gif);
 }
 
 /**
diff --git a/core/modules/system/language.api.php b/core/modules/system/language.api.php
index 9fe910a..7090c0e 100644
--- a/core/modules/system/language.api.php
+++ b/core/modules/system/language.api.php
@@ -44,16 +44,10 @@ function hook_language_switch_links_alter(array &$links, $type, $path) {
  *   may contain the following elements:
  *   - name: The human-readable language type identifier.
  *   - description: A description of the language type.
- *   - locked: A boolean indicating if the user can choose wether to configure
- *     the language type or not using the UI.
  *   - fixed: A fixed array of language negotiation method identifiers to use to
- *     initialize this language. If locked is set to TRUE and fixed is set, it
- *     will always use the specified methods in the given priority order. If not
- *     present and locked is TRUE then LANGUAGE_NEGOTIATION_INTERFACE will be
- *     used.
- *
- *  @todo Rename the 'fixed' key to something more meaningful, for instance
- *     'negotiation settings'.
+ *     initialize this language. Defining this key makes the language type
+ *     non-configurable, so it will always use the specified methods in the
+ *     given priority order. Omit to make the language type configurable.
  *
  * @see hook_language_types_info_alter()
  * @ingroup language_negotiation
@@ -63,10 +57,8 @@ function hook_language_types_info() {
     'custom_language_type' => array(
       'name' => t('Custom language'),
       'description' => t('A custom language type.'),
-      'locked' => FALSE,
     ),
     'fixed_custom_language_type' => array(
-      'locked' => TRUE,
       'fixed' => array('custom_language_negotiation_method'),
     ),
   );
@@ -199,7 +191,7 @@ function hook_language_fallback_candidates_alter(array &$fallback_candidates) {
  * // Use the current default interface language.
  * $langcode = language(\Drupal\Core\Language\Language::TYPE_INTERFACE)->id;
  * // Instantiate the transliteration class.
- * $trans = drupal_container()->get('transliteration');
+ * $trans = Drupal::service('transliteration');
  * // Use this to transliterate some text.
  * $transformed = $trans->transliterate($string, $langcode);
  * @endcode
diff --git a/core/modules/system/lib/Drupal/system/Access/CronAccessCheck.php b/core/modules/system/lib/Drupal/system/Access/CronAccessCheck.php
index a0cc981..f90d2d3 100644
--- a/core/modules/system/lib/Drupal/system/Access/CronAccessCheck.php
+++ b/core/modules/system/lib/Drupal/system/Access/CronAccessCheck.php
@@ -7,20 +7,20 @@
 
 namespace Drupal\system\Access;
 
-use Drupal\Core\Access\StaticAccessCheckInterface;
+use Drupal\Core\Access\AccessCheckInterface;
 use Symfony\Component\Routing\Route;
 use Symfony\Component\HttpFoundation\Request;
 
 /**
  * Access check for cron routes.
  */
-class CronAccessCheck implements StaticAccessCheckInterface {
+class CronAccessCheck implements AccessCheckInterface {
 
   /**
-   * {@inheritdoc}
+   * Implements AccessCheckInterface::applies().
    */
-  public function appliesTo() {
-    return array('_access_system_cron');
+  public function applies(Route $route) {
+    return array_key_exists('_access_system_cron', $route->getRequirements());
   }
 
   /**
diff --git a/core/modules/system/lib/Drupal/system/Access/SystemPluginUiCheck.php b/core/modules/system/lib/Drupal/system/Access/SystemPluginUiCheck.php
deleted file mode 100644
index db13644..0000000
--- a/core/modules/system/lib/Drupal/system/Access/SystemPluginUiCheck.php
+++ /dev/null
@@ -1,55 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\system\Access\SystemPluginUiCheck.
- */
-
-namespace Drupal\system\Access;
-
-use Drupal\Component\Plugin\PluginManagerInterface;
-use Drupal\Core\Access\AccessCheckInterface;
-use Symfony\Component\Routing\Route;
-use Symfony\Component\HttpFoundation\Request;
-
-/**
- * Access check for system routes.
- */
-class SystemPluginUiCheck implements AccessCheckInterface {
-
-  /**
-   * The plugin UI manager.
-   *
-   * @var \Drupal\Component\Plugin\PluginManagerInterface
-   */
-  protected $pluginUiManager;
-
-  /**
-   * Constructs a SystemController object.
-   *
-   * @param \Drupal\Component\Plugin\PluginManagerInterface $plugin_ui_manager
-   *   The plugin UI manager.
-   */
-  public function __construct(PluginManagerInterface $plugin_ui_manager) {
-    $this->pluginUiManager = $plugin_ui_manager;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function applies(Route $route) {
-    return array_key_exists('_access_system_plugin_ui', $route->getRequirements());
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function access(Route $route, Request $request) {
-    if ($request->attributes->get('plugin_id')) {
-      // Checks access for a given plugin using the plugin's access() method.
-      $plugin_ui = $this->pluginUiManager->createInstance($request->attributes->get('plugin_id'), array());
-      return $plugin_ui->access(NULL) ? static::ALLOW : static::DENY;
-    }
-  }
-
-}
diff --git a/core/modules/system/lib/Drupal/system/Controller/SystemController.php b/core/modules/system/lib/Drupal/system/Controller/SystemController.php
deleted file mode 100644
index bd71353..0000000
--- a/core/modules/system/lib/Drupal/system/Controller/SystemController.php
+++ /dev/null
@@ -1,56 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\system\Controller\SystemController.
- */
-
-namespace Drupal\system\Controller;
-
-use Drupal\Component\Utility\Tags;
-use Drupal\Component\Utility\Unicode;
-use Symfony\Component\DependencyInjection\ContainerAware;
-use Symfony\Component\HttpFoundation\JsonResponse;
-use Symfony\Component\HttpFoundation\Request;
-
-
-/**
- * Returns responses for System routes.
- */
-class SystemController extends ContainerAware {
-
-  /**
-   * Autocompletes any plugin system tied to a plugin UI plugin.
-   *
-   * The passed plugin_id indicates the specific plugin_ui plugin that is in use
-   * here. The documentation within the annotation of that plugin will contain a
-   * manager for the plugins that need to be autocompleted allowing this
-   * function to autocomplete plugins for any plugin type.
-   *
-   * @param string $plugin_id
-   *   The plugin id for the calling plugin.
-   * @param Request $request
-   *   The request object that contains the typed tags.
-   *
-   * @return \Symfony\Component\HttpFoundation\JsonResponse
-   *   The matched plugins as json.
-   */
-  public function autocomplete($plugin_id, Request $request) {
-    $string_typed = $request->query->get('q');
-    $string_typed = Tags::explode($string_typed);
-    $string = Unicode::strtolower(array_pop($string_typed));
-    $matches = array();
-    if ($string) {
-      $plugin_ui = $this->container->get('plugin.manager.system.plugin_ui')->getDefinition($plugin_id);
-      $manager = $this->container->get($plugin_ui['manager']);
-      $titles = array();
-      foreach($manager->getDefinitions() as $plugin_id => $plugin) {
-        $titles[$plugin_id] = $plugin[$plugin_ui['title_attribute']];
-      }
-      $matches = preg_grep("/\b". $string . "/i", $titles);
-    }
-
-    return new JsonResponse($matches);
-  }
-
-}
diff --git a/core/modules/system/lib/Drupal/system/DateFormatAccessController.php b/core/modules/system/lib/Drupal/system/DateFormatAccessController.php
deleted file mode 100644
index 9608271..0000000
--- a/core/modules/system/lib/Drupal/system/DateFormatAccessController.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\system\DateFormatAccessController.
- */
-
-namespace Drupal\system;
-
-use Drupal\Core\Entity\EntityAccessController;
-use Drupal\Core\Entity\EntityInterface;
-use Drupal\Core\Session\AccountInterface;
-
-/**
- * Provides an access controller for date formats.
- */
-class DateFormatAccessController extends EntityAccessController {
-
-  /**
-   * {@inheritdoc}
-   */
-  protected function checkAccess(EntityInterface $entity, $operation, $langcode, AccountInterface $account) {
-    // There are no restrictions on viewing a date format.
-    if ($operation == 'view') {
-      return TRUE;
-    }
-    // Locked date formats cannot be updated or deleted.
-    if (in_array($operation, array('update', 'delete')) && $entity->isLocked()) {
-      return FALSE;
-    }
-    return user_access('administer site configuration', $account);
-  }
-
-}
diff --git a/core/modules/system/lib/Drupal/system/DateFormatInterface.php b/core/modules/system/lib/Drupal/system/DateFormatInterface.php
deleted file mode 100644
index 6801494..0000000
--- a/core/modules/system/lib/Drupal/system/DateFormatInterface.php
+++ /dev/null
@@ -1,88 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\system\DateFormatInterface.
- */
-
-namespace Drupal\system;
-
-use Drupal\Core\Config\Entity\ConfigEntityInterface;
-use Drupal\Core\Datetime\DrupalDateTime;
-
-/**
- * Provides an interface defining a date format.
- */
-interface DateFormatInterface extends ConfigEntityInterface {
-
-  /**
-   * Gets the date pattern string for this format.
-   *
-   * @param string $type
-   *   The date pattern type to set.
-   *
-   * @return string
-   *   The pattern string as expected by date().
-   */
-  public function getPattern($type = DrupalDateTime::PHP);
-
-  /**
-   * Sets the date pattern for this format.
-   *
-   * @param string $pattern
-   *   The date pattern to use for this format.
-   * @param string $type
-   *   The date pattern type to set.
-   *
-   * @return self
-   *   Returns the date format.
-   */
-  public function setPattern($pattern, $type = DrupalDateTime::PHP);
-
-  /**
-   * Adds a locale for this date format.
-   *
-   * @param string $locale
-   *   The locale to add for this format.
-   *
-   * @return self
-   *   Returns the date format.
-   */
-  public function addLocale($locale);
-
-  /**
-   * Sets the locales for this date format. This overwrites existing locales.
-   *
-   * @param array $locales
-   *   The array of locales to set for this format.
-   *
-   * @return self
-   *   Returns the date format.
-   */
-  public function setLocales(array $locales);
-
-  /**
-   * Returns an array of the locales for this date format.
-   *
-   * @return array
-   *   An array of locale names.
-   */
-  public function getLocales();
-
-  /**
-   * Determines if this data format has any locales.
-   *
-   * @return bool
-   *   TRUE if the date format has locales, FALSE otherwise.
-   */
-  public function hasLocales();
-
-  /**
-   * Determines if this date format is locked.
-   *
-   * @return bool
-   *   TRUE if the date format is locked, FALSE otherwise.
-   */
-  public function isLocked();
-
-}
diff --git a/core/modules/system/lib/Drupal/system/DateFormatListController.php b/core/modules/system/lib/Drupal/system/DateFormatListController.php
deleted file mode 100644
index e08c825..0000000
--- a/core/modules/system/lib/Drupal/system/DateFormatListController.php
+++ /dev/null
@@ -1,94 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\system\DateFormatListController.
- */
-
-namespace Drupal\system;
-
-use Drupal\Component\Utility\String;
-use Drupal\Core\Config\Entity\ConfigEntityListController;
-use Drupal\Core\Datetime\Date;
-use Drupal\Core\Entity\EntityInterface;
-use Drupal\Core\Entity\EntityStorageControllerInterface;
-use Drupal\Core\Extension\ModuleHandlerInterface;
-use Symfony\Component\DependencyInjection\ContainerInterface;
-
-/**
- * Provides a listing of date formats.
- */
-class DateFormatListController extends ConfigEntityListController {
-
-  /**
-   * The date service.
-   *
-   * @var \Drupal\Core\Datetime\Date
-   */
-  protected $dateService;
-
-  /**
-   * Constructs a new DateFormatListController object.
-   *
-   * @param string $entity_type
-   *   The type of entity to be listed.
-   * @param array $entity_info
-   *   An array of entity info for the entity type.
-   * @param \Drupal\Core\Entity\EntityStorageControllerInterface $storage
-   *   The entity storage controller class.
-   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
-   *   The module handler to invoke hooks on.
-   * @param \Drupal\Core\Datetime\Date $date_service
-   *   The date service.
-   */
-  public function __construct($entity_type, array $entity_info, EntityStorageControllerInterface $storage, ModuleHandlerInterface $module_handler, Date $date_service) {
-    parent::__construct($entity_type, $entity_info, $storage, $module_handler);
-
-    $this->dateService = $date_service;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function createInstance(ContainerInterface $container, $entity_type, array $entity_info) {
-    return new static(
-      $entity_type,
-      $entity_info,
-      $container->get('plugin.manager.entity')->getStorageController($entity_type),
-      $container->get('module_handler'),
-      $container->get('date')
-    );
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function load() {
-    return array_filter(parent::load(), function ($entity) {
-      return !$entity->isLocked();
-    });
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function buildHeader() {
-    $header['id'] = t('Machine name');
-    $header['label'] = t('Name');
-    $header['pattern'] = t('Pattern');
-    $header['operations'] = t('Operations');
-    return $header;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function buildRow(EntityInterface $entity) {
-    $row['id'] = $entity->id();
-    $row['label'] = String::checkPlain($entity->label());
-    $row['pattern'] = $this->dateService->format(REQUEST_TIME, $entity->id());
-    $row['operations']['data'] = $this->buildOperations($entity);
-    return $row;
-  }
-
-}
diff --git a/core/modules/system/lib/Drupal/system/Form/CronForm.php b/core/modules/system/lib/Drupal/system/Form/CronForm.php
index dd83495..c9b91b2 100644
--- a/core/modules/system/lib/Drupal/system/Form/CronForm.php
+++ b/core/modules/system/lib/Drupal/system/Form/CronForm.php
@@ -9,7 +9,7 @@
 
 use Drupal\Core\Config\ConfigFactory;
 use Drupal\Core\Config\Context\ContextInterface;
-use Drupal\Core\KeyValueStore\KeyValueStoreInterface;
+use Drupal\Core\KeyValueStore\KeyValueFactory;
 use Drupal\system\SystemConfigFormBase;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 use Symfony\Component\HttpFoundation\RedirectResponse;
@@ -36,9 +36,9 @@ class CronForm extends SystemConfigFormBase {
    * @param \Drupal\Core\KeyValueStore\KeyValueStoreInterface $state
    *   The state key value store.
    */
-  public function __construct(ConfigFactory $config_factory, ContextInterface $context, KeyValueStoreInterface $state) {
+  public function __construct(ConfigFactory $config_factory, ContextInterface $context, KeyValueFactory $key_value_factory) {
     parent::__construct($config_factory, $context);
-    $this->state = $state;
+    $this->state = $key_value_factory->get('state');
   }
 
   /**
@@ -48,7 +48,7 @@ public static function create(ContainerInterface $container) {
     return new static(
       $container->get('config.factory'),
       $container->get('config.context.free'),
-      $container->get('state')
+      $container->get('keyvalue')
     );
   }
 
diff --git a/core/modules/system/lib/Drupal/system/Form/DateFormatAddForm.php b/core/modules/system/lib/Drupal/system/Form/DateFormatAddForm.php
index 8305e52..6dec855 100644
--- a/core/modules/system/lib/Drupal/system/Form/DateFormatAddForm.php
+++ b/core/modules/system/lib/Drupal/system/Form/DateFormatAddForm.php
@@ -8,25 +8,86 @@
 namespace Drupal\system\Form;
 
 /**
- * Provides a form controller for adding a date format.
+ * Provides an add form for date formats.
  */
 class DateFormatAddForm extends DateFormatFormBase {
 
   /**
    * {@inheritdoc}
    */
-  protected function actions(array $form, array &$form_state) {
-    $actions = parent::actions($form, $form_state);
-    $actions['submit']['#value'] = t('Add format');
-    return $actions;
+  public function getFormID() {
+    return 'date_format_add';
   }
 
   /**
    * {@inheritdoc}
    */
-  public function submit(array $form, array &$form_state) {
-    parent::submit($form, $form_state);
-    drupal_set_message(t('Custom date format added.'));
+  public function buildForm(array $form, array &$form_state) {
+    form_load_include($form_state, 'admin.inc', 'system');
+    $form['date_format_name'] = array(
+      '#type' => 'textfield',
+      '#title' => 'Name',
+      '#maxlength' => 100,
+      '#description' => t('Name of the date format'),
+      '#default_value' => '',
+    );
+
+    $form['date_format_id'] = array(
+      '#type' => 'machine_name',
+      '#title' => t('Machine-readable name'),
+      '#description' => t('A unique machine-readable name. Can only contain lowercase letters, numbers, and underscores.'),
+      '#default_value' => '',
+      '#machine_name' => array(
+        'exists' => 'system_date_format_exists',
+        'source' => array('date_format_name'),
+      ),
+    );
+
+    if (class_exists('intlDateFormatter')) {
+      $description = t('A user-defined date format. See the <a href="@url">PHP manual</a> for available options.', array('@url' => 'http://userguide.icu-project.org/formatparse/datetime'));
+    }
+    else {
+      $description = t('A user-defined date format. See the <a href="@url">PHP manual</a> for available options.', array('@url' => 'http://php.net/manual/function.date.php'));
+    }
+    $form['date_format_pattern'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Format string'),
+      '#maxlength' => 100,
+      '#description' => $description,
+      '#default_value' => '',
+      '#field_suffix' => ' <small id="edit-date-format-suffix"></small>',
+      '#ajax' => array(
+        'callback' => 'system_date_time_lookup',
+        'event' => 'keyup',
+        'progress' => array('type' => 'throbber', 'message' => NULL),
+      ),
+      '#required' => TRUE,
+    );
+
+    $languages = language_list();
+
+    $options = array();
+    foreach ($languages as $langcode => $data) {
+      $options[$langcode] = $data->name;
+    }
+
+    if (!empty($options)) {
+      $form['date_langcode'] = array(
+        '#title' => t('Select localizations'),
+        '#type' => 'select',
+        '#options' => $options,
+        '#multiple' => TRUE,
+        '#default_value' => '',
+      );
+    }
+
+    $form['actions'] = array('#type' => 'actions');
+    $form['actions']['update'] = array(
+      '#type' => 'submit',
+      '#value' => t('Add format'),
+    );
+
+    return $form;
   }
 
 }
diff --git a/core/modules/system/lib/Drupal/system/Form/DateFormatDeleteForm.php b/core/modules/system/lib/Drupal/system/Form/DateFormatDeleteForm.php
index 3d3dfc7..327fb3f 100644
--- a/core/modules/system/lib/Drupal/system/Form/DateFormatDeleteForm.php
+++ b/core/modules/system/lib/Drupal/system/Form/DateFormatDeleteForm.php
@@ -7,56 +7,68 @@
 
 namespace Drupal\system\Form;
 
+use Drupal\Core\Form\ConfirmFormBase;
 use Drupal\Core\Controller\ControllerInterface;
-use Drupal\Core\Datetime\Date;
-use Drupal\Core\Entity\EntityConfirmFormBase;
-use Drupal\Core\Entity\EntityControllerInterface;
-use Drupal\Core\Extension\ModuleHandlerInterface;
+use Drupal\Core\Config\ConfigFactory;
 use Symfony\Component\DependencyInjection\ContainerInterface;
+use Symfony\Component\HttpFoundation\Request;
 
 /**
  * Builds a form to delete a date format.
  */
-class DateFormatDeleteForm extends EntityConfirmFormBase implements EntityControllerInterface {
+class DateFormatDeleteForm extends ConfirmFormBase implements ControllerInterface {
 
   /**
-   * The date service.
+   * The date format data to be deleted.
    *
-   * @var \Drupal\Core\Datetime\Date
+   * @var array
    */
-  protected $dateService;
+  protected $format;
 
   /**
-   * Constructs an DateFormatDeleteForm object.
+   * The ID of the date format to be deleted.
    *
-   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
-   *   The module handler service.
-   * @param \Drupal\Core\Datetime\Date $date_service
-   *   The date service.
+   * @var string
    */
-  public function __construct(ModuleHandlerInterface $module_handler, Date $date_service) {
-    parent::__construct($module_handler);
+  protected $formatID;
 
-    $this->dateService = $date_service;
+  /**
+   * The config factory.
+   *
+   * @var \Drupal\Core\Config\ConfigFactory
+   */
+  protected $configFactory;
+
+  /**
+   * Constructs a DateFormatDeleteForm object.
+   */
+  public function __construct(ConfigFactory $config_factory) {
+    $this->configFactory = $config_factory;
   }
 
   /**
    * {@inheritdoc}
    */
-  public static function createInstance(ContainerInterface $container, $entity_type, array $entity_info) {
+  public static function create(ContainerInterface $container) {
     return new static(
-      $container->get('module_handler'),
-      $container->get('date')
+      $container->get('config.factory')
     );
   }
 
   /**
    * {@inheritdoc}
    */
+  public function getFormID() {
+    return 'system_date_delete_format_form';
+  }
+
+  /**
+   * {@inheritdoc}
+   */
   public function getQuestion() {
     return t('Are you sure you want to remove the format %name : %format?', array(
-      '%name' => $this->entity->label(),
-      '%format' => $this->dateService->format(REQUEST_TIME, $this->entity->id()))
+      '%name' => $this->format['name'],
+      '%format' => format_date(REQUEST_TIME, $this->formatID))
     );
   }
 
@@ -71,17 +83,31 @@ public function getConfirmText() {
    * {@inheritdoc}
    */
   public function getCancelPath() {
-    return 'admin/config/regional/date-time';
+    return 'admin/config/regional/date-time/formats';
+  }
+
+  /**
+   * {@inheritdoc}
+   *
+   * @param string $format_id
+   *   The date format ID.
+   */
+  public function buildForm(array $form, array &$form_state, $format_id = NULL, Request $request = NULL) {
+    // We don't get the format ID in the returned format array.
+    $this->formatID = $format_id;
+    $this->format = $this->configFactory->get('system.date')->get("formats.$format_id");
+
+    return parent::buildForm($form, $form_state, $request);
   }
 
   /**
    * {@inheritdoc}
    */
-  public function submit(array $form, array &$form_state) {
-    $this->entity->delete();
-    drupal_set_message(t('Removed date format %format.', array('%format' => $this->entity->label())));
+  public function submitForm(array &$form, array &$form_state) {
+    system_date_format_delete($this->formatID);
+    drupal_set_message(t('Removed date format %format.', array('%format' => $this->format['name'])));
 
-    $form_state['redirect'] = 'admin/config/regional/date-time';
+    $form_state['redirect'] = 'admin/config/regional/date-time/formats';
   }
 
 }
diff --git a/core/modules/system/lib/Drupal/system/Form/DateFormatEditForm.php b/core/modules/system/lib/Drupal/system/Form/DateFormatEditForm.php
index ebf4df8..9af75b2 100644
--- a/core/modules/system/lib/Drupal/system/Form/DateFormatEditForm.php
+++ b/core/modules/system/lib/Drupal/system/Form/DateFormatEditForm.php
@@ -7,40 +7,125 @@
 
 namespace Drupal\system\Form;
 
+use Drupal\Core\Config\ConfigFactory;
+use Drupal\Core\Controller\ControllerInterface;
+use Symfony\Component\DependencyInjection\ContainerInterface;
+
 /**
- * Provides a form controller for editing a date format.
+ * Provides an edit form for date formats.
  */
-class DateFormatEditForm extends DateFormatFormBase {
+class DateFormatEditForm extends DateFormatFormBase implements ControllerInterface {
 
   /**
-   * {@inheritdoc}
+   * The config object.
+   *
+   * @var \Drupal\Core\Config\Config
    */
-  public function form(array $form, array &$form_state) {
-    $form = parent::form($form, $form_state);
+  protected $config;
 
-    $now = t('Displayed as %date', array('%date' => $this->dateService->format(REQUEST_TIME, $this->entity->id())));
-    $form['date_format_pattern']['#field_suffix'] = ' <small id="edit-date-format-suffix">' . $now . '</small>';
-    $form['date_format_pattern']['#default_value'] = $this->entity->getPattern($this->patternType);
+  /**
+   * Constructs a new date format form.
+   *
+   * @param \Drupal\Core\Config\ConfigFactory $config_factory
+   *   The config factory object.
+   */
+  public function __construct(ConfigFactory $config_factory) {
+    parent::__construct();
 
-    return $form;
+    $this->config = $config_factory->get('system.date');
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function create(ContainerInterface $container) {
+    return new static(
+      $container->get('config.factory')
+    );
   }
 
   /**
    * {@inheritdoc}
    */
-  protected function actions(array $form, array &$form_state) {
-    $actions = parent::actions($form, $form_state);
-    $actions['submit']['#value'] = t('Save format');
-    unset($actions['delete']);
-    return $actions;
+  public function getFormID() {
+    return 'date_format_edit';
   }
 
   /**
    * {@inheritdoc}
    */
-  public function submit(array $form, array &$form_state) {
-    parent::submit($form, $form_state);
-    drupal_set_message(t('Custom date format updated.'));
+  public function buildForm(array $form, array &$form_state, $date_format_id = NULL) {
+    form_load_include($form_state, 'admin.inc', 'system');
+    $format_info = $this->config->get('formats.' . $date_format_id);
+    $pattern = $this->patternType ? $format_info['pattern'][$this->patternType] : '';
+
+    $form['date_format_name'] = array(
+      '#type' => 'textfield',
+      '#title' => 'Name',
+      '#maxlength' => 100,
+      '#description' => t('Name of the date format'),
+      '#default_value' => empty($format_info['name']) ? '' : $format_info['name']
+    );
+
+    $now = t('Displayed as %date', array('%date' => format_date(REQUEST_TIME, $date_format_id)));
+
+    $form['date_format_id'] = array(
+      '#type' => 'machine_name',
+      '#title' => t('Machine-readable name'),
+      '#description' => t('A unique machine-readable name. Can only contain lowercase letters, numbers, and underscores.'),
+      '#disabled' => !empty($date_format_id),
+      '#default_value' => $date_format_id,
+      '#machine_name' => array(
+        'exists' => 'system_date_format_exists',
+        'source' => array('date_format_name'),
+      ),
+    );
+
+    if (class_exists('intlDateFormatter')) {
+      $description = t('A user-defined date format. See the <a href="@url">PHP manual</a> for available options.', array('@url' => 'http://userguide.icu-project.org/formatparse/datetime'));
+    }
+    else {
+      $description = t('A user-defined date format. See the <a href="@url">PHP manual</a> for available options.', array('@url' => 'http://php.net/manual/function.date.php'));
+    }
+    $form['date_format_pattern'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Format string'),
+      '#maxlength' => 100,
+      '#description' => $description,
+      '#default_value' => $pattern,
+      '#field_suffix' => ' <small id="edit-date-format-suffix">' . $now . '</small>',
+      '#ajax' => array(
+        'callback' => 'system_date_time_lookup',
+        'event' => 'keyup',
+        'progress' => array('type' => 'throbber', 'message' => NULL),
+      ),
+      '#required' => TRUE,
+    );
+
+    $languages = language_list();
+
+    $options = array();
+    foreach ($languages as $langcode => $data) {
+      $options[$langcode] = $data->name;
+    }
+
+    if (!empty($options)) {
+      $form['date_langcode'] = array(
+        '#title' => t('Select localizations'),
+        '#type' => 'select',
+        '#options' => $options,
+        '#multiple' => TRUE,
+        '#default_value' => empty($format_info['locales']) ? '' : $format_info['locales']
+      );
+    }
+
+    $form['actions'] = array('#type' => 'actions');
+    $form['actions']['update'] = array(
+      '#type' => 'submit',
+      '#value' => t('Save format'),
+    );
+
+    return $form;
   }
 
 }
diff --git a/core/modules/system/lib/Drupal/system/Form/DateFormatFormBase.php b/core/modules/system/lib/Drupal/system/Form/DateFormatFormBase.php
index d6aac67..eef17d8 100644
--- a/core/modules/system/lib/Drupal/system/Form/DateFormatFormBase.php
+++ b/core/modules/system/lib/Drupal/system/Form/DateFormatFormBase.php
@@ -7,20 +7,14 @@
 
 namespace Drupal\system\Form;
 
-use Drupal\Core\Ajax\AjaxResponse;
-use Drupal\Core\Ajax\ReplaceCommand;
-use Drupal\Core\Datetime\Date;
-use Drupal\Core\Entity\EntityControllerInterface;
-use Drupal\Core\Extension\ModuleHandlerInterface;
-use Symfony\Component\DependencyInjection\ContainerInterface;
 use Drupal\Core\Datetime\DrupalDateTime;
-use Drupal\Core\Entity\Query\QueryFactory;
-use Drupal\Core\Entity\EntityFormController;
+use Drupal\Core\Form\FormInterface;
+use Drupal\Component\Utility\String;
 
 /**
- * Provides a base form controller for date formats.
+ * Provides a base form for date formats.
  */
-abstract class DateFormatFormBase extends EntityFormController implements EntityControllerInterface {
+abstract class DateFormatFormBase implements FormInterface {
 
   /**
    * The date pattern type.
@@ -30,189 +24,48 @@
   protected $patternType;
 
   /**
-   * The entity query factory.
-   *
-   * @var \Drupal\Core\Entity\Query\QueryFactory
-   */
-  protected $queryFactory;
-
-  /**
-   * The date service.
-   *
-   * @var \Drupal\Core\Datetime\Date
-   */
-  protected $dateService;
-
-  /**
    * Constructs a new date format form.
-   *
-   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
-   *   The module handler.
-   * @param \Drupal\Core\Entity\Query\QueryFactory $query_factory
-   *   The entity query factory.
-   * @param \Drupal\Core\Datetime\Date $date_service
-   *   The date service.
    */
-  function __construct(ModuleHandlerInterface $module_handler, QueryFactory $query_factory, Date $date_service) {
-    parent::__construct($module_handler);
-
+  public function __construct() {
     $date = new DrupalDateTime();
     $this->patternType = $date->canUseIntl() ? DrupalDateTime::INTL : DrupalDateTime::PHP;
-
-    $this->queryFactory = $query_factory;
-    $this->dateService = $date_service;
   }
 
   /**
    * {@inheritdoc}
    */
-  public static function createInstance(ContainerInterface $container, $entity_type, array $entity_info) {
-    return new static(
-      $container->get('module_handler'),
-      $container->get('entity.query'),
-      $container->get('date')
-    );
-  }
-
-  /**
-   * Checks for an existing date format.
-   *
-   * @param string|int $entity_id
-   *   The entity ID.
-   * @param array $element
-   *   The form element.
-   * @param array $form_state
-   *   The form state.
-   *
-   * @return bool
-   *   TRUE if this format already exists, FALSE otherwise.
-   */
-  public function exists($entity_id, array $element,  array $form_state) {
-    return (bool) $this->queryFactory
-      ->get($this->entity->entityType())
-      ->condition('id', $element['#field_prefix'] . $entity_id)
-      ->execute();
-  }
-
-  /**
-   * Returns the date for a given format string.
-   *
-   * @param array $form
-   *   An associative array containing the structure of the form.
-   * @param array $form_state
-   *   An associative array containing the current state of the form.
-   *
-   * @return \Drupal\Core\Ajax\AjaxResponse
-   *   An AJAX Response to update the date-time value of the date format.
-   */
-  public static function dateTimeLookup(array $form, array $form_state) {
-    $format = '';
-    if (!empty($form_state['values']['date_format_pattern'])) {
-      $format = t('Displayed as %date_format', array('%date_format' => \Drupal::service('date')->format(REQUEST_TIME, 'custom', $form_state['values']['date_format_pattern'])));
-    }
-    // Return a command instead of a string, since the Ajax framework
-    // automatically prepends an additional empty DIV element for a string, which
-    // breaks the layout.
-    $response = new AjaxResponse();
-    $response->addCommand(new ReplaceCommand('#edit-date-format-suffix', '<small id="edit-date-format-suffix">' . $format . '</small>'));
-    return $response;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function form(array $form, array &$form_state) {
-    $form['label'] = array(
-      '#type' => 'textfield',
-      '#title' => 'Name',
-      '#maxlength' => 100,
-      '#description' => t('Name of the date format'),
-      '#default_value' => $this->entity->label(),
-    );
-
-    $form['id'] = array(
-      '#type' => 'machine_name',
-      '#title' => t('Machine-readable name'),
-      '#description' => t('A unique machine-readable name. Can only contain lowercase letters, numbers, and underscores.'),
-      '#disabled' => !$this->entity->isNew(),
-      '#default_value' => $this->entity->id(),
-      '#machine_name' => array(
-        'exists' => array($this, 'exists'),
-      ),
-    );
-
-    if (class_exists('intlDateFormatter')) {
-      $description = t('A user-defined date format. See the <a href="@url">PHP manual</a> for available options.', array('@url' => 'http://userguide.icu-project.org/formatparse/datetime'));
-    }
-    else {
-      $description = t('A user-defined date format. See the <a href="@url">PHP manual</a> for available options.', array('@url' => 'http://php.net/manual/function.date.php'));
-    }
-    $form['date_format_pattern'] = array(
-      '#type' => 'textfield',
-      '#title' => t('Format string'),
-      '#maxlength' => 100,
-      '#description' => $description,
-      '#default_value' => '',
-      '#field_suffix' => ' <small id="edit-date-format-suffix"></small>',
-      '#ajax' => array(
-        'callback' => array($this, 'dateTimeLookup'),
-        'event' => 'keyup',
-        'progress' => array('type' => 'throbber', 'message' => NULL),
-      ),
-      '#required' => TRUE,
-    );
-
-    $languages = language_list();
-
-    $options = array();
-    foreach ($languages as $langcode => $data) {
-      $options[$langcode] = $data->name;
-    }
-
-    if (!empty($options)) {
-      $form['locales'] = array(
-        '#title' => t('Languages'),
-        '#type' => 'select',
-        '#options' => $options,
-        '#multiple' => TRUE,
-        '#default_value' => $this->entity->getLocales(),
-      );
-    }
-
-    return parent::form($form, $form_state);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function validate(array $form, array &$form_state) {
-    parent::validate($form, $form_state);
+  public function validateForm(array &$form, array &$form_state) {
+    $formats = system_get_date_formats();
+    $format = trim($form_state['values']['date_format_pattern']);
 
     // The machine name field should already check to see if the requested
     // machine name is available. Regardless of machine_name or human readable
     // name, check to see if the provided pattern exists.
-    $format = trim($form_state['values']['date_format_pattern']);
-    $formats = $this->queryFactory
-      ->get($this->entity->entityType())
-      ->condition('pattern.' . $this->patternType, $format)
-      ->execute();
-
-    // Exclude the current format.
-    unset($formats[$this->entity->id()]);
-    if (!empty($formats)) {
-      form_set_error('date_format_pattern', t('This format already exists. Enter a unique format string.'));
+    if (!empty($formats) && in_array($format, array_values($formats)) && (!isset($form_state['values']['date_format_id']) || $form_state['values']['date_format_id'] != $formats[$format]['date_format_id'])) {
+      form_set_error('date_format', t('This format already exists. Enter a unique format string.'));
     }
   }
 
   /**
    * {@inheritdoc}
    */
-  public function submit(array $form, array &$form_state) {
-    $form_state['redirect'] = 'admin/config/regional/date-time';
-    $form_state['values']['pattern'][$this->patternType] = trim($form_state['values']['date_format_pattern']);
+  public function submitForm(array &$form, array &$form_state) {
+    $format = array();
+    $format['name'] = String::checkPlain($form_state['values']['date_format_name']);
+    $format['pattern'][$this->patternType] = trim($form_state['values']['date_format_pattern']);
+    $format['locales'] = !empty($form_state['values']['date_langcode']) ? $form_state['values']['date_langcode'] : array();
+    // Formats created in the UI are not locked.
+    $format['locked'] = 0;
+
+    system_date_format_save($form_state['values']['date_format_id'], $format);
+    if (!empty($form_state['values']['date_format_id'])) {
+      drupal_set_message(t('Custom date format updated.'));
+    }
+    else {
+      drupal_set_message(t('Custom date format added.'));
+    }
 
-    parent::submit($form, $form_state);
-    $this->entity->save();
+    $form_state['redirect'] = 'admin/config/regional/date-time/formats';
   }
 
 }
diff --git a/core/modules/system/lib/Drupal/system/Form/DateFormatLocalizeResetForm.php b/core/modules/system/lib/Drupal/system/Form/DateFormatLocalizeResetForm.php
index d3de481..b2efd41 100644
--- a/core/modules/system/lib/Drupal/system/Form/DateFormatLocalizeResetForm.php
+++ b/core/modules/system/lib/Drupal/system/Form/DateFormatLocalizeResetForm.php
@@ -102,9 +102,7 @@ public function buildForm(array $form, array &$form_state, $langcode = NULL, Req
    * {@inheritdoc}
    */
   public function submitForm(array &$form, array &$form_state) {
-    foreach (config_get_storage_names_with_prefix('locale.config.' . $this->language->id . '.system.date_format.') as $config_id) {
-      $this->configFactory->get($config_id)->delete();
-    }
+    $this->configFactory->get('locale.config.' . $this->language->id . '.system.date')->delete();
 
     $form_state['redirect'] = 'admin/config/regional/date-time/locale';
   }
diff --git a/core/modules/system/lib/Drupal/system/Form/ModulesInstallConfirmForm.php b/core/modules/system/lib/Drupal/system/Form/ModulesInstallConfirmForm.php
new file mode 100644
index 0000000..23d3ada
--- /dev/null
+++ b/core/modules/system/lib/Drupal/system/Form/ModulesInstallConfirmForm.php
@@ -0,0 +1,95 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\system\Form\ModulesInstallConfirmForm.
+ */
+
+namespace Drupal\system\Form;
+
+use Drupal\Core\Form\ConfirmFormBase;
+use Symfony\Component\HttpFoundation\Request;
+
+/**
+ * Builds a confirmation form for required modules.
+ *
+ * Used internally in system_modules().
+ */
+class ModulesInstallConfirmForm extends ConfirmFormBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getQuestion() {
+    return t('Some required modules must be enabled');
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getConfirmText() {
+    return t('Continue');
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getCancelPath() {
+    return 'admin/modules';
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getDescription() {
+    return t('Would you like to continue with the above?');
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getFormID() {
+    return 'system_modules_confirm_form';
+  }
+
+  /**
+   * {@inheritdoc}
+   * @param array $modules
+   *   The array of modules.
+   * @param array $storage
+   *   Temporary storage of module dependency information.
+   */
+  public function buildForm(array $form, array &$form_state, $modules = array(), $storage = array(), Request $request = NULL) {
+    $items = array();
+
+    $form['validation_modules'] = array('#type' => 'value', '#value' => $modules);
+    $form['status']['#tree'] = TRUE;
+
+    foreach ($storage['more_required'] as $info) {
+      $t_argument = array(
+        '@module' => $info['name'],
+        '@required' => implode(', ', $info['requires']),
+      );
+      $items[] = format_plural(count($info['requires']), 'You must enable the @required module to install @module.', 'You must enable the @required modules to install @module.', $t_argument);
+    }
+
+    foreach ($storage['missing_modules'] as $name => $info) {
+      $t_argument = array(
+        '@module' => $name,
+        '@depends' => implode(', ', $info['depends']),
+      );
+      $items[] = format_plural(count($info['depends']), 'The @module module is missing, so the following module will be disabled: @depends.', 'The @module module is missing, so the following modules will be disabled: @depends.', $t_argument);
+    }
+
+    $form['modules'] = array('#theme' => 'item_list', '#items' => $items);
+
+    return parent::buildForm($form, $form_state, $request);
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function submitForm(array &$form, array &$form_state) {
+  }
+
+}
diff --git a/core/modules/system/lib/Drupal/system/Form/ModulesListConfirmForm.php b/core/modules/system/lib/Drupal/system/Form/ModulesListConfirmForm.php
deleted file mode 100644
index 3b69f8c..0000000
--- a/core/modules/system/lib/Drupal/system/Form/ModulesListConfirmForm.php
+++ /dev/null
@@ -1,190 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\system\Form\ModulesListConfirmForm.
- */
-
-namespace Drupal\system\Form;
-
-use Drupal\Core\Controller\ControllerInterface;
-use Drupal\Core\Extension\ModuleHandlerInterface;
-use Drupal\Core\Form\ConfirmFormBase;
-use Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface;
-use Drupal\Core\StringTranslation\TranslationManager;
-use Symfony\Component\DependencyInjection\ContainerInterface;
-use Symfony\Component\HttpFoundation\RedirectResponse;
-use Symfony\Component\HttpFoundation\Request;
-
-/**
- * Builds a confirmation form for enabling modules with dependencies.
- */
-class ModulesListConfirmForm extends ConfirmFormBase implements ControllerInterface {
-
-  /**
-   * The module handler service.
-   *
-   * @var \Drupal\Core\Extension\ModuleHandlerInterface
-   */
-  protected $moduleHandler;
-
-  /**
-   * The expirable key value store.
-   *
-   * @var \Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface
-   */
-  protected $keyValueExpirable;
-
-  /**
-   * The translation manager service.
-   *
-   * @var \Drupal\Core\StringTranslation\TranslationManager
-   */
-  protected $translationManager;
-
-  /**
-   * The request object.
-   *
-   * @var \Symfony\Component\HttpFoundation\Request
-   */
-  protected $request;
-
-  /**
-   * An associative list of modules to enable or disable.
-   *
-   * @var array
-   */
-  protected $modules = array();
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function create(ContainerInterface $container) {
-    return new static(
-      $container->get('module_handler'),
-      $container->get('keyvalue.expirable')->get('module_list'),
-      $container->get('string_translation')
-    );
-  }
-
-  /**
-   * Constructs a ModulesListConfirmForm object.
-   *
-   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
-   *   The module handler.
-   * @param \Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface $key_value_expirable
-   *   The key value expirable factory.
-   * @param \Drupal\Core\StringTranslation\TranslationManager
-   *   The translation manager.
-   */
-  public function __construct(ModuleHandlerInterface $module_handler, KeyValueStoreExpirableInterface $key_value_expirable, TranslationManager $translation_manager) {
-    $this->moduleHandler = $module_handler;
-    $this->keyValueExpirable = $key_value_expirable;
-    $this->translationManager = $translation_manager;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getQuestion() {
-    return $this->translationManager->translate('Some required modules must be enabled');
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getCancelPath() {
-    return 'admin/modules';
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getConfirmText() {
-    return $this->translationManager->translate('Continue');
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getDescription() {
-    return $this->translationManager->translate('Would you like to continue with the above?');
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getFormID() {
-    return 'system_modules_confirm_form';
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function buildForm(array $form, array &$form_state, Request $request = NULL) {
-    $account = $request->attributes->get('account')->id();
-    $this->modules = $this->keyValueExpirable->get($account);
-
-    // Redirect to the modules list page if the key value store is empty.
-    if (!$this->modules) {
-      return new RedirectResponse(url($this->getCancelPath(), array('absolute' => TRUE)));
-    }
-
-    // Store the request for use in the submit handler.
-    $this->request = $request;
-
-    $items = array();
-    // Display a list of required modules that have to be installed as well but
-    // were not manually selected.
-    foreach ($this->modules['dependencies'] as $module => $dependencies) {
-      $items[] = format_plural(count($dependencies), 'You must enable the @required module to install @module.', 'You must enable the @required modules to install @module.', array(
-        '@module' => $this->modules['enable'][$module],
-        '@required' => implode(', ', $dependencies),
-      ));
-    }
-
-    foreach ($this->modules['missing'] as $name => $dependents) {
-      $items[] = format_plural(count($dependents), 'The @module module is missing, so the following module will be disabled: @depends.', 'The @module module is missing, so the following modules will be disabled: @depends.', array(
-        '@module' => $name,
-        '@depends' => implode(', ', $dependents),
-      ));
-    }
-
-    $form['message'] = array(
-      '#theme' => 'item_list',
-      '#items' => $items,
-    );
-
-    return parent::buildForm($form, $form_state, $this->request);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function submitForm(array &$form, array &$form_state) {
-    // Remove the key value store entry.
-    $account = $this->request->attributes->get('account')->id();
-    $this->keyValueExpirable->delete($account);
-
-    // Gets list of modules prior to install process.
-    $before = $this->moduleHandler->getModuleList();
-
-    // Installs, enables, and disables modules.
-    if (!empty($this->modules['enable'])) {
-      $this->moduleHandler->enable(array_keys($this->modules['enable']));
-    }
-    if (!empty($this->modules['disable'])) {
-      $this->moduleHandler->disable(array_keys($this->modules['disable']));
-    }
-
-    // Gets module list after install process, flushes caches and displays a
-    // message if there are changes.
-    if ($before != $this->moduleHandler->getModuleList()) {
-      drupal_flush_all_caches();
-      drupal_set_message($this->translationManager->translate('The configuration options have been saved.'));
-    }
-
-    $form_state['redirect'] = $this->getCancelPath();
-  }
-
-}
diff --git a/core/modules/system/lib/Drupal/system/Form/ModulesListForm.php b/core/modules/system/lib/Drupal/system/Form/ModulesListForm.php
deleted file mode 100644
index e8595ca..0000000
--- a/core/modules/system/lib/Drupal/system/Form/ModulesListForm.php
+++ /dev/null
@@ -1,458 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\system\Form\ModulesListForm.
- */
-
-namespace Drupal\system\Form;
-
-use Drupal\Core\Controller\ControllerInterface;
-use Drupal\Core\Extension\ModuleHandlerInterface;
-use Drupal\Core\Form\FormInterface;
-use Drupal\Core\KeyValueStore\KeyValueExpirableFactory;
-use Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface;
-use Drupal\Core\StringTranslation\TranslationManager;
-use Drupal\Component\Utility\Unicode;
-use Symfony\Component\DependencyInjection\ContainerInterface;
-use Symfony\Component\HttpFoundation\Request;
-
-/**
- * Provides module enable/disable interface.
- *
- * The list of modules gets populated by module.info.yml files, which contain
- * each module's name, description, and information about which modules it
- * requires. See drupal_parse_info_file() for info on module.info.yml
- * descriptors.
- */
-class ModulesListForm implements FormInterface, ControllerInterface {
-
-  /**
-   * The module handler service.
-   *
-   * @var \Drupal\Core\Extension\ModuleHandlerInterface
-   */
-  protected $moduleHandler;
-
-  /**
-   * The expirable key value store.
-   *
-   * @var \Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface
-   */
-  protected $keyValueExpirable;
-
-  /**
-   * The translation manager service.
-   *
-   * @var \Drupal\Core\StringTranslation\TranslationManager
-   */
-  protected $translationManager;
-
-  /**
-   * The request object.
-   *
-   * @var \Symfony\Component\HttpFoundation\Request
-   */
-  protected $request;
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function create(ContainerInterface $container) {
-    return new static(
-      $container->get('module_handler'),
-      $container->get('keyvalue.expirable')->get('module_list'),
-      $container->get('string_translation')
-    );
-  }
-
-  /**
-   * Constructs a ModulesListForm object.
-   *
-   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
-   *   The module handler.
-   * @param \Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface $key_value_expirable
-   *   The key value expirable factory.
-   * @param \Drupal\Core\StringTranslation\TranslationManager
-   *   The translation manager.
-   */
-  public function __construct(ModuleHandlerInterface $module_handler, KeyValueStoreExpirableInterface $key_value_expirable, TranslationManager $translation_manager) {
-    $this->moduleHandler = $module_handler;
-    $this->keyValueExpirable = $key_value_expirable;
-    $this->translationManager = $translation_manager;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getFormID() {
-    return 'system_modules';
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function buildForm(array $form, array &$form_state, Request $request = NULL) {
-    require_once DRUPAL_ROOT . '/core/includes/install.inc';
-    $distribution = check_plain(drupal_install_profile_distribution_name());
-
-    // Include system.admin.inc so we can use the sort callbacks.
-    $this->moduleHandler->loadInclude('system', 'inc', 'system.admin');
-
-    // Store the request for use in the submit handler.
-    $this->request = $request;
-
-    $form['filters'] = array(
-      '#type' => 'container',
-      '#attributes' => array(
-        'class' => array('table-filter', 'js-show'),
-      ),
-    );
-
-    $form['filters']['text'] = array(
-      '#type' => 'search',
-      '#title' => $this->translationManager->translate('Search'),
-      '#size' => 30,
-      '#placeholder' => $this->translationManager->translate('Enter module name'),
-      '#attributes' => array(
-        'class' => array('table-filter-text'),
-        'data-table' => '#system-modules',
-        'autocomplete' => 'off',
-        'title' => $this->translationManager->translate('Enter a part of the module name or description to filter by.'),
-      ),
-    );
-
-    // Sort all modules by their names.
-    $modules = system_rebuild_module_data();
-    uasort($modules, 'system_sort_modules_by_info_name');
-
-    // Iterate over each of the modules.
-    $form['modules']['#tree'] = TRUE;
-    foreach ($modules as $filename => $module) {
-      if (empty($module->info['hidden'])) {
-        $package = $module->info['package'];
-        $form['modules'][$package][$filename] = $this->buildRow($modules, $module, $distribution);
-      }
-    }
-
-    // Add a wrapper around every package.
-    foreach (element_children($form['modules']) as $package) {
-      $form['modules'][$package] += array(
-        '#type' => 'details',
-        '#title' => $this->translationManager->translate($package),
-        '#theme' => 'system_modules_details',
-        '#header' => array(
-          array('data' => '<span class="element-invisible">' . $this->translationManager->translate('Enabled') . '</span>', 'class' => array('checkbox')),
-          array('data' => $this->translationManager->translate('Name'), 'class' => array('name')),
-          array('data' => $this->translationManager->translate('Description'), 'class' => array('description', RESPONSIVE_PRIORITY_LOW)),
-        ),
-        // Ensure that the "Core" package comes first.
-        '#weight' => $package == 'Core' ? -10 : NULL,
-      );
-    }
-
-    // Lastly, sort all packages by title.
-    uasort($form['modules'], 'element_sort_by_title');
-
-    $form['#attached']['library'][] = array('system', 'drupal.system.modules');
-    $form['actions'] = array('#type' => 'actions');
-    $form['actions']['submit'] = array(
-      '#type' => 'submit',
-      '#value' => $this->translationManager->translate('Save configuration'),
-    );
-
-    return $form;
-  }
-
-  /**
-   * Builds a table row for the system modules page.
-   *
-   * @param array $modules
-   *   The list existing modules.
-   * @param object $module
-   *   The module for which to build the form row.
-   * @param $distribution
-   *
-   * @return array
-   *   The form row for the given module.
-   */
-  protected function buildRow(array $modules, $module, $distribution) {
-    // Set the basic properties.
-    $row['#required'] = array();
-    $row['#requires'] = array();
-    $row['#required_by'] = array();
-
-    $row['name']['#markup'] = $module->info['name'];
-    $row['description']['#markup'] = $this->translationManager->translate($module->info['description']);
-    $row['version']['#markup'] = $module->info['version'];
-
-    // Add links for each module.
-    // Used when checking if a module implements a help page.
-    $help = $this->moduleHandler->moduleExists('help') ? drupal_help_arg() : FALSE;
-
-    // Generate link for module's help page, if there is one.
-    $row['links']['help'] = array();
-    if ($help && $module->status && in_array($module->name, $this->moduleHandler->getImplementations('help'))) {
-      if ($this->moduleHandler->invoke($module->name, 'help', array("admin/help#$module->name", $help))) {
-        $row['links']['help'] = array(
-          '#type' => 'link',
-          '#title' => $this->translationManager->translate('Help'),
-          '#href' => "admin/help/$module->name",
-          '#options' => array('attributes' => array('class' =>  array('module-link', 'module-link-help'), 'title' => $this->translationManager->translate('Help'))),
-        );
-      }
-    }
-
-    // Generate link for module's permission, if the user has access to it.
-    $row['links']['permissions'] = array();
-    if ($module->status && user_access('administer permissions') && in_array($module->name, $this->moduleHandler->getImplementations('permission'))) {
-      $row['links']['permissions'] = array(
-        '#type' => 'link',
-        '#title' => $this->translationManager->translate('Permissions'),
-        '#href' => 'admin/people/permissions',
-        '#options' => array('fragment' => 'module-' . $module->name, 'attributes' => array('class' => array('module-link', 'module-link-permissions'), 'title' => $this->translationManager->translate('Configure permissions'))),
-      );
-    }
-
-    // Generate link for module's configuration page, if it has one.
-    $row['links']['configure'] = array();
-    if ($module->status && isset($module->info['configure'])) {
-      if (($configure = menu_get_item($module->info['configure'])) && $configure['access']) {
-        $row['links']['configure'] = array(
-          '#type' => 'link',
-          '#title' => $this->translationManager->translate('Configure'),
-          '#href' => $configure['href'],
-          '#options' => array('attributes' => array('class' => array('module-link', 'module-link-configure'), 'title' => $configure['description'])),
-        );
-      }
-    }
-
-    // Present a checkbox for installing and indicating the status of a module.
-    $row['enable'] = array(
-      '#type' => 'checkbox',
-      '#title' => $this->translationManager->translate('Enable'),
-      '#default_value' => (bool) $module->status,
-    );
-
-    // Disable the checkbox for required modules.
-    if (!empty($module->info['required'])) {
-      // Used when displaying modules that are required by the installation profile
-      $row['enable']['#disabled'] = TRUE;
-      $row['#required_by'][] = $distribution . (!empty($module->info['explanation']) ? ' ('. $module->info['explanation'] .')' : '');
-    }
-
-    // Check the compatibilities.
-    $compatible = TRUE;
-    $status = '';
-
-    // Check the core compatibility.
-    if ($module->info['core'] != DRUPAL_CORE_COMPATIBILITY) {
-      $compatible = FALSE;
-      $status .= $this->translationManager->translate('This version is not compatible with Drupal !core_version and should be replaced.', array(
-        '!core_version' => DRUPAL_CORE_COMPATIBILITY,
-      ));
-    }
-
-    // Ensure this module is compatible with the currently installed version of PHP.
-    if (version_compare(phpversion(), $module->info['php']) < 0) {
-      $compatible = FALSE;
-      $required = $module->info['php'] . (substr_count($module->info['php'], '.') < 2 ? '.*' : '');
-      $status .= $this->translationManager->translate('This module requires PHP version @php_required and is incompatible with PHP version !php_version.', array(
-        '@php_required' => $required,
-        '!php_version' => phpversion(),
-      ));
-    }
-
-    // If this module is not compatible, disable the checkbox.
-    if (!$compatible) {
-      $row['enable']['#disabled'] = TRUE;
-      $row['description'] = array(
-        '#theme' => 'system_modules_incompatible',
-        '#message' => $status,
-      );
-    }
-
-    // If this module requires other modules, add them to the array.
-    foreach ($module->requires as $dependency => $version) {
-      if (!isset($modules[$dependency])) {
-        $row['#requires'][$dependency] = $this->translationManager->translate('@module (<span class="admin-missing">missing</span>)', array('@module' => Unicode::ucfirst($dependency)));
-        $row['enable']['#disabled'] = TRUE;
-      }
-      // Only display visible modules.
-      elseif (empty($modules[$dependency]->hidden)) {
-        $name = $modules[$dependency]->info['name'];
-        // Disable the module's checkbox if it is incompatible with the
-        // dependency's version.
-        if ($incompatible_version = drupal_check_incompatibility($version, str_replace(DRUPAL_CORE_COMPATIBILITY . '-', '', $modules[$dependency]->info['version']))) {
-          $row['#requires'][$dependency] = $this->translationManager->translate('@module (<span class="admin-missing">incompatible with</span> version @version)', array(
-            '@module' => $name . $incompatible_version,
-            '@version' => $modules[$dependency]->info['version'],
-          ));
-          $row['enable']['#disabled'] = TRUE;
-        }
-        // Disable the checkbox if the dependency is incompatible with this
-        // version of Drupal core.
-        elseif ($modules[$dependency]->info['core'] != DRUPAL_CORE_COMPATIBILITY) {
-          $row['#requires'][$dependency] = $this->translationManager->translate('@module (<span class="admin-missing">incompatible with</span> this version of Drupal core)', array(
-            '@module' => $name,
-          ));
-          $row['enable']['#disabled'] = TRUE;
-        }
-        elseif ($modules[$dependency]->status) {
-          $row['#requires'][$dependency] = $this->translationManager->translate('@module', array('@module' => $name));
-        }
-        else {
-          $row['#requires'][$dependency] = $this->translationManager->translate('@module (<span class="admin-disabled">disabled</span>)', array('@module' => $name));
-        }
-      }
-    }
-
-    // If this module is required by other modules, list those, and then make it
-    // impossible to disable this one.
-    foreach ($module->required_by as $dependent => $version) {
-      if (isset($modules[$dependent]) && empty($modules[$dependent]->info['hidden'])) {
-        if ($modules[$dependent]->status == 1 && $module->status == 1) {
-          $row['#required_by'][$dependent] = $this->translationManager->translate('@module', array('@module' => $modules[$dependent]->info['name']));
-          $row['enable']['#disabled'] = TRUE;
-        }
-        else {
-          $row['#required_by'][$dependent] = $this->translationManager->translate('@module (<span class="admin-disabled">disabled</span>)', array('@module' => $modules[$dependent]->info['name']));
-        }
-      }
-    }
-
-    return $row;
-  }
-
-  /**
-   * Helper function for building a list of modules to enable or disable.
-   *
-   * @param array $form_state
-   *   The form state array.
-   *
-   * @return array
-   *   An array of modules to disable/enable and their dependencies.
-   */
-  protected function buildModuleList(array $form_state) {
-    $packages = $form_state['values']['modules'];
-
-    // Build a list of modules to enable or disable.
-    $modules = array(
-      'enable' => array(),
-      'disable' => array(),
-      'dependencies' => array(),
-      'missing' => array(),
-    );
-
-    // Build a list of missing dependencies.
-    // @todo This should really not be handled here.
-    $data = system_rebuild_module_data();
-    foreach ($data as $name => $module) {
-      // Modules with missing dependencies have to be disabled.
-      if ($this->moduleHandler->moduleExists($name)) {
-        foreach (array_keys($module->requires) as $dependency) {
-          if (!isset($data[$dependency])) {
-            $modules['missing'][$dependency][$name] = $module->info['name'];
-            $modules['disable'][$name] = $module->info['name'];
-          }
-        }
-      }
-      elseif (!empty($module->required)) {
-        $modules['enable'][$name] = $module->info['name'];
-      }
-    }
-
-    // First, build a list of all modules that were selected.
-    foreach ($packages as $items) {
-      foreach ($items as $name => $checkbox) {
-        // Do not override modules that are forced to be enabled/disabled.
-        if (isset($modules['enable'][$name]) || isset($modules['disable'][$name])) {
-          continue;
-        }
-
-        $enabled = $this->moduleHandler->moduleExists($name);
-        if (!$checkbox['enable'] && $enabled) {
-          $modules['disable'][$name] = $data[$name]->info['name'];
-        }
-        elseif ($checkbox['enable'] && !$enabled) {
-          $modules['enable'][$name] = $data[$name]->info['name'];
-        }
-      }
-    }
-
-    // Add all dependencies to a list.
-    while (list($module) = each($modules['enable'])) {
-      foreach (array_keys($data[$module]->requires) as $dependency) {
-        if (!isset($modules['enable'][$dependency]) && !$this->moduleHandler->moduleExists($dependency)) {
-          $modules['dependencies'][$module][$dependency] = $data[$dependency]->info['name'];
-          $modules['enable'][$dependency] = $data[$dependency]->info['name'];
-        }
-      }
-    }
-
-    // Make sure the install API is available.
-    include_once DRUPAL_ROOT . '/core/includes/install.inc';
-
-    // Invoke hook_requirements('install'). If failures are detected, make
-    // sure the dependent modules aren't installed either.
-    foreach (array_keys($modules['enable']) as $module) {
-      if (drupal_get_installed_schema_version($module) == SCHEMA_UNINSTALLED && !drupal_check_module($module)) {
-        unset($modules['enable'][$module]);
-        foreach (array_keys($data[$module]->required_by) as $dependent) {
-          unset($modules['enable'][$dependent]);
-          unset($modules['dependencies'][$dependent]);
-        }
-      }
-    }
-
-    return $modules;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function validateForm(array &$form, array &$form_state) {
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function submitForm(array &$form, array &$form_state) {
-    // Retrieve a list of modules to enable/disable and their dependencies.
-    $modules = $this->buildModuleList($form_state);
-
-    // Check if we have to enable any dependencies. If there is one or more
-    // dependencies that are not enabled yet, redirect to the confirmation form.
-    if (!empty($modules['dependencies']) || !empty($modules['missing'])) {
-      // Write the list of changed module states into a key value store.
-      $account = $this->request->attributes->get('account')->id();
-      $this->keyValueExpirable->setWithExpire($account, $modules, 60);
-
-      // Redirect to the confirmation form.
-      $form_state['redirect'] = 'admin/modules/list/confirm';
-
-      // We can exit here because at least one modules has dependencies
-      // which we have to prompt the user for in a confirmation form.
-      return;
-    }
-
-    // Gets list of modules prior to install process.
-    $before = $this->moduleHandler->getModuleList();
-
-    // There seem to be no dependencies that would need approval.
-    if (!empty($modules['enable'])) {
-      $this->moduleHandler->enable(array_keys($modules['enable']));
-    }
-    if (!empty($modules['disable'])) {
-      $this->moduleHandler->disable(array_keys($modules['disable']));
-    }
-
-    // Gets module list after install process, flushes caches and displays a
-    // message if there are changes.
-    if ($before != $this->moduleHandler->getModuleList()) {
-      drupal_flush_all_caches();
-      drupal_set_message(t('The configuration options have been saved.'));
-    }
-  }
-
-}
diff --git a/core/modules/system/lib/Drupal/system/Form/ModulesUninstallConfirmForm.php b/core/modules/system/lib/Drupal/system/Form/ModulesUninstallConfirmForm.php
index dd793cc..77c841c 100644
--- a/core/modules/system/lib/Drupal/system/Form/ModulesUninstallConfirmForm.php
+++ b/core/modules/system/lib/Drupal/system/Form/ModulesUninstallConfirmForm.php
@@ -8,94 +8,27 @@
 namespace Drupal\system\Form;
 
 use Drupal\Core\Form\ConfirmFormBase;
-use Drupal\Core\StringTranslation\TranslationManager;
 use Symfony\Component\HttpFoundation\Request;
-use Symfony\Component\HttpFoundation\RedirectResponse;
-use Symfony\Component\DependencyInjection\ContainerInterface;
-use Drupal\Core\Controller\ControllerInterface;
-use Drupal\Core\KeyValueStore\KeyValueExpirableFactory;
-use Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface;
-use Drupal\Core\Extension\ModuleHandlerInterface;
 
 /**
  * Builds a confirmation form to uninstall selected modules.
+ *
+ * Used internally from system_modules_uninstall().
  */
-class ModulesUninstallConfirmForm extends ConfirmFormBase implements ControllerInterface {
-
-  /**
-   * The module handler service.
-   *
-   * @var \Drupal\Core\Extension\ModuleHandlerInterface
-   */
-  protected $moduleHandler;
-
-  /**
-   * The expirable key value store.
-   *
-   * @var \Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface
-   */
-  protected $keyValueExpirable;
-
-  /**
-   * The translation manager service.
-   *
-   * @var \Drupal\Core\StringTranslation\TranslationManager
-   */
-  protected $translationManager;
-
-  /**
-   * The request object.
-   *
-   * @var \Symfony\Component\HttpFoundation\Request
-   */
-  protected $request;
-
-  /**
-   * An array of modules to uninstall.
-   *
-   * @var array
-   */
-  protected $modules = array();
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function create(ContainerInterface $container) {
-    return new static(
-      $container->get('module_handler'),
-      $container->get('keyvalue.expirable')->get('modules_uninstall'),
-      $container->get('string_translation')
-    );
-  }
-
-  /**
-   * Constructs a ModulesUninstallConfirmForm object.
-   *
-   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
-   *   The module handler.
-   * @param \Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface $key_value_expirable
-   *   The key value expirable factory.
-   * @param \Drupal\Core\StringTranslation\TranslationManager
-   *   The translation manager.
-   */
-  public function __construct(ModuleHandlerInterface $module_handler, KeyValueStoreExpirableInterface $key_value_expirable, TranslationManager $translation_manager) {
-    $this->moduleHandler = $module_handler;
-    $this->keyValueExpirable = $key_value_expirable;
-    $this->translationManager = $translation_manager;
-  }
+class ModulesUninstallConfirmForm extends ConfirmFormBase {
 
   /**
    * {@inheritdoc}
    */
   public function getQuestion() {
-    return $this->translationManager->translate('Confirm uninstall');
+    return t('Confirm uninstall');
   }
 
   /**
    * {@inheritdoc}
    */
   public function getConfirmText() {
-    return $this->translationManager->translate('Uninstall');
+    return t('Uninstall');
   }
 
   /**
@@ -109,7 +42,7 @@ public function getCancelPath() {
    * {@inheritdoc}
    */
   public function getDescription() {
-    return $this->translationManager->translate('Would you like to continue with uninstalling the above?');
+    return t('Would you like to continue with uninstalling the above?');
   }
 
   /**
@@ -121,28 +54,23 @@ public function getFormID() {
 
   /**
    * {@inheritdoc}
+   *
+   * @param array $modules
+   *   The array of modules.
    */
-  public function buildForm(array $form, array &$form_state, Request $request = NULL) {
-    // Store the request for use in the submit handler.
-    $this->request = $request;
-
-    // Retrieve the list of modules from the key value store.
-    $account = $request->attributes->get('account')->id();
-    $this->modules = $this->keyValueExpirable->get($account);
-
-    // Prevent this page from showing when the module list is empty.
-    if (empty($this->modules)) {
-      return new RedirectResponse('/admin/modules/uninstall');
+  public function buildForm(array $form, array &$form_state, $modules = array(), Request $request = NULL) {
+    $uninstall = array();
+    // Construct the hidden form elements and list items.
+    foreach ($modules as $module => $value) {
+      $info = drupal_parse_info_file(drupal_get_path('module', $module) . '/' . $module . '.info.yml');
+      $uninstall[] = $info['name'];
+      $form['uninstall'][$module] = array('#type' => 'hidden', '#value' => 1);
     }
 
-    $data = system_rebuild_module_data();
-    $form['text']['#markup'] = '<p>' . $this->translationManager->translate('The following modules will be completely uninstalled from your site, and <em>all data from these modules will be lost</em>!') . '</p>';
-    $form['modules'] = array(
-      '#theme' => 'item_list',
-      '#items' => array_map(function ($module) use ($data) {
-        return $data[$module]->info['name'];
-      }, $this->modules),
-    );
+    $form['#confirmed'] = TRUE;
+    $form['uninstall']['#tree'] = TRUE;
+    $form['text'] = array('#markup' => '<p>' . t('The following modules will be completely uninstalled from your site, and <em>all data from these modules will be lost</em>!') . '</p>');
+    $form['modules'] = array('#theme' => 'item_list', '#items' => $uninstall);
 
     return parent::buildForm($form, $form_state, $request);
   }
@@ -151,15 +79,6 @@ public function buildForm(array $form, array &$form_state, Request $request = NU
    * {@inheritdoc}
    */
   public function submitForm(array &$form, array &$form_state) {
-    // Clear the key value store entry.
-    $account = $this->request->attributes->get('account')->id();
-    $this->keyValueExpirable->delete($account);
-
-    // Uninstall the modules.
-    $this->moduleHandler->uninstall($this->modules);
-
-    drupal_set_message($this->translationManager->translate('The selected modules have been uninstalled.'));
-    $form_state['redirect'] = 'admin/modules/uninstall';
   }
 
 }
diff --git a/core/modules/system/lib/Drupal/system/Form/ModulesUninstallForm.php b/core/modules/system/lib/Drupal/system/Form/ModulesUninstallForm.php
deleted file mode 100644
index 4939663..0000000
--- a/core/modules/system/lib/Drupal/system/Form/ModulesUninstallForm.php
+++ /dev/null
@@ -1,174 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\system\Form\ModulesUninstallForm.
- */
-
-namespace Drupal\system\Form;
-
-use Drupal\Core\Form\FormInterface;
-use Drupal\Core\StringTranslation\TranslationManager;
-use Symfony\Component\DependencyInjection\ContainerInterface;
-use Drupal\Core\Controller\ControllerInterface;
-use Drupal\Core\KeyValueStore\KeyValueExpirableFactory;
-use Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface;
-use Drupal\Core\Extension\ModuleHandlerInterface;
-use Symfony\Component\HttpFoundation\Request;
-
-/**
- * Provides a form for uninstalling modules.
- */
-class ModulesUninstallForm implements FormInterface, ControllerInterface {
-
-  /**
-   * The module handler service.
-   *
-   * @var \Drupal\Core\Extension\ModuleHandlerInterface
-   */
-  protected $moduleHandler;
-
-  /**
-   * The expirable key value store.
-   *
-   * @var \Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface
-   */
-  protected $keyValueExpirable;
-
-  /**
-   * The translation manager service.
-   *
-   * @var \Drupal\Core\StringTranslation\TranslationManager
-   */
-  protected $translationManager;
-
-  /**
-   * The request object.
-   *
-   * @var \Symfony\Component\HttpFoundation\Request
-   */
-  protected $request;
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function create(ContainerInterface $container) {
-    return new static(
-      $container->get('module_handler'),
-      $container->get('keyvalue.expirable')->get('modules_uninstall'),
-      $container->get('string_translation')
-    );
-  }
-
-  /**
-   * Constructs a ModulesUninstallForm object.
-   *
-   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
-   *   The module handler.
-   * @param \Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface $key_value_expirable
-   *   The key value expirable factory.
-   * @param \Drupal\Core\StringTranslation\TranslationManager $translation_manager
-   *   The translation manager.
-   */
-  public function __construct(ModuleHandlerInterface $module_handler, KeyValueStoreExpirableInterface $key_value_expirable, TranslationManager $translation_manager) {
-    $this->moduleHandler = $module_handler;
-    $this->keyValueExpirable = $key_value_expirable;
-    $this->translationManager = $translation_manager;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getFormID() {
-    return 'system_modules_uninstall';
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function buildForm(array $form, array &$form_state, Request $request = NULL) {
-    // Store the request for use in the submit handler.
-    $this->request = $request;
-
-    // Make sure the install API is available.
-    include_once DRUPAL_ROOT . '/core/includes/install.inc';
-
-    // Get a list of disabled, installed modules.
-    $modules = system_rebuild_module_data();
-    $disabled = array_filter($modules, function ($module) {
-      return empty($module->status) && drupal_get_installed_schema_version($module->name) > SCHEMA_UNINSTALLED;
-    });
-
-    $form['modules'] = array();
-
-    // Only build the rest of the form if there are any modules available to
-    // uninstall;
-    if (empty($disabled)) {
-      return $form;
-    }
-
-    $profile = drupal_get_profile();
-
-    // Sort all modules by their name.
-    $this->moduleHandler->loadInclude('system', 'inc', 'system.admin');
-    uasort($disabled, 'system_sort_modules_by_info_name');
-
-    $form['uninstall'] = array('#tree' => TRUE);
-    foreach ($disabled as $module) {
-      $name = $module->info['name'] ?: $module->name;
-      $form['modules'][$module->name]['#module_name'] = $name;
-      $form['modules'][$module->name]['name']['#markup'] = $name;
-      $form['modules'][$module->name]['description']['#markup'] = $this->translationManager->translate($module->info['description']);
-
-      $form['uninstall'][$module->name] = array(
-        '#type' => 'checkbox',
-        '#title' => $this->translationManager->translate('Uninstall @module module', array('@module' => $name)),
-        '#title_display' => 'invisible',
-      );
-
-      // All modules which depend on this one must be uninstalled first, before
-      // we can allow this module to be uninstalled. (The installation profile
-      // is excluded from this list.)
-      foreach (array_keys($module->required_by) as $dependent) {
-        if ($dependent != $profile && drupal_get_installed_schema_version($dependent) != SCHEMA_UNINSTALLED) {
-          $name = isset($modules[$dependent]->info['name']) ? $modules[$dependent]->info['name'] : $dependent;
-          $form['modules'][$module->name]['#dependents'][] = $name;
-          $form['uninstall'][$module->name]['#disabled'] = TRUE;
-        }
-      }
-    }
-
-    $form['actions'] = array('#type' => 'actions');
-    $form['actions']['submit'] = array(
-      '#type' => 'submit',
-      '#value' => $this->translationManager->translate('Uninstall'),
-    );
-
-    return $form;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function validateForm(array &$form, array &$form_state) {
-    // Form submitted, but no modules selected.
-    if (!array_filter($form_state['values']['uninstall'])) {
-      drupal_set_message($this->translationManager->translate('No modules selected.'), 'error');
-      $form_state['redirect'] = 'admin/modules/uninstall';
-    }
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function submitForm(array &$form, array &$form_state) {
-    // Save all the values in an expirable key value store.
-    $modules = $form_state['values']['uninstall'];
-    $uninstall = array_keys(array_filter($modules));
-    $account = $this->request->attributes->get('account')->id();
-    $this->keyValueExpirable->setWithExpire($account, $uninstall, 60);
-
-    // Redirect to the confirm form.
-    $form_state['redirect'] = 'admin/modules/uninstall/confirm';
-  }
-}
diff --git a/core/modules/system/lib/Drupal/system/Plugin/Block/SystemMenuBlock.php b/core/modules/system/lib/Drupal/system/Plugin/Block/SystemMenuBlock.php
index 1daf4bf..8e7879e 100644
--- a/core/modules/system/lib/Drupal/system/Plugin/Block/SystemMenuBlock.php
+++ b/core/modules/system/lib/Drupal/system/Plugin/Block/SystemMenuBlock.php
@@ -29,7 +29,7 @@ class SystemMenuBlock extends BlockBase {
   public function access() {
     // @todo The 'Tools' menu should be available to anonymous users.
     list($plugin, $derivative) = explode(':', $this->getPluginId());
-    return ($GLOBALS['user']->isAuthenticated() || in_array($derivative, array('menu-main', 'menu-tools', 'menu-footer')));
+    return ($GLOBALS['user']->uid || in_array($derivative, array('menu-main', 'menu-tools', 'menu-footer')));
   }
 
   /**
diff --git a/core/modules/system/lib/Drupal/system/Plugin/Core/Entity/DateFormat.php b/core/modules/system/lib/Drupal/system/Plugin/Core/Entity/DateFormat.php
deleted file mode 100644
index badf567..0000000
--- a/core/modules/system/lib/Drupal/system/Plugin/Core/Entity/DateFormat.php
+++ /dev/null
@@ -1,201 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\system\Plugin\Core\Entity\DateFormat.
- */
-
-namespace Drupal\system\Plugin\Core\Entity;
-
-use Drupal\Core\Config\Entity\ConfigEntityBase;
-use Drupal\Core\Datetime\DrupalDateTime;
-use Drupal\Core\Entity\EntityStorageControllerInterface;
-use Drupal\system\DateFormatInterface;
-use Drupal\Core\Entity\Annotation\EntityType;
-use Drupal\Core\Annotation\Translation;
-
-/**
- * Defines the Date Format configuration entity class.
- *
- * @EntityType(
- *   id = "date_format",
- *   label = @Translation("Date format"),
- *   module = "system",
- *   controllers = {
- *     "storage" = "Drupal\Core\Config\Entity\ConfigStorageController",
- *     "access" = "Drupal\system\DateFormatAccessController",
- *     "list" = "Drupal\system\DateFormatListController",
- *     "form" = {
- *       "add" = "Drupal\system\Form\DateFormatAddForm",
- *       "edit" = "Drupal\system\Form\DateFormatEditForm",
- *       "delete" = "Drupal\system\Form\DateFormatDeleteForm"
- *     }
- *   },
- *   config_prefix = "system.date_format",
- *   entity_keys = {
- *     "id" = "id",
- *     "label" = "label",
- *     "uuid" = "uuid"
- *   }
- * )
- */
-class DateFormat extends ConfigEntityBase implements DateFormatInterface {
-
-  /**
-   * The date format machine name.
-   *
-   * @var string
-   */
-  public $id;
-
-  /**
-   * The date format UUID.
-   *
-   * @var string
-   */
-  public $uuid;
-
-  /**
-   * The human-readable name of the date format entity.
-   *
-   * @var string
-   */
-  public $label;
-
-  /**
-   * The date format pattern.
-   *
-   * @var array
-   */
-  protected $pattern;
-
-  /**
-   * The locked status of this date format.
-   *
-   * @var bool
-   */
-  protected $locked = FALSE;
-
-  /**
-   * @var array
-   */
-  protected $locales = array();
-
-  /**
-   * {@inheritdoc}
-   */
-  public function uri() {
-    return array(
-      'path' => 'admin/config/regional/date-time/formats/manage/' . $this->id(),
-      'options' => array(
-        'entity_type' => $this->entityType,
-        'entity' => $this,
-      ),
-    );
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getExportProperties() {
-    $properties = parent::getExportProperties();
-    $names = array(
-      'locked',
-      'locales',
-      'pattern',
-    );
-    foreach ($names as $name) {
-      $properties[$name] = $this->get($name);
-    }
-    return $properties;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getPattern($type = DrupalDateTime::PHP) {
-    return isset($this->pattern[$type]) ? $this->pattern[$type] : '';
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function setPattern($pattern, $type = DrupalDateTime::PHP) {
-    $this->pattern[$type] = $pattern;
-    return $this;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getLocales() {
-    return $this->locales;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function setLocales(array $locales) {
-    $this->locales = $locales;
-    return $this;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function hasLocales() {
-    return !empty($this->locales);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function addLocale($locale) {
-    $this->locales[] = $locale;
-    $this->locales = array_unique($this->locales);
-    return $this;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function isLocked() {
-    return (bool) $this->locked;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function preSave(EntityStorageControllerInterface $storage_controller) {
-    if ($this->hasLocales()) {
-      $config_factory = \Drupal::service('config.factory');
-      $properties = $this->getExportProperties();
-      $languages = language_list();
-      // Check if the suggested language codes are configured.
-      foreach ($this->getLocales() as $langcode) {
-        if (isset($languages[$langcode])) {
-          $config_factory->get('locale.config.' . $langcode . '.system.date_format.' . $this->id())
-            ->setData($properties)
-            ->save();
-        }
-      }
-    }
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function postDelete(EntityStorageControllerInterface $storage_controller, array $entities) {
-    // Clean up the localized entry if required.
-    if (\Drupal::moduleHandler()->moduleExists('language')) {
-      $languages = language_list();
-      foreach ($entities as $entity) {
-        $format_id = $entity->id();
-        foreach ($languages as $langcode => $data) {
-          config("locale.config.$langcode.system.date_format.$format_id")->delete();
-        }
-      }
-    }
-  }
-
-}
diff --git a/core/modules/system/lib/Drupal/system/Plugin/PluginUIBase.php b/core/modules/system/lib/Drupal/system/Plugin/PluginUIBase.php
index 077ee5b..d55ba0f 100644
--- a/core/modules/system/lib/Drupal/system/Plugin/PluginUIBase.php
+++ b/core/modules/system/lib/Drupal/system/Plugin/PluginUIBase.php
@@ -27,7 +27,7 @@ public function form($form, &$form_state) {
       $manager = new $plugin_definition['manager']();
     }
     else {
-      $manager = drupal_container()->get($plugin_definition['manager']);
+      $manager = \Drupal::service($plugin_definition['manager']);
     }
     $plugins = $manager->getDefinitions();
 
diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/CascadingStylesheetsTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/CascadingStylesheetsTest.php
index 54abcba..d7fbdbf 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Common/CascadingStylesheetsTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Common/CascadingStylesheetsTest.php
@@ -79,7 +79,7 @@ function testRenderFile() {
     $this->assertTrue(strpos($styles, $css) > 0, 'Rendered CSS includes the added stylesheet.');
     // Verify that newlines are properly added inside style tags.
     $query_string = variable_get('css_js_query_string', '0');
-    $css_processed = '<link rel="stylesheet" href="' . check_plain(file_create_url($css)) . "?" . $query_string . '" media="all" />';
+    $css_processed = "<style media=\"all\">\n@import url(\"" . check_plain(file_create_url($css)) . "?" . $query_string ."\");\n</style>";
     $this->assertEqual(trim($styles), $css_processed, 'Rendered CSS includes newlines inside style tags for JavaScript use.');
   }
 
@@ -99,12 +99,8 @@ function testRenderExternal() {
    * Tests rendering inline stylesheets with preprocessing on.
    */
   function testRenderInlinePreprocess() {
-    // Turn on CSS aggregation to allow for preprocessing.
-    $config = $this->container->get('config.factory')->get('system.performance');
-    $config->set('css.preprocess', 1);
-
     $css = 'body { padding: 0px; }';
-    $css_preprocessed = '<style media="all">' . "\n/* <![CDATA[ */\n" . "body{padding:0px;}\n" . "\n/* ]]> */\n" . '</style>';
+    $css_preprocessed = '<style media="all">' . "\n/* <![CDATA[ */\n" . drupal_load_stylesheet_content($css, TRUE) . "\n/* ]]> */\n" . '</style>';
     drupal_add_css($css, array('type' => 'inline'));
     $styles = drupal_get_css();
     $this->assertEqual(trim($styles), $css_preprocessed, 'Rendering preprocessed inline CSS adds it to the page.');
diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/CascadingStylesheetsUnitTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/CascadingStylesheetsUnitTest.php
new file mode 100644
index 0000000..5ab3c0a
--- /dev/null
+++ b/core/modules/system/lib/Drupal/system/Tests/Common/CascadingStylesheetsUnitTest.php
@@ -0,0 +1,63 @@
+<?php
+
+/**
+ * @file
+ * Definition of Drupal\system\Tests\Common\CascadingStylesheetsUnitTest.
+ */
+
+namespace Drupal\system\Tests\Common;
+
+use Drupal\simpletest\UnitTestBase;
+
+/**
+ * Tests CSS functions.
+ */
+class CascadingStylesheetsUnitTest extends UnitTestBase {
+  public static function getInfo() {
+    return array(
+      'name' => 'CSS Unit Tests',
+      'description' => 'Unit tests on CSS functions like aggregation.',
+      'group' => 'Common',
+    );
+  }
+
+  /**
+   * Tests CSS loading via drupal_load_stylesheet().
+   *
+   * This test loads CSS files with and without CSS optimization.
+   * Known tests:
+   * - Retain white-space in selectors. (http://drupal.org/node/472820)
+   * - Proper URLs in imported files. (http://drupal.org/node/265719)
+   * - Retain pseudo-selectors. (http://drupal.org/node/460448)
+   */
+  function testLoadCssBasic() {
+    // Array of files to test living in 'simpletest/files/css_test_files/'.
+    // - Original: name.css
+    // - Unoptimized expected content: name.css.unoptimized.css
+    // - Optimized expected content: name.css.optimized.css
+    $testfiles = array(
+      'css_input_without_import.css',
+      'css_input_with_import.css',
+      'comment_hacks.css'
+    );
+    $path = drupal_get_path('module', 'simpletest') . '/files/css_test_files';
+    foreach ($testfiles as $file) {
+      $expected = file_get_contents("$path/$file.unoptimized.css");
+      $unoptimized_output = drupal_load_stylesheet("$path/$file.unoptimized.css", FALSE);
+      $this->assertEqual($unoptimized_output, $expected, format_string('Unoptimized CSS file has expected contents (@file)', array('@file' => $file)));
+
+      $expected = file_get_contents("$path/$file.optimized.css");
+      $optimized_output = drupal_load_stylesheet("$path/$file", TRUE);
+      $this->assertEqual($optimized_output, $expected, format_string('Optimized CSS file has expected contents (@file)', array('@file' => $file)));
+
+      // Repeat the tests by accessing the stylesheets by URL.
+      $expected = file_get_contents("$path/$file.unoptimized.css");
+      $unoptimized_output_url = drupal_load_stylesheet($GLOBALS['base_url'] . "/$path/$file.unoptimized.css", FALSE);
+      $this->assertEqual($unoptimized_output, $expected, format_string('Unoptimized CSS file (loaded from an URL) has expected contents (@file)', array('@file' => $file)));
+
+      $expected = file_get_contents("$path/$file.optimized.css");
+      $optimized_output = drupal_load_stylesheet($GLOBALS['base_url'] . "/$path/$file", TRUE);
+      $this->assertEqual($optimized_output, $expected, format_string('Optimized CSS file (loaded from an URL) has expected contents (@file)', array('@file' => $file)));
+    }
+  }
+}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/FormatDateTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/FormatDateTest.php
index b46f751..af933e4 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Common/FormatDateTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Common/FormatDateTest.php
@@ -40,12 +40,11 @@ function setUp() {
     config('system.timezone')
       ->set('user.configurable', 1)
       ->save();
-    $formats = $this->container->get('plugin.manager.entity')
-      ->getStorageController('date_format')
-      ->loadMultiple(array('long', 'medium', 'short'));
-    $formats['long']->setPattern('l, j. F Y - G:i')->save();
-    $formats['medium']->setPattern('j. F Y - G:i')->save();
-    $formats['short']->setPattern('Y M j - g:ia')->save();
+    config('system.date')
+      ->set('formats.long.pattern.php', 'l, j. F Y - G:i')
+      ->set('formats.medium.pattern.php', 'j. F Y - G:i')
+      ->set('formats.short.pattern.php', 'Y M j - g:ia')
+      ->save();
 
     variable_set('locale_custom_strings_' . self::LANGCODE, array(
       '' => array('Sunday' => 'domingo'),
@@ -65,25 +64,25 @@ function testAdminDefinedFormatDate() {
 
     // Add new date format.
     $edit = array(
-      'id' => 'example_style',
-      'label' => 'Example Style',
+      'date_format_id' => 'example_style',
+      'date_format_name' => 'Example Style',
       'date_format_pattern' => 'j M y',
     );
     $this->drupalPost('admin/config/regional/date-time/formats/add', $edit, t('Add format'));
 
     // Add a second date format with a different case than the first.
     $edit = array(
-      'id' => 'example_style_uppercase',
-      'label' => 'Example Style Uppercase',
+      'date_format_id' => 'example_style_uppercase',
+      'date_format_name' => 'Example Style Uppercase',
       'date_format_pattern' => 'j M Y',
     );
     $this->drupalPost('admin/config/regional/date-time/formats/add', $edit, t('Add format'));
-    $this->assertText(t('Custom date format added.'));
+    $this->assertText(t('Custom date format updated.'));
 
     $timestamp = strtotime('2007-03-10T00:00:00+00:00');
     $this->assertIdentical(format_date($timestamp, 'example_style', '', 'America/Los_Angeles'), '9 Mar 07', 'Test format_date() using an admin-defined date type.');
     $this->assertIdentical(format_date($timestamp, 'example_style_uppercase', '', 'America/Los_Angeles'), '9 Mar 2007', 'Test format_date() using an admin-defined date type with different case.');
-    $this->assertIdentical(format_date($timestamp, 'undefined_style'), format_date($timestamp, 'fallback'), 'Test format_date() defaulting to `fallback` when $type not found.');
+    $this->assertIdentical(format_date($timestamp, 'undefined_style'), format_date($timestamp, 'medium'), 'Test format_date() defaulting to medium when $type not found.');
   }
 
   /**
@@ -121,13 +120,13 @@ function testFormatDate() {
     $test_user = $this->drupalCreateUser();
     $this->drupalLogin($test_user);
     $edit = array('preferred_langcode' => self::LANGCODE, 'mail' => $test_user->mail, 'timezone' => 'America/Los_Angeles');
-    $this->drupalPost('user/' . $test_user->id() . '/edit', $edit, t('Save'));
+    $this->drupalPost('user/' . $test_user->uid . '/edit', $edit, t('Save'));
 
     // Disable session saving as we are about to modify the global $user.
     drupal_save_session(FALSE);
     // Save the original user and language and then replace it with the test user and language.
     $real_user = $user;
-    $user = user_load($test_user->id(), TRUE);
+    $user = user_load($test_user->uid, TRUE);
     $real_language = $language_interface->id;
     $language_interface->id = $user->preferred_langcode;
     // Simulate a Drupal bootstrap with the logged-in user.
diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/JavaScriptTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/JavaScriptTest.php
index 783eab2..e69dc20 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Common/JavaScriptTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Common/JavaScriptTest.php
@@ -7,20 +7,19 @@
 
 namespace Drupal\system\Tests\Common;
 
-use Drupal\simpletest\DrupalUnitTestBase;
-use Drupal\Component\Utility\Crypt;
+use Drupal\simpletest\WebTestBase;
 
 /**
  * Tests the JavaScript system.
  */
-class JavaScriptTest extends DrupalUnitTestBase {
+class JavaScriptTest extends WebTestBase {
 
   /**
    * Enable Language and SimpleTest in the test environment.
    *
    * @var array
    */
-  public static $modules = array('language', 'simpletest', 'common_test', 'system');
+  public static $modules = array('language', 'simpletest', 'common_test', 'path');
 
   /**
    * Stores configured value for JavaScript preprocessing.
@@ -80,7 +79,7 @@ function testAddSetting() {
     drupal_add_library('system', 'drupalSettings');
     $javascript = drupal_add_js();
     $last_settings = reset($javascript['settings']['data']);
-    $this->assertTrue(array_key_exists('currentPath', $last_settings), 'The current path JavaScript setting is set correctly.');
+    $this->assertTrue($last_settings['currentPath'], 'The current path JavaScript setting is set correctly.');
 
     $javascript = drupal_add_js(array('drupal' => 'rocks', 'dries' => 280342800), 'setting');
     $last_settings = end($javascript['settings']['data']);
@@ -196,6 +195,14 @@ function testHeaderSetting() {
     $settings_two['moduleName']['thingiesOnPage']['id1'] = array();
     $this->assertIdentical($settings_one, $parsed_settings['commonTestRealWorldIdentical'], 'drupal_add_js handled real world test case 1 correctly.');
     $this->assertEqual($settings_two, $parsed_settings['commonTestRealWorldAlmostIdentical'], 'drupal_add_js handled real world test case 2 correctly.');
+
+    // Check in a rendered page.
+    $this->drupalGet('common-test/query-string');
+    $this->assertPattern('@<script>.+drupalSettings.+"currentPath":"common-test\\\/query-string"@s', 'currentPath is in the JS settings');
+    $path = array('source' => 'common-test/query-string', 'alias' => 'common-test/currentpath-check');
+    \Drupal::service('path.crud')->save($path['source'], $path['alias']);
+    $this->drupalGet('common-test/currentpath-check');
+    $this->assertPattern('@<script>.+drupalSettings.+"currentPath":"common-test\\\/query-string"@s', 'currentPath is in the JS settings for an aliased path');
   }
 
   /**
@@ -338,8 +345,8 @@ function testAggregation() {
     $js_items = drupal_add_js();
     $javascript = drupal_get_js();
     $expected = implode("\n", array(
-      '<script src="' . $this->calculateAggregateFilename(array('core/misc/collapse.js' => $js_items['core/misc/collapse.js'], 'core/misc/batch.js' => $js_items['core/misc/batch.js'])) . '"></script>',
-      '<script src="' . $this->calculateAggregateFilename(array('core/misc/ajax.js' => $js_items['core/misc/ajax.js'], 'core/misc/autocomplete.js' => $js_items['core/misc/autocomplete.js'])) . '"></script>',
+      '<script src="' . file_create_url(drupal_build_js_cache(array('core/misc/collapse.js' => $js_items['core/misc/collapse.js'], 'core/misc/batch.js' => $js_items['core/misc/batch.js']))) . '"></script>',
+      '<script src="' . file_create_url(drupal_build_js_cache(array('core/misc/ajax.js' => $js_items['core/misc/ajax.js'], 'core/misc/autocomplete.js' => $js_items['core/misc/autocomplete.js']))) . '"></script>',
     ));
     $this->assertTrue(strpos($javascript, $expected) !== FALSE, 'JavaScript is aggregated in the expected groups and order.');
   }
@@ -358,14 +365,10 @@ function testAggregationOrder() {
     drupal_add_js('core/misc/autocomplete.js');
 
     $js_items = drupal_add_js();
-    $scripts_html = array(
-      '#type' => 'scripts',
-      '#items' => array(
-        'core/misc/ajax.js' => $js_items['core/misc/ajax.js'],
-        'core/misc/autocomplete.js' => $js_items['core/misc/autocomplete.js']
-      )
-    );
-    drupal_render($scripts_html);
+    drupal_build_js_cache(array(
+      'core/misc/ajax.js' => $js_items['core/misc/ajax.js'],
+      'core/misc/autocomplete.js' => $js_items['core/misc/autocomplete.js']
+    ));
 
     // Store the expected key for the first item in the cache.
     $cache = array_keys(\Drupal::state()->get('system.js_cache_files') ?: array());
@@ -381,14 +384,10 @@ function testAggregationOrder() {
 
     // Rebuild the cache.
     $js_items = drupal_add_js();
-    $scripts_html = array(
-      '#type' => 'scripts',
-      '#items' => array(
-        'core/misc/ajax.js' => $js_items['core/misc/ajax.js'],
-        'core/misc/autocomplete.js' => $js_items['core/misc/autocomplete.js']
-      )
-    );
-    drupal_render($scripts_html);
+    drupal_build_js_cache(array(
+      'core/misc/ajax.js' => $js_items['core/misc/ajax.js'],
+      'core/misc/autocomplete.js' => $js_items['core/misc/autocomplete.js']
+    ));
 
     // Compare the expected key for the first file to the current one.
     $cache = array_keys(\Drupal::state()->get('system.js_cache_files') ?: array());
@@ -544,7 +543,7 @@ function testGetLibrary() {
     $this->assertTrue(isset($libraries['jquery.farbtastic']), 'Retrieved all module libraries.');
     // Retrieve all libraries for a module not implementing hook_library_info().
     // Note: This test installs language module.
-    $libraries = drupal_get_library('dblog');
+    $libraries = drupal_get_library('language');
     $this->assertEqual($libraries, array(), 'Retrieving libraries from a module not implementing hook_library_info() returns an emtpy array.');
 
     // Retrieve a specific library by module and name.
@@ -559,31 +558,8 @@ function testGetLibrary() {
    * Tests JavaScript files that have querystrings attached get added right.
    */
   function testAddJsFileWithQueryString() {
-    $js = drupal_get_path('module', 'node') . '/node.js';
-    drupal_add_js($js);
-
+    $this->drupalGet('common-test/query-string');
     $query_string = variable_get('css_js_query_string', '0');
-    $scripts = drupal_get_js();
-    $this->assertTrue(strpos($scripts, $js . '?' . $query_string), 'Query string was appended correctly to JS.');
+    $this->assertRaw(drupal_get_path('module', 'node') . '/node.js?' . $query_string, 'Query string was appended correctly to js.');
   }
-
-  /**
-   * Calculates the aggregated file URI of a group of JavaScript assets.
-   *
-   * @param array $js_assets
-   *   A group of JavaScript assets.
-   * @return string
-   *   A file URI.
-   *
-   * @see testAggregation()
-   * @see testAggregationOrder()
-   */
-  protected function calculateAggregateFilename($js_assets) {
-    $data = '';
-    foreach ($js_assets as $js_asset) {
-      $data .= file_get_contents($js_asset['data']) . ";\n";
-    }
-    return file_create_url('public://js/js_' . Crypt::hashBase64($data) . '.js');
-  }
-
 }
diff --git a/core/modules/system/lib/Drupal/system/Tests/Database/UpdateTest.php b/core/modules/system/lib/Drupal/system/Tests/Database/UpdateTest.php
index ba64792..fb96768 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Database/UpdateTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Database/UpdateTest.php
@@ -118,7 +118,7 @@ function testExpressionUpdate() {
     $this->assertIdentical($num_rows, 4, 'Updated 4 records.');
 
     $saved_name = db_query('SELECT name FROM {test} WHERE age = :age', array(':age' => pow(26, 2)))->fetchField();
-    $this->assertIdentical($saved_name, 'Paul', 'Successfully updated values using an algebraic expression.');
+    $this->assertIdentical($saved_name, 'Paul', t('Successfully updated values using an algebraic expression.'));
   }
 
   /**
@@ -146,9 +146,9 @@ function testPrimaryKeyUpdate() {
       ->fields(array('id' => 42, 'name' => 'John'))
       ->condition('id', 1)
       ->execute();
-    $this->assertIdentical($num_updated, 1, 'Updated 1 record.');
+    $this->assertIdentical($num_updated, 1, t('Updated 1 record.'));
 
     $saved_name= db_query('SELECT name FROM {test} WHERE id = :id', array(':id' => 42))->fetchField();
-    $this->assertIdentical($saved_name, 'John', 'Updated primary key successfully.');
+    $this->assertIdentical($saved_name, 'John', t('Updated primary key successfully.'));
   }
 }
diff --git a/core/modules/system/lib/Drupal/system/Tests/Datetime/DateTimePlusIntlTest.php b/core/modules/system/lib/Drupal/system/Tests/Datetime/DateTimePlusIntlTest.php
index 89466d4..5fe2b82 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Datetime/DateTimePlusIntlTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Datetime/DateTimePlusIntlTest.php
@@ -8,7 +8,6 @@
 namespace Drupal\system\Tests\Datetime;
 
 use Drupal\Component\Datetime\DateTimePlus;
-use Drupal\Core\Datetime\DrupalDateTime;
 use Drupal\simpletest\DrupalUnitTestBase;
 
 /**
@@ -76,13 +75,11 @@ function testDateTimestampIntl() {
     $this->assertTrue($intl_date->canUseIntl(), 'DateTimePlus object can use intl when provided with country and langcode settings.');
     $this->assertFalse($php_date->canUseIntl(), 'DateTimePlus object will fallback to use PHP when not provided with country setting.');
 
-    $default_formats = $this->container->get('plugin.manager.entity')
-      ->getStorageController('date_format')
-      ->loadMultiple();
+    $default_formats = config('system.date')->get('formats');
 
     foreach ($default_formats as $format) {
-      $php_format = $php_date->format($format->getPattern(DrupalDateTime::PHP), $php_settings);
-      $intl_format = $intl_date->format($format->getPattern(DrupalDateTime::INTL), $intl_settings);
+      $php_format = $php_date->format($format['pattern']['php'], $php_settings);
+      $intl_format = $intl_date->format($format['pattern']['intl'], $intl_settings);
       $this->assertIdentical($intl_format, $php_format);
     }
   }
diff --git a/core/modules/system/lib/Drupal/system/Tests/Datetime/DateTimePlusTest.php b/core/modules/system/lib/Drupal/system/Tests/Datetime/DateTimePlusTest.php
new file mode 100644
index 0000000..9eb0162
--- /dev/null
+++ b/core/modules/system/lib/Drupal/system/Tests/Datetime/DateTimePlusTest.php
@@ -0,0 +1,418 @@
+<?php
+
+/**
+ * @file
+ * Definition of Drupal\system\Tests\Datetime\DateTimePlusTest.
+ */
+
+namespace Drupal\system\Tests\Datetime;
+
+use Drupal\simpletest\UnitTestBase;
+use Drupal\Component\Datetime\DateTimePlus;
+use DateTimeZone;
+
+class DateTimePlusTest extends UnitTestBase {
+
+  /**
+   * Test information.
+   */
+  public static function getInfo() {
+    return array(
+      'name' => 'DateTimePlus',
+      'description' => 'Test DateTimePlus functionality.',
+      'group' => 'Datetime',
+    );
+  }
+
+  /**
+   * Set up required modules.
+   */
+  public static $modules = array();
+
+  /**
+   * Test creating dates from string input.
+   */
+  public function testDateStrings() {
+
+    // Create date object from datetime string.
+    $input = '2009-03-07 10:30';
+    $timezone = 'America/Chicago';
+    $date = new DateTimePlus($input, $timezone);
+    $value = $date->format('c');
+    $expected = '2009-03-07T10:30:00-06:00';
+    $this->assertEqual($expected, $value, "Test new DateTimePlus($input, $timezone): should be $expected, found $value.");
+
+    // Same during daylight savings time.
+    $input = '2009-06-07 10:30';
+    $timezone = 'America/Chicago';
+    $date = new DateTimePlus($input, $timezone);
+    $value = $date->format('c');
+    $expected = '2009-06-07T10:30:00-05:00';
+    $this->assertEqual($expected, $value, "Test new DateTimePlus($input, $timezone): should be $expected, found $value.");
+
+    // Create date object from date string.
+    $input = '2009-03-07';
+    $timezone = 'America/Chicago';
+    $date = new DateTimePlus($input, $timezone);
+    $value = $date->format('c');
+    $expected = '2009-03-07T00:00:00-06:00';
+    $this->assertEqual($expected, $value, "Test new DateTimePlus($input, $timezone): should be $expected, found $value.");
+
+    // Same during daylight savings time.
+    $input = '2009-06-07';
+    $timezone = 'America/Chicago';
+    $date = new DateTimePlus($input, $timezone);
+    $value = $date->format('c');
+    $expected = '2009-06-07T00:00:00-05:00';
+    $this->assertEqual($expected, $value, "Test new DateTimePlus($input, $timezone): should be $expected, found $value.");
+
+    // Create date object from date string.
+    $input = '2009-03-07 10:30';
+    $timezone = 'Australia/Canberra';
+    $date = new DateTimePlus($input, $timezone);
+    $value = $date->format('c');
+    $expected = '2009-03-07T10:30:00+11:00';
+    $this->assertEqual($expected, $value, "Test new DateTimePlus($input, $timezone): should be $expected, found $value.");
+
+    // Same during daylight savings time.
+    $input = '2009-06-07 10:30';
+    $timezone = 'Australia/Canberra';
+    $date = new DateTimePlus($input, $timezone);
+    $value = $date->format('c');
+    $expected = '2009-06-07T10:30:00+10:00';
+    $this->assertEqual($expected, $value, "Test new DateTimePlus($input, $timezone): should be $expected, found $value.");
+
+  }
+
+  /**
+   * Test creating dates from arrays of date parts.
+   */
+  function testDateArrays() {
+
+    // Create date object from date array, date only.
+    $input = array('year' => 2010, 'month' => 2, 'day' => 28);
+    $timezone = 'America/Chicago';
+    $date = new DateTimePlus($input, $timezone);
+    $value = $date->format('c');
+    $expected = '2010-02-28T00:00:00-06:00';
+    $this->assertEqual($expected, $value, "Test new DateTimePlus(array('year' => 2010, 'month' => 2, 'day' => 28), $timezone): should be $expected, found $value.");
+
+    // Create date object from date array with hour.
+    $input = array('year' => 2010, 'month' => 2, 'day' => 28, 'hour' => 10);
+    $timezone = 'America/Chicago';
+    $date = new DateTimePlus($input, $timezone);
+    $value = $date->format('c');
+    $expected = '2010-02-28T10:00:00-06:00';
+    $this->assertEqual($expected, $value, "Test new DateTimePlus(array('year' => 2010, 'month' => 2, 'day' => 28, 'hour' => 10), $timezone): should be $expected, found $value.");
+
+    // Create date object from date array, date only.
+    $input = array('year' => 2010, 'month' => 2, 'day' => 28);
+    $timezone = 'Europe/Berlin';
+    $date = new DateTimePlus($input, $timezone);
+    $value = $date->format('c');
+    $expected = '2010-02-28T00:00:00+01:00';
+    $this->assertEqual($expected, $value, "Test new DateTimePlus(array('year' => 2010, 'month' => 2, 'day' => 28), $timezone): should be $expected, found $value.");
+
+    // Create date object from date array with hour.
+    $input = array('year' => 2010, 'month' => 2, 'day' => 28, 'hour' => 10);
+    $timezone = 'Europe/Berlin';
+    $date = new DateTimePlus($input, $timezone);
+    $value = $date->format('c');
+    $expected = '2010-02-28T10:00:00+01:00';
+    $this->assertEqual($expected, $value, "Test new DateTimePlus(array('year' => 2010, 'month' => 2, 'day' => 28, 'hour' => 10), $timezone): should be $expected, found $value.");
+
+  }
+
+  /**
+   * Test creating dates from timestamps.
+   */
+  function testDateTimestamp() {
+
+    // Create date object from a unix timestamp and display it in
+    // local time.
+    $input = 0;
+    $timezone = 'UTC';
+    $date = new DateTimePlus($input, $timezone);
+    $value = $date->format('c');
+    $expected = '1970-01-01T00:00:00+00:00';
+    $this->assertEqual($expected, $value, "Test new DateTimePlus($input, $timezone): should be $expected, found $value.");
+
+    $expected = 'UTC';
+    $value = $date->getTimeZone()->getName();
+    $this->assertEqual($expected, $value, "The current timezone is $value: should be $expected.");
+    $expected = 0;
+    $value = $date->getOffset();
+    $this->assertEqual($expected, $value, "The current offset is $value: should be $expected.");
+
+    $timezone = 'America/Los_Angeles';
+    $date->setTimezone(new DateTimeZone($timezone));
+    $value = $date->format('c');
+    $expected = '1969-12-31T16:00:00-08:00';
+    $this->assertEqual($expected, $value, "Test \$date->setTimezone(new DateTimeZone($timezone)): should be $expected, found $value.");
+
+    $expected = 'America/Los_Angeles';
+    $value = $date->getTimeZone()->getName();
+    $this->assertEqual($expected, $value, "The current timezone should be $expected, found $value.");
+    $expected = '-28800';
+    $value = $date->getOffset();
+    $this->assertEqual($expected, $value, "The current offset should be $expected, found $value.");
+
+    // Create a date using the timestamp of zero, then display its
+    // value both in UTC and the local timezone.
+    $input = 0;
+    $timezone = 'America/Los_Angeles';
+    $date = new DateTimePlus($input, $timezone);
+    $offset = $date->getOffset();
+    $value = $date->format('c');
+    $expected = '1969-12-31T16:00:00-08:00';
+    $this->assertEqual($expected, $value, "Test new DateTimePlus($input, $timezone):  should be $expected, found $value.");
+
+    $expected = 'America/Los_Angeles';
+    $value = $date->getTimeZone()->getName();
+    $this->assertEqual($expected, $value, "The current timezone should be $expected, found $value.");
+    $expected = '-28800';
+    $value = $date->getOffset();
+    $this->assertEqual($expected, $value, "The current offset should be $expected, found $value.");
+
+    $timezone = 'UTC';
+    $date->setTimezone(new DateTimeZone($timezone));
+    $value = $date->format('c');
+    $expected = '1970-01-01T00:00:00+00:00';
+    $this->assertEqual($expected, $value, "Test \$date->setTimezone(new DateTimeZone($timezone)): should be $expected, found $value.");
+
+    $expected = 'UTC';
+    $value = $date->getTimeZone()->getName();
+    $this->assertEqual($expected, $value, "The current timezone should be $expected, found $value.");
+    $expected = '0';
+    $value = $date->getOffset();
+    $this->assertEqual($expected, $value, "The current offset should be $expected, found $value.");
+  }
+
+  /**
+   * Test timezone manipulation.
+   */
+  function testTimezoneConversion() {
+
+    // Create date object from datetime string in UTC, and convert
+    // it to a local date.
+    $input = '1970-01-01 00:00:00';
+    $timezone = 'UTC';
+    $date = new DateTimePlus($input, $timezone);
+    $value = $date->format('c');
+    $expected = '1970-01-01T00:00:00+00:00';
+    $this->assertEqual($expected, $value, "Test new DateTimePlus('$input', '$timezone'): should be $expected, found $value.");
+
+    $expected = 'UTC';
+    $value = $date->getTimeZone()->getName();
+    $this->assertEqual($expected, $value, "The current timezone is $value: should be $expected.");
+    $expected = 0;
+    $value = $date->getOffset();
+    $this->assertEqual($expected, $value, "The current offset is $value: should be $expected.");
+
+    $timezone = 'America/Los_Angeles';
+    $date->setTimezone(new DateTimeZone($timezone));
+    $value = $date->format('c');
+    $expected = '1969-12-31T16:00:00-08:00';
+    $this->assertEqual($expected, $value, "Test \$date->setTimezone(new DateTimeZone($timezone)): should be $expected, found $value.");
+
+    $expected = 'America/Los_Angeles';
+    $value = $date->getTimeZone()->getName();
+    $this->assertEqual($expected, $value, "The current timezone should be $expected, found $value.");
+    $expected = '-28800';
+    $value = $date->getOffset();
+    $this->assertEqual($expected, $value, "The current offset should be $expected, found $value.");
+
+    // Convert the local time to UTC using string input.
+    $input = '1969-12-31 16:00:00';
+    $timezone = 'America/Los_Angeles';
+    $date = new DateTimePlus($input, $timezone);
+    $offset = $date->getOffset();
+    $value = $date->format('c');
+    $expected = '1969-12-31T16:00:00-08:00';
+    $this->assertEqual($expected, $value, "Test new DateTimePlus('$input', '$timezone'):  should be $expected, found $value.");
+
+    $expected = 'America/Los_Angeles';
+    $value = $date->getTimeZone()->getName();
+    $this->assertEqual($expected, $value, "The current timezone should be $expected, found $value.");
+    $expected = '-28800';
+    $value = $date->getOffset();
+    $this->assertEqual($expected, $value, "The current offset should be $expected, found $value.");
+
+    $timezone = 'UTC';
+    $date->setTimezone(new DateTimeZone($timezone));
+    $value = $date->format('c');
+    $expected = '1970-01-01T00:00:00+00:00';
+    $this->assertEqual($expected, $value, "Test \$date->setTimezone(new DateTimeZone($timezone)): should be $expected, found $value.");
+
+    $expected = 'UTC';
+    $value = $date->getTimeZone()->getName();
+    $this->assertEqual($expected, $value, "The current timezone should be $expected, found $value.");
+    $expected = '0';
+    $value = $date->getOffset();
+    $this->assertEqual($expected, $value, "The current offset should be $expected, found $value.");
+
+    // Convert the local time to UTC using string input.
+    $input = '1969-12-31 16:00:00';
+    $timezone = 'Europe/Warsaw';
+    $date = new DateTimePlus($input, $timezone);
+    $offset = $date->getOffset();
+    $value = $date->format('c');
+    $expected = '1969-12-31T16:00:00+01:00';
+    $this->assertEqual($expected, $value, "Test new DateTimePlus('$input', '$timezone'):  should be $expected, found $value.");
+
+    $expected = 'Europe/Warsaw';
+    $value = $date->getTimeZone()->getName();
+    $this->assertEqual($expected, $value, "The current timezone should be $expected, found $value.");
+    $expected = '+3600';
+    $value = $date->getOffset();
+    $this->assertEqual($expected, $value, "The current offset should be $expected, found $value.");
+
+  }
+
+  /**
+   * Test creating dates from format strings.
+   */
+  function testDateFormat() {
+
+     // Create a year-only date.
+    $input = '2009';
+    $timezone = NULL;
+    $format = 'Y';
+    $date = new DateTimePlus($input, $timezone, $format);
+    $value = $date->format('Y');
+    $expected = '2009';
+    $this->assertEqual($expected, $value, "Test new DateTimePlus($input, $timezone, $format): should be $expected, found $value.");
+
+     // Create a month and year-only date.
+    $input = '2009-10';
+    $timezone = NULL;
+    $format = 'Y-m';
+    $date = new DateTimePlus($input, $timezone, $format);
+    $value = $date->format('Y-m');
+    $expected = '2009-10';
+    $this->assertEqual($expected, $value, "Test new DateTimePlus($input, $timezone, $format): should be $expected, found $value.");
+
+     // Create a time-only date.
+    $input = 'T10:30:00';
+    $timezone = NULL;
+    $format = '\TH:i:s';
+    $date = new DateTimePlus($input, $timezone, $format);
+    $value = $date->format('H:i:s');
+    $expected = '10:30:00';
+    $this->assertEqual($expected, $value, "Test new DateTimePlus($input, $timezone, $format): should be $expected, found $value.");
+
+     // Create a time-only date.
+    $input = '10:30:00';
+    $timezone = NULL;
+    $format = 'H:i:s';
+    $date = new DateTimePlus($input, $timezone, $format);
+    $value = $date->format('H:i:s');
+    $expected = '10:30:00';
+    $this->assertEqual($expected, $value, "Test new DateTimePlus($input, $timezone, $format): should be $expected, found $value.");
+
+  }
+
+  /**
+   * Test invalid date handling.
+   */
+  function testInvalidDates() {
+
+    // Test for invalid month names when we are using a short version
+    // of the month.
+    $input = '23 abc 2012';
+    $timezone = NULL;
+    $format = 'd M Y';
+    $date = new DateTimePlus($input, $timezone, $format);
+    $this->assertNotEqual(count($date->getErrors()), 0, "$input contains an invalid month name and produces errors.");
+
+     // Test for invalid hour.
+    $input = '0000-00-00T45:30:00';
+    $timezone = NULL;
+    $format = 'Y-m-d\TH:i:s';
+    $date = new DateTimePlus($input, $timezone, $format);
+    $this->assertNotEqual(count($date->getErrors()), 0, "$input contains an invalid hour and produces errors.");
+
+     // Test for invalid day.
+    $input = '0000-00-99T05:30:00';
+    $timezone = NULL;
+    $format = 'Y-m-d\TH:i:s';
+    $date = new DateTimePlus($input, $timezone, $format);
+    $this->assertNotEqual(count($date->getErrors()), 0, "$input contains an invalid day and produces errors.");
+
+     // Test for invalid month.
+    $input = '0000-75-00T15:30:00';
+    $timezone = NULL;
+    $format = 'Y-m-d\TH:i:s';
+    $date = new DateTimePlus($input, $timezone, $format);
+    $this->assertNotEqual(count($date->getErrors()), 0, "$input contains an invalid month and produces errors.");
+
+     // Test for invalid year.
+    $input = '11-08-01T15:30:00';
+    $timezone = NULL;
+    $format = 'Y-m-d\TH:i:s';
+    $date = new DateTimePlus($input, $timezone, $format);
+    $this->assertNotEqual(count($date->getErrors()), 0, "$input contains an invalid year and produces errors.");
+
+    // Test for invalid year from date array. 10000 as a year will
+    // create an exception error in the PHP DateTime object.
+    $input = array('year' => 10000, 'month' => 7, 'day' => 8, 'hour' => 8, 'minute' => 0, 'second' => 0);
+    $timezone = 'America/Chicago';
+    $date = new DateTimePlus($input, $timezone);
+    $this->assertNotEqual(count($date->getErrors()), 0, "array('year' => 10000, 'month' => 7, 'day' => 8, 'hour' => 8, 'minute' => 0, 'second' => 0) contains an invalid year and produces errors.");
+
+    // Test for invalid month from date array.
+    $input = array('year' => 2010, 'month' => 27, 'day' => 8, 'hour' => 8, 'minute' => 0, 'second' => 0);
+    $timezone = 'America/Chicago';
+    $date = new DateTimePlus($input, $timezone);
+    $this->assertNotEqual(count($date->getErrors()), 0, "array('year' => 2010, 'month' => 27, 'day' => 8, 'hour' => 8, 'minute' => 0, 'second' => 0) contains an invalid month and produces errors.");
+
+    // Test for invalid hour from date array.
+    $input = array('year' => 2010, 'month' => 2, 'day' => 28, 'hour' => 80, 'minute' => 0, 'second' => 0);
+    $timezone = 'America/Chicago';
+    $date = new DateTimePlus($input, $timezone);
+    $this->assertNotEqual(count($date->getErrors()), 0, "array('year' => 2010, 'month' => 2, 'day' => 28, 'hour' => 80, 'minute' => 0, 'second' => 0) contains an invalid hour and produces errors.");
+
+    // Test for invalid minute from date array.
+    $input = array('year' => 2010, 'month' => 7, 'day' => 8, 'hour' => 8, 'minute' => 88, 'second' => 0);
+    $timezone = 'America/Chicago';
+    $date = new DateTimePlus($input, $timezone);
+    $this->assertNotEqual(count($date->getErrors()), 0, "array('year' => 2010, 'month' => 7, 'day' => 8, 'hour' => 8, 'minute' => 88, 'second' => 0) contains an invalid minute and produces errors.");
+
+  }
+
+  /**
+   * Test that DrupalDateTime can detect the right timezone to use.
+   * When specified or not.
+   */
+  public function testDateTimezone() {
+    global $user;
+
+    $date_string = '2007-01-31 21:00:00';
+
+    // Detect the system timezone.
+    $system_timezone = date_default_timezone_get();
+
+    // Create a date object with an unspecified timezone, which should
+    // end up using the system timezone.
+    $date = new DateTimePlus($date_string);
+    $timezone = $date->getTimezone()->getName();
+    $this->assertTrue($timezone == $system_timezone, 'DateTimePlus uses the system timezone when there is no site timezone.');
+
+    // Create a date object with a specified timezone name.
+    $date = new DateTimePlus($date_string, 'America/Yellowknife');
+    $timezone = $date->getTimezone()->getName();
+    $this->assertTrue($timezone == 'America/Yellowknife', 'DateTimePlus uses the specified timezone if provided.');
+
+    // Create a date object with a timezone object.
+    $date = new DateTimePlus($date_string, new \DateTimeZone('Australia/Canberra'));
+    $timezone = $date->getTimezone()->getName();
+    $this->assertTrue($timezone == 'Australia/Canberra', 'DateTimePlus uses the specified timezone if provided.');
+
+    // Create a date object with another date object.
+    $new_date = new DateTimePlus('now', 'Pacific/Midway');
+    $date = new DateTimePlus($new_date);
+    $timezone = $date->getTimezone()->getName();
+    $this->assertTrue($timezone == 'Pacific/Midway', 'DateTimePlus uses the specified timezone if provided.');
+
+  }
+}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Datetime/DrupalDateTimeTest.php b/core/modules/system/lib/Drupal/system/Tests/Datetime/DrupalDateTimeTest.php
index ea2b4db..698ea1a 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Datetime/DrupalDateTimeTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Datetime/DrupalDateTimeTest.php
@@ -83,13 +83,13 @@ public function testDateTimezone() {
 
     // Set up the user with a different timezone than the site.
     $edit = array('mail' => $test_user->mail, 'timezone' => 'Asia/Manila');
-    $this->drupalPost('user/' . $test_user->id() . '/edit', $edit, t('Save'));
+    $this->drupalPost('user/' . $test_user->uid . '/edit', $edit, t('Save'));
 
     // Disable session saving as we are about to modify the global $user.
     drupal_save_session(FALSE);
     // Save the original user and then replace it with the test user.
     $real_user = $user;
-    $user = user_load($test_user->id(), TRUE);
+    $user = user_load($test_user->uid, TRUE);
 
     // Simulate a Drupal bootstrap with the logged-in user.
     date_default_timezone_set(drupal_get_user_timezone());
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityApiTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityApiTest.php
index 57f9355..a9fd8bf 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityApiTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityApiTest.php
@@ -56,9 +56,9 @@ public function testCRUD() {
    */
   protected function assertCRUD($entity_type, UserInterface $user1) {
     // Create some test entities.
-    $entity = entity_create($entity_type, array('name' => 'test', 'user_id' => $user1->id()));
+    $entity = entity_create($entity_type, array('name' => 'test', 'user_id' => $user1->uid));
     $entity->save();
-    $entity = entity_create($entity_type, array('name' => 'test2', 'user_id' => $user1->id()));
+    $entity = entity_create($entity_type, array('name' => 'test2', 'user_id' => $user1->uid));
     $entity->save();
     $entity = entity_create($entity_type, array('name' => 'test', 'user_id' => NULL));
     $entity->save();
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityCrudHookTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityCrudHookTest.php
index 4d98908..055b014 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityCrudHookTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityCrudHookTest.php
@@ -134,7 +134,7 @@ public function testCommentHooks() {
     $account = $this->createUser();
 
     $node = entity_create('node', array(
-      'uid' => $account->id(),
+      'uid' => $account->uid,
       'type' => 'article',
       'title' => 'Test node',
       'status' => 1,
@@ -154,7 +154,7 @@ public function testCommentHooks() {
       'cid' => NULL,
       'pid' => 0,
       'nid' => $nid,
-      'uid' => $account->id(),
+      'uid' => $account->uid,
       'subject' => 'Test comment',
       'created' => REQUEST_TIME,
       'changed' => REQUEST_TIME,
@@ -490,7 +490,7 @@ public function testUserHooks() {
     ));
 
     $_SESSION['entity_crud_hook_test'] = array();
-    user_load($account->id());
+    user_load($account->uid);
 
     $this->assertHookMessageOrder(array(
       'entity_crud_hook_test_entity_load called for type user',
@@ -509,7 +509,7 @@ public function testUserHooks() {
     ));
 
     $_SESSION['entity_crud_hook_test'] = array();
-    user_delete($account->id());
+    user_delete($account->uid);
 
     $this->assertHookMessageOrder(array(
       'entity_crud_hook_test_user_predelete called',
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFieldTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFieldTest.php
index 0781716..e8878be 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFieldTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFieldTest.php
@@ -67,7 +67,7 @@ protected function createTestEntity($entity_type) {
     // Pass in the value of the name field when creating. With the user
     // field we test setting a field after creation.
     $entity = entity_create($entity_type, array());
-    $entity->user_id->target_id = $this->entity_user->id();
+    $entity->user_id->target_id = $this->entity_user->uid;
     $entity->name->value = $this->entity_name;
 
     // Set a value for the test field.
@@ -117,19 +117,19 @@ protected function assertReadWrite($entity_type) {
     $this->assertTrue($entity->user_id instanceof FieldInterface, format_string('%entity_type: Field implements interface', array('%entity_type' => $entity_type)));
     $this->assertTrue($entity->user_id[0] instanceof FieldItemInterface, format_string('%entity_type: Field item implements interface', array('%entity_type' => $entity_type)));
 
-    $this->assertEqual($this->entity_user->id(), $entity->user_id->target_id, format_string('%entity_type: User id can be read.', array('%entity_type' => $entity_type)));
+    $this->assertEqual($this->entity_user->uid, $entity->user_id->target_id, format_string('%entity_type: User id can be read.', array('%entity_type' => $entity_type)));
     $this->assertEqual($this->entity_user->name, $entity->user_id->entity->name->value, format_string('%entity_type: User name can be read.', array('%entity_type' => $entity_type)));
 
     // Change the assigned user by entity.
     $new_user = $this->createUser();
     $entity->user_id->entity = $new_user;
-    $this->assertEqual($new_user->id(), $entity->user_id->target_id, format_string('%entity_type: Updated user id can be read.', array('%entity_type' => $entity_type)));
+    $this->assertEqual($new_user->uid, $entity->user_id->target_id, format_string('%entity_type: Updated user id can be read.', array('%entity_type' => $entity_type)));
     $this->assertEqual($new_user->name, $entity->user_id->entity->name->value, format_string('%entity_type: Updated user name value can be read.', array('%entity_type' => $entity_type)));
 
     // Change the assigned user by id.
     $new_user = $this->createUser();
-    $entity->user_id->target_id = $new_user->id();
-    $this->assertEqual($new_user->id(), $entity->user_id->target_id, format_string('%entity_type: Updated user id can be read.', array('%entity_type' => $entity_type)));
+    $entity->user_id->target_id = $new_user->uid;
+    $this->assertEqual($new_user->uid, $entity->user_id->target_id, format_string('%entity_type: Updated user id can be read.', array('%entity_type' => $entity_type)));
     $this->assertEqual($new_user->name, $entity->user_id->entity->name->value, format_string('%entity_type: Updated user name value can be read.', array('%entity_type' => $entity_type)));
 
     // Try unsetting a field.
@@ -207,7 +207,7 @@ protected function assertReadWrite($entity_type) {
     $this->entity_name = $this->randomName();
     $name_item[0]['value'] = $this->entity_name;
     $this->entity_user = $this->createUser();
-    $user_item[0]['target_id'] = $this->entity_user->id();
+    $user_item[0]['target_id'] = $this->entity_user->uid;
     $this->entity_field_text = $this->randomName();
     $text_item[0]['value'] = $this->entity_field_text;
 
@@ -217,7 +217,7 @@ protected function assertReadWrite($entity_type) {
       'field_test_text' => $text_item,
     ));
     $this->assertEqual($this->entity_name, $entity->name->value, format_string('%entity_type: Name value can be read.', array('%entity_type' => $entity_type)));
-    $this->assertEqual($this->entity_user->id(), $entity->user_id->target_id, format_string('%entity_type: User id can be read.', array('%entity_type' => $entity_type)));
+    $this->assertEqual($this->entity_user->uid, $entity->user_id->target_id, format_string('%entity_type: User id can be read.', array('%entity_type' => $entity_type)));
     $this->assertEqual($this->entity_user->name, $entity->user_id->entity->name->value, format_string('%entity_type: User name can be read.', array('%entity_type' => $entity_type)));
     $this->assertEqual($this->entity_field_text, $entity->field_test_text->value, format_string('%entity_type: Text field can be read.', array('%entity_type' => $entity_type)));
 
@@ -328,7 +328,7 @@ protected function assertSave($entity_type) {
     $this->assertTrue(is_string($entity->uuid->value), format_string('%entity_type: UUID value can be read.', array('%entity_type' => $entity_type)));
     $this->assertEqual(Language::LANGCODE_NOT_SPECIFIED, $entity->langcode->value, format_string('%entity_type: Language code can be read.', array('%entity_type' => $entity_type)));
     $this->assertEqual(language_load(Language::LANGCODE_NOT_SPECIFIED), $entity->langcode->language, format_string('%entity_type: Language object can be read.', array('%entity_type' => $entity_type)));
-    $this->assertEqual($this->entity_user->id(), $entity->user_id->target_id, format_string('%entity_type: User id can be read.', array('%entity_type' => $entity_type)));
+    $this->assertEqual($this->entity_user->uid, $entity->user_id->target_id, format_string('%entity_type: User id can be read.', array('%entity_type' => $entity_type)));
     $this->assertEqual($this->entity_user->name, $entity->user_id->entity->name->value, format_string('%entity_type: User name can be read.', array('%entity_type' => $entity_type)));
     $this->assertEqual($this->entity_field_text, $entity->field_test_text->value, format_string('%entity_type: Text field can be read.', array('%entity_type' => $entity_type)));
   }
@@ -339,7 +339,7 @@ protected function assertSave($entity_type) {
   public function testIntrospection() {
     // All entity variations have to have the same results.
     foreach (entity_test_entity_types() as $entity_type) {
-      $this->checkIntrospection($entity_type);
+      $this->assertIntrospection($entity_type);
     }
   }
 
@@ -349,11 +349,17 @@ public function testIntrospection() {
    * @param string $entity_type
    *   The entity type to run the tests with.
    */
-  protected function checkIntrospection($entity_type) {
-    // Test getting metadata upfront.
-    // @todo: Make this work without having to create entity objects.
-    $entity = entity_create($entity_type, array());
-    $definitions = $entity->getPropertyDefinitions();
+  protected function assertIntrospection($entity_type) {
+    // Test getting metadata upfront, i.e. without having an entity object.
+    $definition = array(
+      'type' => 'entity',
+      'constraints' => array(
+        'EntityType' => $entity_type,
+      ),
+      'label' => 'Test entity',
+    );
+    $wrapped_entity = $this->container->get('typed_data')->create($definition);
+    $definitions = $wrapped_entity->getPropertyDefinitions($definition);
     $this->assertEqual($definitions['name']['type'], 'string_field', $entity_type .': Name field found.');
     $this->assertEqual($definitions['user_id']['type'], 'entity_reference_field', $entity_type .': User field found.');
     $this->assertEqual($definitions['field_test_text']['type'], 'field_item:text', $entity_type .': Test-text-field field found.');
@@ -372,7 +378,7 @@ protected function checkIntrospection($entity_type) {
 
     $userref_properties = $entity->user_id->getPropertyDefinitions();
     $this->assertEqual($userref_properties['target_id']['type'], 'integer', $entity_type .': Entity id property of the user found.');
-    $this->assertEqual($userref_properties['entity']['type'], 'entity_reference', $entity_type .': Entity reference property of the user found.');
+    $this->assertEqual($userref_properties['entity']['type'], 'entity', $entity_type .': Entity reference property of the user found.');
 
     $textfield_properties = $entity->field_test_text->getPropertyDefinitions();
     $this->assertEqual($textfield_properties['value']['type'], 'string', $entity_type .': String value property of the test-text field found.');
@@ -464,12 +470,21 @@ public function testDataStructureInterfaces() {
    */
   protected function assertDataStructureInterfaces($entity_type) {
     $entity = $this->createTestEntity($entity_type);
+    $entity->save();
+    $entity_definition = array(
+      'type' => 'entity',
+      'constraints' => array(
+        'EntityType' => $entity_type,
+      ),
+      'label' => 'Test entity',
+    );
+    $wrapped_entity = $this->container->get('typed_data')->create($entity_definition, $entity);
 
     // Test using the whole tree of typed data by navigating through the tree of
     // contained properties and getting all contained strings, limited by a
     // certain depth.
     $strings = array();
-    $this->getContainedStrings($entity, 0, $strings);
+    $this->getContainedStrings($wrapped_entity, 0, $strings);
 
     // @todo: Once the user entity has defined properties this should contain
     // the user name and other user entity strings as well.
@@ -512,39 +527,22 @@ public function getContainedStrings(TypedDataInterface $wrapper, $depth, array &
   }
 
   /**
-   * Makes sure data types are correctly derived for all entity types.
-   */
-  public function testDataTypes() {
-    $types = \Drupal::typedData()->getDefinitions();
-    foreach (entity_test_entity_types() as $entity_type) {
-      $this->assertTrue($types['entity:' . $entity_type]['class'], 'Entity data type registed.');
-    }
-    // Check bundle types are provided as well.
-    entity_test_create_bundle('bundle');
-    $types = \Drupal::typedData()->getDefinitions();
-    $this->assertTrue($types['entity:entity_test:bundle']['class'], 'Entity bundle data type registed.');
-  }
-
-  /**
    * Tests validation constraints provided by the Entity API.
    */
   public function testEntityConstraintValidation() {
     $entity = $this->createTestEntity('entity_test');
     $entity->save();
-    // Create a reference field item and let it reference the entity.
-    $definition = array(
-      'type' => 'entity_reference_field',
-      'settings' => array(
-        'target_type' => 'entity_test',
+    $entity_definition = array(
+      'type' => 'entity',
+      'constraints' => array(
+        'EntityType' => 'entity_test',
       ),
       'label' => 'Test entity',
     );
-    $reference_field_item = \Drupal::TypedData()->create($definition);
-    $reference = $reference_field_item->get('entity');
-    $reference->setValue($entity);
+    $wrapped_entity = $this->container->get('typed_data')->create($entity_definition, $entity);
 
     // Test validation the typed data object.
-    $violations = $reference->validate();
+    $violations = $wrapped_entity->validate();
     $this->assertEqual($violations->count(), 0);
 
     // Test validating an entity of the wrong type.
@@ -554,31 +552,30 @@ public function testEntityConstraintValidation() {
       'type' => 'page',
       'uid' => $user->id(),
     ));
-    $reference->setValue($node);
-    $violations = $reference->validate();
+    // @todo: EntityWrapper can only handle entities with an id.
+    $node->save();
+    $wrapped_entity->setValue($node);
+    $violations = $wrapped_entity->validate();
     $this->assertEqual($violations->count(), 1);
 
     // Test bundle validation.
-    $definition = array(
-      'type' => 'entity_reference_field',
-      'settings' => array(
-        'target_type' => 'node',
-        'target_bundle' => 'article',
+    $entity_definition = array(
+      'type' => 'entity',
+      'constraints' => array(
+        'EntityType' => 'node',
+        'Bundle' => 'article',
       ),
+      'label' => 'Test node',
     );
-    $reference_field_item = \Drupal::TypedData()->create($definition);
-    $reference = $reference_field_item->get('entity');
-    $reference->setValue($node);
-    $violations = $reference->validate();
+    $wrapped_entity = $this->container->get('typed_data')->create($entity_definition, $node);
+
+    $violations = $wrapped_entity->validate();
     $this->assertEqual($violations->count(), 1);
 
-    $node = entity_create('node', array(
-      'type' => 'article',
-      'uid' => $user->id(),
-    ));
+    $node->type = 'article';
     $node->save();
-    $reference->setValue($node);
-    $violations = $reference->validate();
+    $wrapped_entity->setValue($node);
+    $violations = $wrapped_entity->validate();
     $this->assertEqual($violations->count(), 0);
   }
 
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 90ac1da..71b8141 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryRelationshipTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryRelationshipTest.php
@@ -109,7 +109,7 @@ public function setUp() {
       $entity = entity_create('entity_test', array());
       $entity->name->value = $this->randomName();
       $index = $i ? 1 : 0;
-      $entity->user_id->target_id = $this->accounts[$index]->id();
+      $entity->user_id->target_id = $this->accounts[$index]->uid;
       $entity->{$this->fieldName}->target_id = $this->terms[$index]->id();
       $entity->save();
       $this->entities[] = $entity;
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityRevisionsTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityRevisionsTest.php
index e2d31ab..152527b 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityRevisionsTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityRevisionsTest.php
@@ -64,7 +64,7 @@ protected function assertRevisions($entity_type) {
     // Create initial entity.
     $entity = entity_create($entity_type, array(
       'name' => 'foo',
-      'user_id' => $this->web_user->id(),
+      'user_id' => $this->web_user->uid,
     ));
     $entity->field_test_text->value = 'bar';
     $entity->save();
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php
index 40a7e44..15d6fc3 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php
@@ -107,7 +107,7 @@ public function testEntityLanguageMethods() {
   protected function assertEntityLanguageMethods($entity_type) {
     $entity = entity_create($entity_type, array(
       'name' => 'test',
-      'user_id' => $GLOBALS['user']->id(),
+      'user_id' => $GLOBALS['user']->uid,
     ));
     $this->assertEqual($entity->language()->id, Language::LANGCODE_NOT_SPECIFIED, format_string('%entity_type: Entity language not specified.', array('%entity_type' => $entity_type)));
     $this->assertFalse($entity->getTranslationLanguages(FALSE), format_string('%entity_type: No translations are available', array('%entity_type' => $entity_type)));
@@ -455,7 +455,8 @@ function testEntityTranslationAPI() {
     // Check that per-language defaults are properly populated.
     $entity = $this->reloadEntity($entity);
     $instance_id = implode('.', array($entity->entityType(), $entity->bundle(), $this->field_name));
-    $instance = $this->entityManager->getStorageController('field_instance')->load($instance_id);
+    $instances = $this->entityManager->getStorageController('field_instance')->loadMultiple(array($instance_id));
+    $instance = reset($instances);
     $instance['default_value_function'] = 'entity_test_field_default_value';
     $instance->save();
     $translation = $entity->addTranslation($langcode2);
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityUnitTestBase.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityUnitTestBase.php
index 34fb4cc..e5e4897 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityUnitTestBase.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityUnitTestBase.php
@@ -91,9 +91,11 @@ protected function createUser($values = array(), $permissions = array()) {
    *   The reloaded entity.
    */
   protected function reloadEntity(EntityInterface $entity) {
+    $ids = array($entity->id());
     $controller = $this->entityManager->getStorageController($entity->entityType());
-    $controller->resetCache(array($entity->id()));
-    return $controller->load($entity->id());
+    $controller->resetCache($ids);
+    $entities = $controller->loadMultiple($ids);
+    return reset($entities);
   }
 
   /**
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityValidationTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityValidationTest.php
index f00a35b..f1a0fdb 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityValidationTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityValidationTest.php
@@ -72,7 +72,7 @@ protected function createTestEntity($entity_type) {
     // Pass in the value of the name field when creating. With the user
     // field we test setting a field after creation.
     $entity = entity_create($entity_type, array());
-    $entity->user_id->target_id = $this->entity_user->id();
+    $entity->user_id->target_id = $this->entity_user->uid;
     $entity->name->value = $this->entity_name;
 
     // Set a value for the test field.
diff --git a/core/modules/system/lib/Drupal/system/Tests/Form/FormCacheTest.php b/core/modules/system/lib/Drupal/system/Tests/Form/FormCacheTest.php
index 07e3992..aa94a68 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Form/FormCacheTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Form/FormCacheTest.php
@@ -7,7 +7,6 @@
 
 namespace Drupal\system\Tests\Form;
 
-use Drupal\Core\Session\UserSession;
 use Drupal\simpletest\DrupalUnitTestBase;
 
 /**
@@ -46,7 +45,7 @@ public function setUp() {
    * Tests the form cache with a logged-in user.
    */
   function testCacheToken() {
-    $GLOBALS['user'] = new UserSession(array('uid' => 1));
+    $GLOBALS['user']->uid = 1;
     form_set_cache($this->form_build_id, $this->form, $this->form_state);
 
     $cached_form_state = form_state_defaults();
@@ -75,7 +74,7 @@ function testCacheToken() {
    * Tests the form cache without a logged-in user.
    */
   function testNoCacheToken() {
-    $GLOBALS['user'] = new UserSession(array('uid' => 0));
+    $GLOBALS['user']->uid = 0;
 
     $this->form_state['example'] = $this->randomName();
     form_set_cache($this->form_build_id, $this->form, $this->form_state);
diff --git a/core/modules/system/lib/Drupal/system/Tests/Image/ToolkitTest.php b/core/modules/system/lib/Drupal/system/Tests/Image/ToolkitTest.php
index 14a84e9..24e10b0 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Image/ToolkitTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Image/ToolkitTest.php
@@ -39,7 +39,7 @@ function testGetAvailableToolkits() {
   function testLoad() {
     $image = image_load($this->file, $this->toolkit);
     $this->assertTrue(is_object($image), 'Returned an object.');
-    $this->assertEqual($this->toolkit, $image->toolkit, 'Image had toolkit set.');
+    $this->assertEqual($this->toolkit, $image->toolkit, t('Image had toolkit set.'));
     $this->assertToolkitOperationsCalled(array('load', 'get_info'));
   }
 
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 fdb3a70..fd1c08f 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php
@@ -384,17 +384,17 @@ function testBreadCrumbs() {
     // Verify breadcrumb on user pages (without menu link) for anonymous user.
     $trail = $home;
     $this->assertBreadcrumb('user', $trail, t('Log in'));
-    $this->assertBreadcrumb('user/' . $this->admin_user->id(), $trail, $this->admin_user->name);
+    $this->assertBreadcrumb('user/' . $this->admin_user->uid, $trail, $this->admin_user->name);
 
     // Verify breadcrumb on user pages (without menu link) for registered users.
     $this->drupalLogin($this->admin_user);
     $trail = $home;
     $this->assertBreadcrumb('user', $trail, $this->admin_user->name);
-    $this->assertBreadcrumb('user/' . $this->admin_user->id(), $trail, $this->admin_user->name);
+    $this->assertBreadcrumb('user/' . $this->admin_user->uid, $trail, $this->admin_user->name);
     $trail += array(
-      'user/' . $this->admin_user->id() => $this->admin_user->name,
+      'user/' . $this->admin_user->uid => $this->admin_user->name,
     );
-    $this->assertBreadcrumb('user/' . $this->admin_user->id() . '/edit', $trail, $this->admin_user->name);
+    $this->assertBreadcrumb('user/' . $this->admin_user->uid . '/edit', $trail, $this->admin_user->name);
 
     // Create a second user to verify breadcrumb on user pages again.
     $this->web_user = $this->drupalCreateUser(array(
@@ -406,23 +406,23 @@ function testBreadCrumbs() {
     // Verify correct breadcrumb and page title on another user's account pages
     // (without menu link).
     $trail = $home;
-    $this->assertBreadcrumb('user/' . $this->admin_user->id(), $trail, $this->admin_user->name);
+    $this->assertBreadcrumb('user/' . $this->admin_user->uid, $trail, $this->admin_user->name);
     $trail += array(
-      'user/' . $this->admin_user->id() => $this->admin_user->name,
+      'user/' . $this->admin_user->uid => $this->admin_user->name,
     );
-    $this->assertBreadcrumb('user/' . $this->admin_user->id() . '/edit', $trail, $this->admin_user->name);
+    $this->assertBreadcrumb('user/' . $this->admin_user->uid . '/edit', $trail, $this->admin_user->name);
 
     // Verify correct breadcrumb and page title when viewing own user account
     // pages (without menu link).
     $trail = $home;
-    $this->assertBreadcrumb('user/' . $this->web_user->id(), $trail, $this->web_user->name);
+    $this->assertBreadcrumb('user/' . $this->web_user->uid, $trail, $this->web_user->name);
     $trail += array(
-      'user/' . $this->web_user->id() => $this->web_user->name,
+      'user/' . $this->web_user->uid => $this->web_user->name,
     );
     $tree = array(
       'user' => t('My account'),
     );
-    $this->assertBreadcrumb('user/' . $this->web_user->id() . '/edit', $trail, $this->web_user->name, $tree);
+    $this->assertBreadcrumb('user/' . $this->web_user->uid . '/edit', $trail, $this->web_user->name, $tree);
 
     // Add a Tools menu links for 'user' and $this->admin_user.
     // Although it may be faster to manage these links via low-level API
@@ -438,7 +438,7 @@ function testBreadCrumbs() {
 
     $edit = array(
       'link_title' => $this->admin_user->name . ' link',
-      'link_path' => 'user/' . $this->admin_user->id(),
+      'link_path' => 'user/' . $this->admin_user->uid,
     );
     $this->drupalPost("admin/structure/menu/manage/$menu/add", $edit, t('Save'));
     $menu_links_admin_user = entity_load_multiple_by_properties('menu_link', array('link_title' => $edit['link_title'], 'link_path' => $edit['link_path']));
@@ -454,13 +454,13 @@ function testBreadCrumbs() {
     $tree = array(
       $link_admin_user['link_path'] => $link_admin_user['link_title'],
     );
-    $this->assertBreadcrumb('user/' . $this->admin_user->id(), $trail, $link_admin_user['link_title'], $tree);
+    $this->assertBreadcrumb('user/' . $this->admin_user->uid, $trail, $link_admin_user['link_title'], $tree);
 
     $this->drupalLogin($this->admin_user);
     $trail += array(
       $link_admin_user['link_path'] => $link_admin_user['link_title'],
     );
-    $this->assertBreadcrumb('user/' . $this->admin_user->id() . '/edit', $trail, $link_admin_user['link_title'], $tree, FALSE);
+    $this->assertBreadcrumb('user/' . $this->admin_user->uid . '/edit', $trail, $link_admin_user['link_title'], $tree, FALSE);
 
     // Move 'user/%' below 'user' and verify again.
     $edit = array(
@@ -480,13 +480,13 @@ function testBreadCrumbs() {
     $tree += array(
       $link_admin_user['link_path'] => $link_admin_user['link_title'],
     );
-    $this->assertBreadcrumb('user/' . $this->admin_user->id(), $trail, $link_admin_user['link_title'], $tree);
+    $this->assertBreadcrumb('user/' . $this->admin_user->uid, $trail, $link_admin_user['link_title'], $tree);
 
     $this->drupalLogin($this->admin_user);
     $trail += array(
       $link_admin_user['link_path'] => $link_admin_user['link_title'],
     );
-    $this->assertBreadcrumb('user/' . $this->admin_user->id() . '/edit', $trail, $link_admin_user['link_title'], $tree, FALSE);
+    $this->assertBreadcrumb('user/' . $this->admin_user->uid . '/edit', $trail, $link_admin_user['link_title'], $tree, FALSE);
 
     // Create an only slightly privileged user being able to access site reports
     // but not administration pages.
diff --git a/core/modules/system/lib/Drupal/system/Tests/Menu/LocalTasksTest.php b/core/modules/system/lib/Drupal/system/Tests/Menu/LocalTasksTest.php
index 34034d6..5f695c0 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Menu/LocalTasksTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Menu/LocalTasksTest.php
@@ -140,48 +140,4 @@ protected function assertLocalTasks(array $hrefs, $level = 0) {
     }
   }
 
-  /**
-   * Tests the plugin based local tasks.
-   */
-  public function testPluginLocalTask() {
-    // Verify that local tasks appear as defined in the router.
-    $this->drupalGet('menu-local-task-test/tasks');
-
-    $this->drupalGet('menu-local-task-test/tasks/view');
-    $this->assertLocalTasks(array(
-      'menu-local-task-test/tasks/view',
-      'menu-local-task-test/tasks/settings',
-      'menu-local-task-test/tasks/edit',
-    ));
-
-    // Ensure the view tab is active.
-    $result = $this->xpath('//ul[contains(@class, "tabs")]//a[contains(@class, "active")]');
-    $this->assertEqual(1, count($result), 'There is just a single active tab.');
-    $this->assertEqual('View', (string) $result[0], 'The view tab is active.');
-
-    // Verify that local tasks in the second level appear.
-
-    $this->drupalGet('menu-local-task-test/tasks/settings');
-    $this->assertLocalTasks(array(
-      'menu-local-task-test/tasks/settings/sub1',
-      'menu-local-task-test/tasks/settings/sub2',
-    ), 1);
-
-    $result = $this->xpath('//ul[contains(@class, "tabs")]//a[contains(@class, "active")]');
-    $this->assertEqual(1, count($result), 'There is just a single active tab.');
-    $this->assertEqual('Settings', (string) $result[0], 'The settings tab is active.');
-
-
-    $this->drupalGet('menu-local-task-test/tasks/settings/sub1');
-    $this->assertLocalTasks(array(
-      'menu-local-task-test/tasks/settings/sub1',
-      'menu-local-task-test/tasks/settings/sub2',
-    ), 1);
-
-    $result = $this->xpath('//ul[contains(@class, "tabs")]//a[contains(@class, "active")]');
-    $this->assertEqual(2, count($result), 'There are tabs active on both levels.');
-    $this->assertEqual('Settings', (string) $result[0], 'The settings tab is active.');
-    $this->assertEqual('sub1', (string) $result[1], 'The sub1 tab is active.');
-  }
-
 }
diff --git a/core/modules/system/lib/Drupal/system/Tests/Menu/MenuRouterTest.php b/core/modules/system/lib/Drupal/system/Tests/Menu/MenuRouterTest.php
index 6829939..afb7e32 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Menu/MenuRouterTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Menu/MenuRouterTest.php
@@ -190,7 +190,7 @@ function testMaintenanceModeLoginPaths() {
     $this->drupalGet('test-page');
     $this->assertText($offline_message);
     $this->drupalGet('menu_login_callback');
-    $this->assertText('This is TestControllers::testLogin.', 'Maintenance mode can be bypassed using an event subscriber.');
+    $this->assertText('This is menu_login_callback().', 'Maintenance mode can be bypassed using an event subscriber.');
 
     config('system.maintenance')->set('enabled', 0)->save();
   }
@@ -205,11 +205,11 @@ function testAuthUserUserLogin() {
 
     $this->drupalGet('user/login');
     // Check that we got to 'user'.
-    $this->assertTrue($this->url == url('user/' . $this->loggedInUser->id(), array('absolute' => TRUE)), "Logged-in user redirected to user on accessing user/login");
+    $this->assertTrue($this->url == url('user/' . $this->loggedInUser->uid, array('absolute' => TRUE)), "Logged-in user redirected to user on accessing user/login");
 
     // user/register should redirect to user/UID/edit.
     $this->drupalGet('user/register');
-    $this->assertTrue($this->url == url('user/' . $this->loggedInUser->id() . '/edit', array('absolute' => TRUE)), "Logged-in user redirected to user/UID/edit on accessing user/register");
+    $this->assertTrue($this->url == url('user/' . $this->loggedInUser->uid . '/edit', array('absolute' => TRUE)), "Logged-in user redirected to user/UID/edit on accessing user/register");
   }
 
   /**
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 59dc6a2..6b3383b 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Module/DependencyTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Module/DependencyTest.php
@@ -61,7 +61,7 @@ function testMissingModules() {
     // Verify that the module is forced to be disabled when submitting
     // the module page.
     $this->drupalPost('admin/modules', array(), t('Save configuration'));
-    $this->assertText(t('The @module module is missing, so the following module will be disabled: @depends.', array('@module' => '_missing_dependency', '@depends' => 'System dependency test')), 'The module missing dependencies will be disabled.');
+    $this->assertText(t('The @module module is missing, so the following module will be disabled: @depends.', array('@module' => '_missing_dependency', '@depends' => 'system_dependencies_test')), 'The module missing dependencies will be disabled.');
 
     // Confirm.
     $this->drupalPost(NULL, NULL, t('Continue'));
diff --git a/core/modules/system/lib/Drupal/system/Tests/ParamConverter/UpcastingTest.php b/core/modules/system/lib/Drupal/system/Tests/ParamConverter/UpcastingTest.php
index d56ee5f..14a0422 100644
--- a/core/modules/system/lib/Drupal/system/Tests/ParamConverter/UpcastingTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/ParamConverter/UpcastingTest.php
@@ -46,13 +46,13 @@ public function testUpcasting() {
     $foo = 'bar';
 
     // paramconverter_test/test_user_node_foo/{user}/{node}/{foo}
-    $this->drupalGet("paramconverter_test/test_user_node_foo/"  . $user->id() . "/{$node->nid}/$foo");
+    $this->drupalGet("paramconverter_test/test_user_node_foo/{$user->uid}/{$node->nid}/$foo");
     $this->assertRaw("user: {$user->label()}, node: {$node->label()}, foo: $foo", 'user and node upcast by entity name');
 
     // paramconverter_test/test_node_user_user/{node}/{foo}/{user}
     // converters:
     //   foo: 'user'
-    $this->drupalGet("paramconverter_test/test_node_user_user/{$node->nid}/" . $user->id() . "/" . $user->id());
+    $this->drupalGet("paramconverter_test/test_node_user_user/{$node->nid}/{$user->uid}/{$user->uid}");
     $this->assertRaw("user: {$user->label()}, node: {$node->label()}, foo: {$user->label()}", 'foo converted to user as well');
 
     // paramconverter_test/test_node_node_foo/{user}/{node}/{foo}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Path/UrlAlterFunctionalTest.php b/core/modules/system/lib/Drupal/system/Tests/Path/UrlAlterFunctionalTest.php
index 201b58a..ba9c311 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Path/UrlAlterFunctionalTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Path/UrlAlterFunctionalTest.php
@@ -36,7 +36,7 @@ function testUrlAlter() {
     $account = $this->drupalCreateUser(array('administer url aliases'));
     $this->drupalLogin($account);
 
-    $uid = $account->id();
+    $uid = $account->uid;
     $name = $account->name;
 
     // Test a single altered path.
@@ -112,7 +112,7 @@ protected function assertUrlOutboundAlter($original, $final) {
    *
    * @param $original
    *   A string with the aliased or un-normal path that is run through
-   *   drupal_container()->get('path.alias_manager')->getSystemPath().
+   *   Drupal::service('path.alias_manager')->getSystemPath().
    * @param $final
    *   A string with the expected result after url().
    * @return
@@ -120,7 +120,7 @@ protected function assertUrlOutboundAlter($original, $final) {
    */
   protected function assertUrlInboundAlter($original, $final) {
     // Test inbound altering.
-    $result = drupal_container()->get('path.alias_manager')->getSystemPath($original);
+    $result = \Drupal::service('path.alias_manager')->getSystemPath($original);
     $this->assertIdentical($result, $final, format_string('Altered inbound URL %original, expected %final, and got %result.', array('%original' => $original, '%final' => $final, '%result' => $result)));
   }
 }
diff --git a/core/modules/system/lib/Drupal/system/Tests/Routing/RouteProviderTest.php b/core/modules/system/lib/Drupal/system/Tests/Routing/RouteProviderTest.php
index eee9abf..0b2bc18 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Routing/RouteProviderTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Routing/RouteProviderTest.php
@@ -260,10 +260,8 @@ function testOutlinePathMatchDefaultsCollision2() {
 
     try {
       $routes = $provider->getRouteCollectionForRequest($request);
-      $routes_array = $routes->all();
 
       $this->assertEqual(count($routes), 2, 'The correct number of routes was found.');
-      $this->assertEqual(array('narf', 'poink'), array_keys($routes_array), 'Ensure the fitness was taken into account.');
       $this->assertNotNull($routes->get('narf'), 'The first matching route was found.');
       $this->assertNotNull($routes->get('poink'), 'The second matching route was found.');
       $this->assertNull($routes->get('eep'), 'Noin-matching route was not found.');
diff --git a/core/modules/system/lib/Drupal/system/Tests/Session/SessionHttpsTest.php b/core/modules/system/lib/Drupal/system/Tests/Session/SessionHttpsTest.php
index e0e8e10..b338b7b 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Session/SessionHttpsTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Session/SessionHttpsTest.php
@@ -209,7 +209,7 @@ protected function testHttpsSession() {
     $this->drupalPost(NULL, $edit, t('Log in'));
 
     // Test that the user is also authenticated on the insecure site.
-    $this->drupalGet("user/" . $user->id() . "/edit");
+    $this->drupalGet("user/{$user->uid}/edit");
     $this->assertResponse(200);
   }
 
diff --git a/core/modules/system/lib/Drupal/system/Tests/Session/SessionTest.php b/core/modules/system/lib/Drupal/system/Tests/Session/SessionTest.php
index 220e672..f96b13e 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Session/SessionTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Session/SessionTest.php
@@ -42,7 +42,7 @@ function testSessionSaveRegenerate() {
     $user = $this->drupalCreateUser(array('access content'));
 
     // Enable sessions.
-    $this->sessionReset($user->id());
+    $this->sessionReset($user->uid);
 
     // Make sure the session cookie is set as HttpOnly.
     $this->drupalLogin($user);
@@ -84,7 +84,7 @@ function testSessionSaveRegenerate() {
   function testDataPersistence() {
     $user = $this->drupalCreateUser(array('access content'));
     // Enable sessions.
-    $this->sessionReset($user->id());
+    $this->sessionReset($user->uid);
 
     $this->drupalLogin($user);
 
@@ -104,7 +104,7 @@ function testDataPersistence() {
 
     // Switch browser cookie to anonymous user, then back to user 1.
     $this->sessionReset();
-    $this->sessionReset($user->id());
+    $this->sessionReset($user->uid);
     $this->assertText($value_1, 'Session data persists through browser close.', 'Session');
 
     // Logout the user and make sure the stored value no longer persists.
@@ -129,13 +129,13 @@ function testDataPersistence() {
 
     // Login, the data should persist.
     $this->drupalLogin($user);
-    $this->sessionReset($user->id());
+    $this->sessionReset($user->uid);
     $this->drupalGet('session-test/get');
     $this->assertNoText($value_1, 'Session has persisted for an authenticated user after logging out and then back in.', 'Session');
 
     // Change session and create another user.
     $user2 = $this->drupalCreateUser(array('access content'));
-    $this->sessionReset($user2->id());
+    $this->sessionReset($user2->uid);
     $this->drupalLogin($user2);
   }
 
@@ -203,7 +203,7 @@ function testSessionWrite() {
     $this->drupalLogin($user);
 
     $sql = 'SELECT u.access, s.timestamp FROM {users} u INNER JOIN {sessions} s ON u.uid = s.uid WHERE u.uid = :uid';
-    $times1 = db_query($sql, array(':uid' => $user->id()))->fetchObject();
+    $times1 = db_query($sql, array(':uid' => $user->uid))->fetchObject();
 
     // Before every request we sleep one second to make sure that if the session
     // is saved, its timestamp will change.
@@ -211,21 +211,21 @@ function testSessionWrite() {
     // Modify the session.
     sleep(1);
     $this->drupalGet('session-test/set/foo');
-    $times2 = db_query($sql, array(':uid' => $user->id()))->fetchObject();
+    $times2 = db_query($sql, array(':uid' => $user->uid))->fetchObject();
     $this->assertEqual($times2->access, $times1->access, 'Users table was not updated.');
     $this->assertNotEqual($times2->timestamp, $times1->timestamp, 'Sessions table was updated.');
 
     // Write the same value again, i.e. do not modify the session.
     sleep(1);
     $this->drupalGet('session-test/set/foo');
-    $times3 = db_query($sql, array(':uid' => $user->id()))->fetchObject();
+    $times3 = db_query($sql, array(':uid' => $user->uid))->fetchObject();
     $this->assertEqual($times3->access, $times1->access, 'Users table was not updated.');
     $this->assertEqual($times3->timestamp, $times2->timestamp, 'Sessions table was not updated.');
 
     // Do not change the session.
     sleep(1);
     $this->drupalGet('');
-    $times4 = db_query($sql, array(':uid' => $user->id()))->fetchObject();
+    $times4 = db_query($sql, array(':uid' => $user->uid))->fetchObject();
     $this->assertEqual($times4->access, $times3->access, 'Users table was not updated.');
     $this->assertEqual($times4->timestamp, $times3->timestamp, 'Sessions table was not updated.');
 
@@ -238,7 +238,7 @@ function testSessionWrite() {
     );
     $this->writeSettings($settings);
     $this->drupalGet('');
-    $times5 = db_query($sql, array(':uid' => $user->id()))->fetchObject();
+    $times5 = db_query($sql, array(':uid' => $user->uid))->fetchObject();
     $this->assertNotEqual($times5->access, $times4->access, 'Users table was updated.');
     $this->assertNotEqual($times5->timestamp, $times4->timestamp, 'Sessions table was updated.');
   }
@@ -254,7 +254,7 @@ function testEmptySessionID() {
 
     // Reset the sid in {sessions} to a blank string. This may exist in the
     // wild in some cases, although we normally prevent it from happening.
-    db_query("UPDATE {sessions} SET sid = '' WHERE uid = :uid", array(':uid' => $user->id()));
+    db_query("UPDATE {sessions} SET sid = '' WHERE uid = :uid", array(':uid' => $user->uid));
     // Send a blank sid in the session cookie, and the session should no longer
     // be valid. Closing the curl handler will stop the previous session ID
     // from persisting.
diff --git a/core/modules/system/lib/Drupal/system/Tests/System/AccessDeniedTest.php b/core/modules/system/lib/Drupal/system/Tests/System/AccessDeniedTest.php
index eb4ba4a..7c8c85b 100644
--- a/core/modules/system/lib/Drupal/system/Tests/System/AccessDeniedTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/System/AccessDeniedTest.php
@@ -49,7 +49,7 @@ function testAccessDenied() {
     // Use a custom 403 page.
     $this->drupalLogin($this->admin_user);
     $edit = array(
-      'site_403' => 'user/' . $this->admin_user->id(),
+      'site_403' => 'user/' . $this->admin_user->uid,
     );
     $this->drupalPost('admin/config/system/site-information', $edit, t('Save configuration'));
 
@@ -82,7 +82,7 @@ function testAccessDenied() {
     $edit = array(
       'region' => -1,
     );
-    $this->drupalPost('admin/structure/block/manage/stark.login', $edit, t('Save block'));
+    $this->drupalPost('admin/structure/block/manage/stark.login/configure', $edit, t('Save block'));
 
     // Check that we can log in from the 403 page.
     $this->drupalLogout();
diff --git a/core/modules/system/lib/Drupal/system/Tests/System/AdminMetaTagTest.php b/core/modules/system/lib/Drupal/system/Tests/System/AdminMetaTagTest.php
index 1b767e6..d566eb3 100644
--- a/core/modules/system/lib/Drupal/system/Tests/System/AdminMetaTagTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/System/AdminMetaTagTest.php
@@ -28,6 +28,6 @@ public function testMetaTag() {
     list($version, ) = explode('.', VERSION);
     $string = '<meta name="Generator" content="Drupal ' . $version . ' (http://drupal.org)" />';
     $this->drupalGet('node');
-    $this->assertRaw($string, 'Fingerprinting meta tag generated correctly.', 'System');
+    $this->assertRaw($string, 'Fingerprinting meta tag generated correctly.', t('System'));
   }
 }
diff --git a/core/modules/system/lib/Drupal/system/Tests/System/DateFormatsLanguageTest.php b/core/modules/system/lib/Drupal/system/Tests/System/DateFormatsLanguageTest.php
index 27e126a..4d98340 100644
--- a/core/modules/system/lib/Drupal/system/Tests/System/DateFormatsLanguageTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/System/DateFormatsLanguageTest.php
@@ -60,19 +60,19 @@ function testLocalizeDateFormats() {
 
     // Add new date format for French.
     $edit = array(
-      'id' => 'example_style_fr',
-      'label' => 'Example Style',
+      'date_format_id' => 'example_style_fr',
+      'date_format_name' => 'Example Style',
       'date_format_pattern' => 'd.m.Y - H:i',
-      'locales[]' => array('fr'),
+      'date_langcode[]' => array('fr'),
     );
     $this->drupalPost('admin/config/regional/date-time/formats/add', $edit, t('Add format'));
 
     // Add new date format for English.
     $edit = array(
-      'id' => 'example_style_en',
-      'label' => 'Example Style',
+      'date_format_id' => 'example_style_en',
+      'date_format_name' => 'Example Style',
       'date_format_pattern' => 'j M Y - g:ia',
-      'locales[]' => array('en'),
+      'date_langcode[]' => array('en'),
     );
     $this->drupalPost('admin/config/regional/date-time/formats/add', $edit, t('Add format'));
 
diff --git a/core/modules/system/lib/Drupal/system/Tests/System/DateFormatsLockedTest.php b/core/modules/system/lib/Drupal/system/Tests/System/DateFormatsLockedTest.php
deleted file mode 100644
index e10f106..0000000
--- a/core/modules/system/lib/Drupal/system/Tests/System/DateFormatsLockedTest.php
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\system\Tests\System\DateFormatsLockedTest.
- */
-
-namespace Drupal\system\Tests\System;
-
-use Drupal\simpletest\WebTestBase;
-
-/**
- * Tests the locked functionality of date formats.
- */
-class DateFormatsLockedTest extends WebTestBase {
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function getInfo() {
-    return array(
-      'name' => 'Locked date formats',
-      'description' => 'Tests the locked functionality of date formats.',
-      'group' => 'System',
-    );
-  }
-
-  /**
-   * Tests attempts at listing, editing, and deleting locked date formats.
-   */
-  public function testDateLocking() {
-    $this->drupalLogin($this->root_user);
-
-    // Locked date formats do not show on the listing page.
-    $this->drupalGet('admin/config/regional/date-time');
-    $this->assertLinkByHref('admin/config/regional/date-time/formats/manage/short');
-    $this->assertNoLinkByHref('admin/config/regional/date-time/formats/manage/html_date');
-
-    // Locked date formats are not editable.
-    $this->drupalGet('admin/config/regional/date-time/formats/manage/short');
-    $this->assertResponse(200);
-    $this->drupalGet('admin/config/regional/date-time/formats/manage/html_date');
-    $this->assertResponse(403);
-
-    // Locked date formats are not deletable.
-    $this->drupalGet('admin/config/regional/date-time/formats/manage/short/delete');
-    $this->assertResponse(200);
-    $this->drupalGet('admin/config/regional/date-time/formats/manage/html_date/delete');
-    $this->assertResponse(403);
-  }
-
-}
diff --git a/core/modules/system/lib/Drupal/system/Tests/System/DateTimeTest.php b/core/modules/system/lib/Drupal/system/Tests/System/DateTimeTest.php
index b9752b4..c867581 100644
--- a/core/modules/system/lib/Drupal/system/Tests/System/DateTimeTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/System/DateTimeTest.php
@@ -47,8 +47,8 @@ function testTimeZoneHandling() {
       ->set('default', 'Pacific/Honolulu')
       ->set('user.configurable', 0)
       ->save();
-    entity_load('date_format', 'medium')
-      ->setPattern('Y-m-d H:i:s O')
+    config('system.date')
+      ->set('formats.medium.pattern.php', 'Y-m-d H:i:s O')
       ->save();
 
     // Create some nodes with different authored-on dates.
@@ -78,7 +78,7 @@ function testTimeZoneHandling() {
    */
   function testDateFormatConfiguration() {
     // Confirm 'no custom date formats available' message appears.
-    $this->drupalGet('admin/config/regional/date-time');
+    $this->drupalGet('admin/config/regional/date-time/formats');
 
     // Add custom date format.
     $this->clickLink(t('Add format'));
@@ -86,56 +86,59 @@ function testDateFormatConfiguration() {
     $name = ucwords($date_format_id);
     $date_format = 'd.m.Y - H:i';
     $edit = array(
-      'id' => $date_format_id,
-      'label' => $name,
+      'date_format_id' => $date_format_id,
+      'date_format_name' => $name,
       'date_format_pattern' => $date_format,
     );
     $this->drupalPost('admin/config/regional/date-time/formats/add', $edit, t('Add format'));
-    $this->assertEqual($this->getUrl(), url('admin/config/regional/date-time', array('absolute' => TRUE)), 'Correct page redirection.');
-    $this->assertText(t('Custom date format added.'), 'Date format added confirmation message appears.');
+    $this->assertEqual($this->getUrl(), url('admin/config/regional/date-time/formats', array('absolute' => TRUE)), 'Correct page redirection.');
+    $this->assertText(t('Custom date format updated.'), 'Date format added confirmation message appears.');
     $this->assertText($date_format_id, 'Custom date format appears in the date format list.');
     $this->assertText(t('Delete'), 'Delete link for custom date format appears.');
 
     // Edit custom date format.
-    $this->drupalGet('admin/config/regional/date-time');
+    $this->drupalGet('admin/config/regional/date-time/formats');
     $this->clickLink(t('Edit'));
     $edit = array(
       'date_format_pattern' => 'Y m',
     );
     $this->drupalPost($this->getUrl(), $edit, t('Save format'));
-    $this->assertEqual($this->getUrl(), url('admin/config/regional/date-time', array('absolute' => TRUE)), 'Correct page redirection.');
+    $this->assertEqual($this->getUrl(), url('admin/config/regional/date-time/formats', array('absolute' => TRUE)), 'Correct page redirection.');
     $this->assertText(t('Custom date format updated.'), 'Custom date format successfully updated.');
 
     // Delete custom date format.
     $this->clickLink(t('Delete'));
-    $this->drupalPost('admin/config/regional/date-time/formats/manage/' . $date_format_id . '/delete', array(), t('Remove'));
-    $this->assertEqual($this->getUrl(), url('admin/config/regional/date-time', array('absolute' => TRUE)), 'Correct page redirection.');
+    $this->drupalPost('admin/config/regional/date-time/formats/' . $date_format_id . '/delete', array(), t('Remove'));
+    $this->assertEqual($this->getUrl(), url('admin/config/regional/date-time/formats', array('absolute' => TRUE)), 'Correct page redirection.');
     $this->assertText(t('Removed date format ' . $name), 'Custom date format removed.');
 
     // Make sure the date does not exist in config.
-    $date_format = entity_load('date_format', $date_format_id);
-    $this->assertFalse($date_format);
+    $date_format = config('system.date')->get('formats.' . $date_format_id);
+    $this->assertIdentical($date_format, NULL);
   }
 
   /**
    * Test if the date formats are stored properly.
    */
   function testDateFormatStorage() {
-    $date_format = entity_create('date_format', array(
-      'id' => 'test_short',
-      'label' => 'testDateFormatStorage Short Format',
+    $date_format_info = array(
+      'name' => 'testDateFormatStorage Short Format',
       'pattern' => array('php' => 'dmYHis'),
-    ));
-    $date_format->save();
+    );
+
+    system_date_format_save('test_short', $date_format_info);
 
-    $format = $date_format->getPattern();
+    $format = config('system.date')->get('formats.test_short.pattern.php');
     $this->assertEqual('dmYHis', $format, 'Unlocalized date format resides in general config.');
 
-    $date_format->addLocale('en')->save();
-    $format = $date_format->getPattern();
+    $date_format_info['locales'] = array('en');
+
+    system_date_format_save('test_short_en', $date_format_info);
+
+    $format = config('system.date')->get('formats.test_short_en.pattern.php');
     $this->assertEqual('dmYHis', $format, 'Localized date format resides in general config too.');
 
-    $format = config('locale.config.en.system.date_format.test_short')->get('pattern.php');
+    $format = config('locale.config.en.system.date')->get('formats.test_short_en.pattern.php');
     $this->assertEqual('dmYHis', $format, 'Localized date format resides in localized config.');
   }
 
@@ -143,12 +146,11 @@ function testDateFormatStorage() {
    * Test that date formats are sanitized.
    */
   function testDateFormatXSS() {
-    $date_format = entity_create('date_format', array(
-      'id' => 'xss_short',
-      'label' => 'XSS format',
+    $date_format_info = array(
+      'name' => 'XSS format',
       'pattern' => array('php' => '\<\s\c\r\i\p\t\>\a\l\e\r\t\(\'\X\S\S\'\)\;\<\/\s\c\r\i\p\t\>'),
-    ));
-    $date_format->save();
+    );
+    system_date_format_save('xss_short', $date_format_info);
 
     $this->drupalGet('admin/config/regional/date-time');
     $this->assertNoRaw("<script>alert('XSS');</script>", 'The date format was properly sanitized');
diff --git a/core/modules/system/lib/Drupal/system/Tests/System/DefaultMobileMetaTagsTest.php b/core/modules/system/lib/Drupal/system/Tests/System/DefaultMobileMetaTagsTest.php
index 6031a5d..c17863d 100644
--- a/core/modules/system/lib/Drupal/system/Tests/System/DefaultMobileMetaTagsTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/System/DefaultMobileMetaTagsTest.php
@@ -7,7 +7,6 @@
 
 namespace Drupal\system\Tests\System;
 
-use Drupal\Component\Utility\String;
 use Drupal\simpletest\WebTestBase;
 
 class DefaultMobileMetaTagsTest extends WebTestBase {
@@ -35,7 +34,7 @@ function setUp() {
   public function testDefaultMetaTagsExist() {
     $this->drupalGet('');
     foreach ($this->default_metatags as $name => $metatag) {
-      $this->assertRaw($metatag, String::format('Default Mobile meta tag "@name" displayed properly.', array('@name' => $name)), 'System');
+      $this->assertRaw($metatag, format_string('Default Mobile meta tag "@name" displayed properly.', array('@name' => $name)), t('System'));
     }
   }
 
@@ -46,7 +45,7 @@ public function testRemovingDefaultMetaTags() {
     module_enable(array('system_module_test'));
     $this->drupalGet('');
     foreach ($this->default_metatags as $name => $metatag) {
-      $this->assertNoRaw($metatag, String::format('Default Mobile meta tag "@name" removed properly.', array('@name' => $name)), 'System');
+      $this->assertNoRaw($metatag, format_string('Default Mobile meta tag "@name" removed properly.', array('@name' => $name)), t('System'));
     }
   }
 }
diff --git a/core/modules/system/lib/Drupal/system/Tests/System/MainContentFallbackTest.php b/core/modules/system/lib/Drupal/system/Tests/System/MainContentFallbackTest.php
index ae39a10..4e79ae9 100644
--- a/core/modules/system/lib/Drupal/system/Tests/System/MainContentFallbackTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/System/MainContentFallbackTest.php
@@ -81,7 +81,7 @@ function testMainContentFallback() {
 
     // Request a user* page and see if it is displayed.
     $this->drupalLogin($this->web_user);
-    $this->drupalGet('user/' . $this->web_user->id() . '/edit');
+    $this->drupalGet('user/' . $this->web_user->uid . '/edit');
     $this->assertField('mail', 'User interface still available.');
 
     // Enable the block module again.
diff --git a/core/modules/system/lib/Drupal/system/Tests/System/PageNotFoundTest.php b/core/modules/system/lib/Drupal/system/Tests/System/PageNotFoundTest.php
index a794f77..dde1822 100644
--- a/core/modules/system/lib/Drupal/system/Tests/System/PageNotFoundTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/System/PageNotFoundTest.php
@@ -37,7 +37,7 @@ function testPageNotFound() {
 
     // Use a custom 404 page.
     $edit = array(
-      'site_404' => 'user/' . $this->admin_user->id(),
+      'site_404' => 'user/' . $this->admin_user->uid,
     );
     $this->drupalPost('admin/config/system/site-information', $edit, t('Save configuration'));
 
diff --git a/core/modules/system/lib/Drupal/system/Tests/System/SiteMaintenanceTest.php b/core/modules/system/lib/Drupal/system/Tests/System/SiteMaintenanceTest.php
index a5a689c..761adf2 100644
--- a/core/modules/system/lib/Drupal/system/Tests/System/SiteMaintenanceTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/System/SiteMaintenanceTest.php
@@ -112,8 +112,8 @@ function testSiteMaintenance() {
     );
     $this->drupalPost('user/password', $edit, t('E-mail new password'));
     $mails = $this->drupalGetMails();
-    $start = strpos($mails[0]['body'], 'user/reset/'. $this->user->id());
-    $path = substr($mails[0]['body'], $start, 66 + strlen($this->user->id()));
+    $start = strpos($mails[0]['body'], 'user/reset/'. $this->user->uid);
+    $path = substr($mails[0]['body'], $start, 66 + strlen($this->user->uid));
 
     // Log in with temporary login link.
     $this->drupalPost($path, array(), t('Log in'));
diff --git a/core/modules/system/lib/Drupal/system/Tests/System/TokenReplaceTest.php b/core/modules/system/lib/Drupal/system/Tests/System/TokenReplaceTest.php
index 24dbb26..a220835 100644
--- a/core/modules/system/lib/Drupal/system/Tests/System/TokenReplaceTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/System/TokenReplaceTest.php
@@ -30,7 +30,7 @@ function testTokenReplacement() {
 
     // Create the initial objects.
     $account = $this->drupalCreateUser();
-    $node = $this->drupalCreateNode(array('uid' => $account->id()));
+    $node = $this->drupalCreateNode(array('uid' => $account->uid));
     $node->title = '<blink>Blinking Text</blink>';
     global $user;
     $language_interface = language(Language::TYPE_INTERFACE);
diff --git a/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeTest.php b/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeTest.php
index f10d83d..072bfb0 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeTest.php
@@ -162,14 +162,6 @@ function testTemplateOverride() {
   }
 
   /**
-   * Ensures a theme template can override a theme function.
-   */
-  function testFunctionOverride() {
-    $this->drupalGet('theme-test/function-template-overridden');
-    $this->assertText('Success: Template overrides theme function.', 'Theme function overridden by test_theme template.');
-  }
-
-  /**
    * Test the list_themes() function.
    */
   function testListThemes() {
@@ -265,18 +257,4 @@ public function testFindThemeTemplates() {
     $templates = drupal_find_theme_templates($cache, '.html.twig', drupal_get_path('theme', 'test_theme'));
     $this->assertEqual($templates['node__1']['template'], 'node--1', 'Template node--1.html.twig was found in test_theme.');
   }
-
-  /**
-   * Tests that the page variable is not prematurely flattened.
-   *
-   * Some modules check the page array in template_preprocess_html(), so we
-   * ensure that it has not been rendered prematurely.
-   */
-  function testPreprocessHtml() {
-    $this->drupalGet('');
-    $attributes = $this->xpath('/html/body[@theme_test_page_variable="Page variable is an array."]');
-    $this->assertTrue(count($attributes) == 1, 'In template_preprocess_html(), the page variable is still an array (not rendered yet).');
-  }
-
-
 }
diff --git a/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeTestPhpTemplate.php b/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeTestPhpTemplate.php
index 54f1b0f..35f08f5 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeTestPhpTemplate.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeTestPhpTemplate.php
@@ -42,7 +42,7 @@ function testTemplateOverride() {
       ->set('default', 'test_theme_phptemplate')
       ->save();
     $this->drupalGet('theme-test/template-test');
-    $this->assertText('Success: Template overridden with PHPTemplate theme.', 'Template overridden by PHPTemplate file.');
+    $this->assertText('Success: Template overridden with PHPTemplate theme.', t('Template overridden by PHPTemplate file.'));
   }
 
 }
diff --git a/core/modules/system/lib/Drupal/system/Tests/Theme/TwigSettingsTest.php b/core/modules/system/lib/Drupal/system/Tests/Theme/TwigSettingsTest.php
index f50f110..214e3c7 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Theme/TwigSettingsTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Theme/TwigSettingsTest.php
@@ -39,13 +39,13 @@ function testTwigAutoReloadOverride() {
     $this->rebuildContainer();
 
     // Check isAutoReload() via the Twig service container.
-    $this->assertTrue(drupal_container()->get('twig')->isAutoReload(), 'Automatic reloading of Twig templates enabled.');
+    $this->assertTrue(\Drupal::service('twig')->isAutoReload(), 'Automatic reloading of Twig templates enabled.');
 
     // Disable auto reload and check the service container again.
     $this->settingsSet('twig_auto_reload', FALSE);
     $this->rebuildContainer();
 
-    $this->assertFalse(drupal_container()->get('twig')->isAutoReload(), 'Automatic reloading of Twig templates disabled.');
+    $this->assertFalse(\Drupal::service('twig')->isAutoReload(), 'Automatic reloading of Twig templates disabled.');
   }
 
   /**
@@ -57,19 +57,19 @@ function testTwigDebugOverride() {
     $this->rebuildContainer();
 
     // Check isDebug() via the Twig service container.
-    $this->assertTrue(drupal_container()->get('twig')->isDebug(), 'Twig debug enabled.');
-    $this->assertTrue(drupal_container()->get('twig')->isAutoReload(), 'Twig automatic reloading is enabled when debug is enabled.');
+    $this->assertTrue(\Drupal::service('twig')->isDebug(), 'Twig debug enabled.');
+    $this->assertTrue(\Drupal::service('twig')->isAutoReload(), 'Twig automatic reloading is enabled when debug is enabled.');
 
     // Override auto reload when debug is enabled.
     $this->settingsSet('twig_auto_reload', FALSE);
     $this->rebuildContainer();
-    $this->assertFalse(drupal_container()->get('twig')->isAutoReload(), 'Twig automatic reloading can be disabled when debug is enabled.');
+    $this->assertFalse(\Drupal::service('twig')->isAutoReload(), 'Twig automatic reloading can be disabled when debug is enabled.');
 
     // Disable debug and check the service container again.
     $this->settingsSet('twig_debug', FALSE);
     $this->rebuildContainer();
 
-    $this->assertFalse(drupal_container()->get('twig')->isDebug(), 'Twig debug disabled.');
+    $this->assertFalse(\Drupal::service('twig')->isDebug(), 'Twig debug disabled.');
   }
 
   /**
@@ -94,7 +94,7 @@ function testTwigCacheOverride() {
     // Get the template filename and the cache filename for
     // theme_test.template_test.html.twig.
     $template_filename = $templates['theme_test_template_test']['path'] . '/' . $templates['theme_test_template_test']['template'] . $extension;
-    $cache_filename = drupal_container()->get('twig')->getCacheFilename($template_filename);
+    $cache_filename = \Drupal::service('twig')->getCacheFilename($template_filename);
 
     // Navigate to the page and make sure the template gets cached.
     $this->drupalGet('theme-test/template-test');
@@ -105,7 +105,7 @@ function testTwigCacheOverride() {
     $this->rebuildContainer();
 
     // This should return false after rebuilding the service container.
-    $new_cache_filename = drupal_container()->get('twig')->getCacheFilename($template_filename);
+    $new_cache_filename = \Drupal::service('twig')->getCacheFilename($template_filename);
     $this->assertFalse($new_cache_filename, 'Twig environment does not return cache filename after caching is disabled.');
   }
 
diff --git a/core/modules/system/lib/Drupal/system/Tests/Update/UpdateScriptTest.php b/core/modules/system/lib/Drupal/system/Tests/Update/UpdateScriptTest.php
index 3f625b1..67b150a 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Update/UpdateScriptTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Update/UpdateScriptTest.php
@@ -63,8 +63,8 @@ function testUpdateAccess() {
     // Access the update page as user 1.
     $user1 = user_load(1);
     $user1->pass_raw = user_password();
-    $user1->pass = drupal_container()->get('password')->hash(trim($user1->pass_raw));
-    db_query("UPDATE {users} SET pass = :pass WHERE uid = :uid", array(':pass' => $user1->pass, ':uid' => $user1->id()));
+    $user1->pass = \Drupal::service('password')->hash(trim($user1->pass_raw));
+    db_query("UPDATE {users} SET pass = :pass WHERE uid = :uid", array(':pass' => $user1->pass, ':uid' => $user1->uid));
     $this->drupalLogin($user1);
     $this->drupalGet($this->update_url, array('external' => TRUE));
     $this->assertResponse(200);
diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/DateUpgradePathTest.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/DateUpgradePathTest.php
index 990cbd5..e1720d1 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/DateUpgradePathTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Upgrade/DateUpgradePathTest.php
@@ -65,12 +65,12 @@ public function testDateUpgrade() {
       'locked' => '0',
     );
 
-    $actual_formats = entity_load_multiple('date_format', array_keys($expected_formats));
     foreach ($expected_formats as $type => $format) {
-      $format_info = $actual_formats[$type];
-      $this->assertEqual($format_info->label(), $format['name'], format_string('Config value for @type name is the same', array('@type' => $type)));
-      $this->assertEqual($format_info->get('locked'), $format['locked'], format_string('Config value for @type locked is the same', array('@type' => $type)));
-      $this->assertEqual($format_info->getPattern(), $format['pattern']['php'], format_string('Config value for @type PHP date pattern is the same', array('@type' => $type)));
+      $format_info = config('system.date')->get('formats.' . $type);
+
+      $this->assertEqual($format_info['name'], $format['name'], format_string('Config value for @type name is the same', array('@type' => $type)));
+      $this->assertEqual($format_info['locked'], $format['locked'], format_string('Config value for @type locked is the same', array('@type' => $type)));
+      $this->assertEqual($format_info['pattern']['php'], $format['pattern']['php'], format_string('Config value for @type PHP date pattern is the same', array('@type' => $type)));
 
       // Make sure that the variable was deleted.
       $this->assertNull(update_variable_get('date_format_' . $type), format_string('Date format variable for @type was deleted.', array('@type' => $type)));
@@ -91,10 +91,10 @@ public function testDateUpgrade() {
       ),
     );
 
+    $config = config('locale.config.de.system.date');
     foreach ($expected_de_formats as $locale_format) {
-      $format = config('locale.config.de.system.date_format.' . $locale_format['type'])->get('pattern.php');
+      $format = $config->get('formats.' . $locale_format['type'] . '.pattern.php');
       $this->assertEqual($locale_format['format'], $format);
     }
   }
-
 }
diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/FieldUpgradePathTest.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/FieldUpgradePathTest.php
index dd13cf9..79abf93 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/FieldUpgradePathTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Upgrade/FieldUpgradePathTest.php
@@ -118,7 +118,7 @@ public function testEntityFormDisplayUpgrade() {
    * Tests migration of field and instance definitions to config.
    */
   function testFieldUpgradeToConfig() {
-    $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
+    $this->assertTrue($this->performUpgrade(), t('The upgrade was completed successfully.'));
 
     // Check that the configuration for the 'body' field is correct.
     $config = \Drupal::config('field.field.body')->get();
diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/UpgradePathTestBase.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/UpgradePathTestBase.php
index d7052fa..2ebeb66 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/UpgradePathTestBase.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Upgrade/UpgradePathTestBase.php
@@ -11,7 +11,6 @@
 use Drupal\Core\Database\Database;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
 use Drupal\Core\DrupalKernel;
-use Drupal\Core\Session\UserSession;
 use Drupal\simpletest\WebTestBase;
 use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
 use Symfony\Component\HttpFoundation\Request;
@@ -149,12 +148,15 @@ protected function setUp() {
     // Ensure that the session is not written to the new environment and replace
     // the global $user session with uid 1 from the new test site.
     drupal_save_session(FALSE);
-    // Load values for uid 1.
-    $values = db_query('SELECT * FROM {users} WHERE uid = :uid', array(':uid' => 1))->fetchAssoc();
-    // Load rolest.
-    $values['roles'] = array_merge(array(DRUPAL_AUTHENTICATED_RID), db_query('SELECT rid FROM {users_roles} WHERE uid = :uid', array(':uid' => 1))->fetchCol());
-    // Create a new user session object.
-    $user = new UserSession($values);
+    // Login as uid 1.
+    $user = db_query('SELECT * FROM {users} WHERE uid = :uid', array(':uid' => 1))->fetchObject();
+    // Load roles for the user object.
+    $roles = array(DRUPAL_AUTHENTICATED_RID => DRUPAL_AUTHENTICATED_RID);
+    $result = db_query('SELECT rid, uid FROM {users_roles} WHERE uid = :uid', array(':uid' => 1));
+    foreach ($result as $record) {
+      $roles[$record->rid] = $record->rid;
+    }
+    $user->roles = $roles;
 
     // Generate and set a D8-compatible session cookie.
     $this->prepareD8Session();
diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc
index aa36ba7..957db86 100644
--- a/core/modules/system/system.admin.inc
+++ b/core/modules/system/system.admin.inc
@@ -5,10 +5,15 @@
  * Admin page callbacks for the system module.
  */
 
-use Drupal\system\DateFormatInterface;
+use Drupal\Core\Ajax\AjaxResponse;
+use Drupal\Core\Ajax\ReplaceCommand;
+use Symfony\Component\HttpFoundation\JsonResponse;
 use Symfony\Component\HttpFoundation\RedirectResponse;
 use Symfony\Component\HttpFoundation\Response;
 use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
+use Drupal\Core\Datetime\DrupalDateTime;
+use Drupal\system\Form\ModulesInstallConfirmForm;
+use Drupal\system\Form\ModulesUninstallConfirmForm;
 
 /**
  * Menu callback; Provide the administration overview page.
@@ -255,10 +260,8 @@ function system_themes_admin_form_submit($form, &$form_state) {
  * Menu callback; Set the default theme.
  */
 function system_theme_default() {
-  $request = Drupal::request();
-  $theme = $request->get('theme');
-  $token = $request->get('token');
-  if (!empty($theme) && !empty($token) && drupal_valid_token($token, 'system-theme-operation-link')) {
+  if (isset($_REQUEST['theme']) && isset($_REQUEST['token']) && drupal_valid_token($_REQUEST['token'], 'system-theme-operation-link')) {
+    $theme = $_REQUEST['theme'];
     // Get current list of themes.
     $themes = list_themes();
 
@@ -330,6 +333,202 @@ function _system_is_incompatible(&$incompatible, $files, $file) {
 }
 
 /**
+ * Form constructor for the module enable/disable interface.
+ *
+ * The list of modules gets populated by module.info.yml files, which contain
+ * each module's name, description, and information about which modules it
+ * requires.
+ * See drupal_parse_info_file() for information on module.info.yml descriptors.
+ *
+ * Dependency checking is performed to ensure that a module:
+ * - can not be enabled if there are disabled modules it requires.
+ * - can not be disabled if there are enabled modules which depend on it.
+ *
+ * @see system_menu()
+ * @see theme_system_modules()
+ * @see system_modules_submit()
+ *
+ * @ingroup forms
+ */
+function system_modules($form, $form_state = array()) {
+  // Get current list of modules.
+  $files = system_rebuild_module_data();
+
+  // Remove hidden modules from display list.
+  $visible_files = $files;
+  foreach ($visible_files as $filename => $file) {
+    if (!empty($file->info['hidden'])) {
+      unset($visible_files[$filename]);
+    }
+  }
+
+  uasort($visible_files, 'system_sort_modules_by_info_name');
+
+  // If the modules form was submitted, then system_modules_submit() runs first
+  // and if there are unfilled required modules, then $form_state['storage'] is
+  // filled, triggering a rebuild. In this case we need to display a
+  // confirmation form.
+  if (!empty($form_state['storage'])) {
+    // Contents of confirm form is injected here because already in form
+    // building function.
+    $confirm_form = new ModulesInstallConfirmForm();
+    return $confirm_form->buildForm($form, $form_state, $visible_files, $form_state['storage'], Drupal::request());
+  }
+
+  // JS-only table filters.
+  $form['filters'] = array(
+    '#type' => 'container',
+    '#attributes' => array(
+      'class' => array('table-filter', 'js-show'),
+    ),
+  );
+  $form['filters']['text'] = array(
+    '#type' => 'search',
+    '#title' => t('Search'),
+    '#size' => 30,
+    '#placeholder' => t('Enter module nameâ€¦'),
+    '#attributes' => array(
+      'class' => array('table-filter-text'),
+      'data-table' => '#system-modules',
+      'autocomplete' => 'off',
+      'title' => t('Enter a part of the module name or description to filter by.'),
+    ),
+  );
+
+  $modules = array();
+  $form['modules'] = array('#tree' => TRUE);
+
+  // Used when checking if module implements a help page.
+  $help_arg = module_exists('help') ? drupal_help_arg() : FALSE;
+
+  // Used when displaying modules that are required by the installation profile.
+  require_once DRUPAL_ROOT . '/core/includes/install.inc';
+  $distribution_name = check_plain(drupal_install_profile_distribution_name());
+
+  // Iterate through each of the modules.
+  foreach ($visible_files as $filename => $module) {
+    $extra = array();
+    $extra['enabled'] = (bool) $module->status;
+    if (!empty($module->info['required'] )) {
+      $extra['disabled'] = TRUE;
+      $extra['required_by'][] = $distribution_name . (!empty($module->info['explanation']) ? ' ('. $module->info['explanation'] .')' : '');
+    }
+
+    // If this module requires other modules, add them to the array.
+    foreach ($module->requires as $requires => $v) {
+      if (!isset($files[$requires])) {
+        $extra['requires'][$requires] = t('@module (<span class="admin-missing">missing</span>)', array('@module' => drupal_ucfirst($requires)));
+        $extra['disabled'] = TRUE;
+      }
+      // Only display visible modules.
+      elseif (isset($visible_files[$requires])) {
+        $requires_name = $files[$requires]->info['name'];
+        // Disable this module if it is incompatible with the dependency's version.
+        if ($incompatible_version = drupal_check_incompatibility($v, str_replace(DRUPAL_CORE_COMPATIBILITY . '-', '', $files[$requires]->info['version']))) {
+          $extra['requires'][$requires] = t('@module (<span class="admin-missing">incompatible with</span> version @version)', array(
+            '@module' => $requires_name . $incompatible_version,
+            '@version' => $files[$requires]->info['version'],
+          ));
+          $extra['disabled'] = TRUE;
+        }
+        // Disable this module if the dependency is incompatible with this
+        // version of Drupal core.
+        elseif ($files[$requires]->info['core'] != DRUPAL_CORE_COMPATIBILITY) {
+          $extra['requires'][$requires] = t('@module (<span class="admin-missing">incompatible with</span> this version of Drupal core)', array(
+            '@module' => $requires_name,
+          ));
+          $extra['disabled'] = TRUE;
+        }
+        elseif ($files[$requires]->status) {
+          $extra['requires'][$requires] = t('@module', array('@module' => $requires_name));
+        }
+        else {
+          $extra['requires'][$requires] = t('@module (<span class="admin-disabled">disabled</span>)', array('@module' => $requires_name));
+        }
+      }
+    }
+    // Generate link for module's help page, if there is one.
+    if ($help_arg && $module->status && in_array($filename, module_implements('help'))) {
+      if (module_invoke($filename, 'help', "admin/help#$filename", $help_arg)) {
+        $extra['links']['help'] = array(
+          '#type' => 'link',
+          '#title' => t('Help'),
+          '#href' => "admin/help/$filename",
+          '#options' => array('attributes' => array('class' =>  array('module-link', 'module-link-help'), 'title' => t('Help'))),
+        );
+      }
+    }
+    // Generate link for module's permission, if the user has access to it.
+    if ($module->status && user_access('administer permissions') && in_array($filename, module_implements('permission'))) {
+      $extra['links']['permissions'] = array(
+        '#type' => 'link',
+        '#title' => t('Permissions'),
+        '#href' => 'admin/people/permissions',
+        '#options' => array('fragment' => 'module-' . $filename, 'attributes' => array('class' => array('module-link', 'module-link-permissions'), 'title' => t('Configure permissions'))),
+      );
+    }
+    // Generate link for module's configuration page, if the module provides
+    // one.
+    if ($module->status && isset($module->info['configure'])) {
+      $configure_link = menu_get_item($module->info['configure']);
+      if ($configure_link['access']) {
+        $extra['links']['configure'] = array(
+          '#type' => 'link',
+          '#title' => t('Configure'),
+          '#href' => $configure_link['href'],
+          '#options' => array('attributes' => array('class' => array('module-link', 'module-link-configure'), 'title' => $configure_link['description'])),
+        );
+      }
+    }
+
+    // If this module is required by other modules, list those, and then make it
+    // impossible to disable this one.
+    foreach ($module->required_by as $required_by => $v) {
+      // Hidden modules are unset already.
+      if (isset($visible_files[$required_by])) {
+        if ($files[$required_by]->status == 1 && $module->status == 1) {
+          $extra['required_by'][] = t('@module', array('@module' => $files[$required_by]->info['name']));
+          $extra['disabled'] = TRUE;
+        }
+        else {
+          $extra['required_by'][] = t('@module (<span class="admin-disabled">disabled</span>)', array('@module' => $files[$required_by]->info['name']));
+        }
+      }
+    }
+    $form['modules'][$module->info['package']][$filename] = _system_modules_build_row($module->info, $extra);
+  }
+
+  // Add basic information to the details.
+  foreach (element_children($form['modules']) as $package) {
+    $form['modules'][$package] += array(
+      '#type' => 'details',
+      '#title' => t($package),
+      '#theme' => 'system_modules_details',
+      '#header' => array(
+        array('data' => t('<span class="visually-hidden">Enabled</span>'), 'class' => array('checkbox')),
+        array('data' => t('Name'), 'class' => array('name')),
+        array('data' => t('Description'), 'class' => array('description', RESPONSIVE_PRIORITY_LOW)),
+      ),
+      // Ensure that the "Core" package comes first.
+      '#weight' => $package == 'Core' ? -10 : NULL,
+    );
+  }
+
+  // Lastly, sort all packages by title.
+  uasort($form['modules'], 'element_sort_by_title');
+
+  $form['#attached']['library'][] = array('system', 'drupal.system.modules');
+  $form['actions'] = array('#type' => 'actions');
+  $form['actions']['submit'] = array(
+    '#type' => 'submit',
+    '#value' => t('Save configuration'),
+  );
+  $form['#action'] = url('admin/modules/list/confirm');
+
+  return $form;
+}
+
+/**
  * Array sorting callback; sorts modules or themes by their name.
  */
 function system_sort_modules_by_info_name($a, $b) {
@@ -350,6 +549,328 @@ function system_sort_themes($a, $b) {
 }
 
 /**
+ * Build a table row for the system modules page.
+ */
+function _system_modules_build_row($info, $extra) {
+  // Add in the defaults.
+  $extra += array(
+    'requires' => array(),
+    'required_by' => array(),
+    'disabled' => FALSE,
+    'enabled' => FALSE,
+    'links' => array(),
+  );
+  $form = array(
+    '#tree' => TRUE,
+  );
+  // Set the basic properties.
+  $form['name'] = array(
+    '#markup' => $info['name'],
+  );
+  $form['description'] = array(
+    '#markup' => t($info['description']),
+  );
+  $form['version'] = array(
+    '#markup' => $info['version'],
+  );
+  $form['#requires'] = $extra['requires'];
+  $form['#required_by'] = $extra['required_by'];
+
+  // Check the compatibilities.
+  $compatible = TRUE;
+  $status_short = '';
+  $status_long = '';
+
+  // Check the core compatibility.
+  if (!isset($info['core']) || $info['core'] != DRUPAL_CORE_COMPATIBILITY) {
+    $compatible = FALSE;
+    $status_short .= t('Incompatible with this version of Drupal core.');
+    $status_long .= t('This version is not compatible with Drupal !core_version and should be replaced.', array('!core_version' => DRUPAL_CORE_COMPATIBILITY));
+  }
+
+  // Ensure this module is compatible with the currently installed version of PHP.
+  if (version_compare(phpversion(), $info['php']) < 0) {
+    $compatible = FALSE;
+    $status_short .= t('Incompatible with this version of PHP');
+    $php_required = $info['php'];
+    if (substr_count($info['php'], '.') < 2) {
+      $php_required .= '.*';
+    }
+    $status_long .= t('This module requires PHP version @php_required and is incompatible with PHP version !php_version.', array('@php_required' => $php_required, '!php_version' => phpversion()));
+  }
+
+  // If this module is compatible, present a checkbox indicating
+  // this module may be installed. Otherwise, show a big red X.
+  if ($compatible) {
+    $form['enable'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Enable'),
+      '#default_value' => $extra['enabled'],
+      '#attributes' => array('role' => 'disabled'),
+    );
+    if ($extra['disabled']) {
+      $form['enable']['#disabled'] = TRUE;
+    }
+  }
+  else {
+    $form['enable'] = array(
+      '#markup' =>  theme('image', array('uri' => 'core/misc/watchdog-error.png', 'alt' => $status_short, 'title' => $status_short)),
+    );
+    $form['description']['#markup'] .= theme('system_modules_incompatible', array('message' => $status_long));
+  }
+
+  // Build operation links.
+  foreach (array('help', 'permissions', 'configure') as $key) {
+    $form['links'][$key] = (isset($extra['links'][$key]) ? $extra['links'][$key] : array());
+  }
+
+  return $form;
+}
+
+/**
+ * Submit callback; handles modules form submission.
+ */
+function system_modules_submit($form, &$form_state) {
+  include_once DRUPAL_ROOT . '/core/includes/install.inc';
+
+  // Builds list of modules.
+  $modules = array();
+  // If we're not coming from the confirmation form, build the list of modules.
+  if (empty($form_state['storage'])) {
+    // If we're not coming from the confirmation form, build the module list.
+    foreach ($form_state['values']['modules'] as $group_name => $group) {
+      foreach ($group as $module => $enabled) {
+        $modules[$module] = array('group' => $group_name, 'enabled' => $enabled['enable']);
+      }
+    }
+  }
+  else {
+    // If we are coming from the confirmation form, fetch
+    // the modules out of $form_state.
+    $modules = $form_state['storage']['modules'];
+  }
+
+  // Collect data for all modules to be able to determine dependencies.
+  $files = system_rebuild_module_data();
+
+  // Sorts modules by weight.
+  $sort = array();
+  foreach (array_keys($modules) as $module) {
+    $sort[$module] = $files[$module]->sort;
+  }
+  array_multisort($sort, $modules);
+
+  // Makes sure all required modules are set to be enabled.
+  $more_required = array();
+  $missing_modules = array();
+  foreach ($modules as $name => $module) {
+    if ($module['enabled']) {
+      // Checks that all dependencies are set to be enabled.  Stores the ones
+      // that are not in $dependencies variable so that the user can be alerted
+      // in the confirmation form that more modules need to be enabled.
+      $dependencies = array();
+      foreach (array_keys($files[$name]->requires) as $required) {
+        if (empty($modules[$required]['enabled'])) {
+          if (isset($files[$required])) {
+            $dependencies[] = $files[$required]->info['name'];
+            $modules[$required]['enabled'] = TRUE;
+          }
+          else {
+            $missing_modules[$required]['depends'][] = $name;
+            $modules[$name]['enabled'] = FALSE;
+          }
+        }
+      }
+
+      // Stores additional modules that need to be enabled in $more_required.
+      if (!empty($dependencies)) {
+        $more_required[$name] = array(
+          'name' => $files[$name]->info['name'],
+          'requires' => $dependencies,
+        );
+      }
+    }
+  }
+
+  // Redirects to confirmation form if more modules need to be enabled.
+  if ((!empty($more_required) || !empty($missing_modules)) && !isset($form_state['values']['confirm'])) {
+    $form_state['storage'] = array(
+      'more_required' => $more_required,
+      'modules' => $modules,
+      'missing_modules' => $missing_modules,
+    );
+    $form_state['rebuild'] = TRUE;
+    return;
+  }
+
+  // Invokes hook_requirements('install').  If failures are detected, makes sure
+  // the dependent modules aren't installed either.
+  foreach ($modules as $name => $module) {
+    // Only invoke hook_requirements() on modules that are going to be installed.
+    if ($module['enabled'] && drupal_get_installed_schema_version($name) == SCHEMA_UNINSTALLED) {
+      if (!drupal_check_module($name)) {
+        $modules[$name]['enabled'] = FALSE;
+        foreach (array_keys($files[$name]->required_by) as $required_by) {
+          $modules[$required_by]['enabled'] = FALSE;
+        }
+      }
+    }
+  }
+
+  // Initializes array of actions.
+  $actions = array(
+    'enable' => array(),
+    'disable' => array(),
+    'install' => array(),
+  );
+
+  // Builds arrays of modules that need to be enabled, disabled, and installed.
+  foreach ($modules as $name => $module) {
+    if ($module['enabled']) {
+      if (drupal_get_installed_schema_version($name) == SCHEMA_UNINSTALLED) {
+        $actions['install'][] = $name;
+        $actions['enable'][] = $name;
+      }
+      elseif (!module_exists($name)) {
+        $actions['enable'][] = $name;
+      }
+    }
+    elseif (module_exists($name)) {
+      $actions['disable'][] = $name;
+    }
+  }
+
+  // Gets list of modules prior to install process, unsets $form_state['storage']
+  // so we don't get redirected back to the confirmation form.
+  $pre_install_list = Drupal::moduleHandler()->getModuleList();
+  unset($form_state['storage']);
+
+  // Reverse the 'enable' list, to order dependencies before dependents.
+  krsort($actions['enable']);
+
+  // Installs, enables, and disables modules.
+  module_enable($actions['enable'], FALSE);
+  module_disable($actions['disable'], FALSE);
+
+  // Gets module list after install process, flushes caches and displays a
+  // message if there are changes.
+  $post_install_list = Drupal::moduleHandler()->getModuleList();
+  if ($pre_install_list != $post_install_list) {
+    drupal_flush_all_caches();
+    drupal_set_message(t('The configuration options have been saved.'));
+  }
+
+  $form_state['redirect'] = 'admin/modules';
+}
+
+/**
+ * Uninstall functions
+ */
+
+/**
+ * Form constructor for the uninstalling disabled modules form.
+ *
+ * @see system_menu()
+ * @see system_modules_uninstall_validate()
+ * @see system_modules_uninstall_submit()
+ *
+ * @ingroup forms
+ */
+function system_modules_uninstall($form, $form_state = NULL) {
+  // Make sure the install API is available.
+  include_once DRUPAL_ROOT . '/core/includes/install.inc';
+
+  // Display the confirm form if any modules have been submitted.
+  if (!empty($form_state['storage']['uninstall']) && $modules = array_filter($form_state['storage']['uninstall'])) {
+    // Contents of confirm form is injected here because already in form
+    // building function.
+    $confirm_form = new ModulesUninstallConfirmForm();
+    return $confirm_form->buildForm($form, $form_state, $modules, Drupal::request());
+  }
+
+  // Get a list of disabled, installed modules.
+  $all_modules = system_rebuild_module_data();
+  $disabled_modules = array();
+  foreach ($all_modules as $name => $module) {
+    if (empty($module->status) && drupal_get_installed_schema_version($name) > SCHEMA_UNINSTALLED) {
+      $disabled_modules[$name] = $module;
+    }
+  }
+
+  // Only build the rest of the form if there are any modules available to
+  // uninstall.
+  if (!empty($disabled_modules)) {
+    $profile = drupal_get_profile();
+    uasort($disabled_modules, 'system_sort_modules_by_info_name');
+    $form['uninstall'] = array('#tree' => TRUE);
+    foreach ($disabled_modules as $module) {
+      $module_name = $module->info['name'] ? $module->info['name'] : $module->name;
+      $form['modules'][$module->name]['#module_name'] = $module_name;
+      $form['modules'][$module->name]['name']['#markup'] = $module_name;
+      $form['modules'][$module->name]['description']['#markup'] = t($module->info['description']);
+      $form['uninstall'][$module->name] = array(
+        '#type' => 'checkbox',
+        '#title' => t('Uninstall @module module', array('@module' => $module_name)),
+        '#title_display' => 'invisible',
+      );
+      // All modules which depend on this one must be uninstalled first, before
+      // we can allow this module to be uninstalled. (The installation profile
+      // is excluded from this list.)
+      foreach (array_keys($module->required_by) as $dependent) {
+        if ($dependent != $profile && drupal_get_installed_schema_version($dependent) != SCHEMA_UNINSTALLED) {
+          $dependent_name = isset($all_modules[$dependent]->info['name']) ? $all_modules[$dependent]->info['name'] : $dependent;
+          $form['modules'][$module->name]['#required_by'][] = $dependent_name;
+          $form['uninstall'][$module->name]['#disabled'] = TRUE;
+        }
+      }
+    }
+    $form['actions'] = array('#type' => 'actions');
+    $form['actions']['submit'] = array(
+      '#type' => 'submit',
+      '#value' => t('Uninstall'),
+    );
+    $form['#action'] = url('admin/modules/uninstall/confirm');
+  }
+  else {
+    $form['modules'] = array();
+  }
+
+  return $form;
+}
+
+/**
+ * Validates the submitted uninstall form.
+ */
+function system_modules_uninstall_validate($form, &$form_state) {
+  // Form submitted, but no modules selected.
+  if (!count(array_filter($form_state['values']['uninstall']))) {
+    drupal_set_message(t('No modules selected.'), 'error');
+    return new RedirectResponse(url('admin/modules/uninstall', array('absolute' => TRUE)));
+  }
+}
+
+/**
+ * Processes the submitted uninstall form.
+ */
+function system_modules_uninstall_submit($form, &$form_state) {
+  // Make sure the install API is available.
+  include_once DRUPAL_ROOT . '/core/includes/install.inc';
+
+  if (!empty($form['#confirmed'])) {
+    // Call the uninstall routine for each selected module.
+    $modules = array_keys($form_state['values']['uninstall']);
+    module_uninstall($modules);
+    drupal_set_message(t('The selected modules have been uninstalled.'));
+
+    $form_state['redirect'] = 'admin/modules/uninstall';
+  }
+  else {
+    $form_state['storage'] = $form_state['values'];
+    $form_state['rebuild'] = TRUE;
+  }
+}
+
+/**
  * Default page callback for batches.
  */
 function system_batch_page() {
@@ -641,7 +1162,7 @@ function theme_system_modules_details($variables) {
     $row[] = array('class' => array('module'), 'data' => $col2);
 
     // Add the description, along with any modules it requires.
-    $description = '';
+    $description = '<span class="details"><span class="text table-filter-text-source">' . drupal_render($module['description']) . '</span></span>';
     if ($version || $requires || $required_by) {
       $description .= ' <div class="requirements">';
       if ($version) {
@@ -664,14 +1185,7 @@ function theme_system_modules_details($variables) {
       $description .= $links;
       $description .= '</div>';
     }
-    $details = array(
-      '#type' => 'details',
-      '#title' => '<span class="text"> ' . drupal_render($module['description']) . '</span>',
-      '#attributes' => array('id' => $module['enable']['#id'] . '-description'),
-      '#description' => $description,
-      '#collapsed' => TRUE,
-    );
-    $col4 = drupal_render($details);
+    $col4 = '<div class="inner" tabindex="0" role="button"><span class="module-description-prefix visually-hidden">Show description</span> ' . $description . '</div>';
     $row[] = array('class' => array('description', 'expand'), 'data' => $col4);
 
     $rows[] = $row;
@@ -719,11 +1233,11 @@ function theme_system_modules_uninstall($variables) {
   // Display table.
   $rows = array();
   foreach (element_children($form['modules']) as $module) {
-    if (!empty($form['modules'][$module]['#dependents'])) {
-      $disabled_message = format_plural(count($form['modules'][$module]['#dependents']),
+    if (!empty($form['modules'][$module]['#required_by'])) {
+      $disabled_message = format_plural(count($form['modules'][$module]['#required_by']),
         'To uninstall @module, the following module must be uninstalled first: @required_modules',
         'To uninstall @module, the following modules must be uninstalled first: @required_modules',
-        array('@module' => $form['modules'][$module]['#module_name'], '@required_modules' => implode(', ', $form['modules'][$module]['#dependents'])));
+        array('@module' => $form['modules'][$module]['#module_name'], '@required_modules' => implode(', ', $form['modules'][$module]['#required_by'])));
       $disabled_message = '<div class="admin-requirements">' . $disabled_message . '</div>';
     }
     else {
@@ -767,19 +1281,7 @@ function theme_system_themes_page($variables) {
     foreach ($theme_groups[$state] as $theme) {
 
       // Theme the screenshot.
-      if ($theme->screenshot) {
-        $image = array(
-          '#theme' => 'image',
-          '#uri' => $theme->screenshot['uri'],
-          '#alt' => $theme->screenshot['alt'],
-          '#title' => $theme->screenshot['title'],
-          '#attributes' => $theme->screenshot['attributes'],
-        );
-        $screenshot = drupal_render($image);
-      }
-      else {
-        $screenshot = '<div class="no-screenshot"><div class="no-screenshot__text">' . t('no screenshot') . '</div></div>';
-      }
+      $screenshot = $theme->screenshot ? theme('image', $theme->screenshot) : '<div class="no-screenshot"><div class="no-screenshot__text">' . t('no screenshot') . '</div></div>';
 
       // Localize the theme description.
       $description = t($theme->info['description']);
@@ -807,14 +1309,7 @@ function theme_system_themes_page($variables) {
         $output .= '<div class="incompatible">' . t('This theme requires the theme engine @theme_engine to operate correctly.', array('@theme_engine' => $theme->info['engine'])) . '</div>';
       }
       else {
-        $links = array(
-          '#theme' => 'links',
-          '#links' => $theme->operations,
-          '#attributes' => array(
-            'class' => array('operations', 'clearfix'),
-          ),
-        );
-        $output .= drupal_render($links);
+        $output .= theme('links', array('links' => $theme->operations, 'attributes' => array('class' => array('operations', 'clearfix'))));
       }
       $output .= '</div></div>';
     }
@@ -826,6 +1321,69 @@ function theme_system_themes_page($variables) {
 }
 
 /**
+ * Displays the date format strings overview page.
+ */
+function system_date_time_formats() {
+  $header = array(
+    array('data' => t('Machine name'), 'field' => 'machine_name'),
+    array('data' => t('Name'), 'field' => 'name'),
+    array('data' => t('Pattern'), 'field' => 'pattern'),
+    array('data' => t('Operations'))
+  );
+  $rows = array();
+
+  $formats = system_get_date_formats();
+
+  if (!empty($formats)) {
+    foreach ($formats as $date_format_id => $format_info) {
+      // Do not display date formats that are locked.
+      if (empty($format_info['locked'])) {
+        $row = array();
+        $row[] = array('data' => $date_format_id);
+        $row[] = array('data' => $format_info['name']);
+        $row[] = array('data' => format_date(REQUEST_TIME, $date_format_id));
+
+        // Prepare Operational links.
+        $links = array();
+        $links['edit'] = array(
+          'title' => t('Edit'),
+          'href' => 'admin/config/regional/date-time/formats/' . $date_format_id . '/edit',
+        );
+        $links['delete'] = array(
+          'title' => t('Delete'),
+          'href' => 'admin/config/regional/date-time/formats/' . $date_format_id . '/delete',
+        );
+        $row['operations'] = array('data' => array(
+          '#type' => 'operations',
+          '#links' => $links,
+        ));
+
+        $rows[] = $row;
+      }
+    }
+  }
+
+  $build['date_formats_table'] = array(
+    '#theme' => 'table',
+    '#header' => $header,
+    '#rows' => $rows,
+    '#empty' => t('No custom date formats available. <a href="@link">Add date format</a>.', array('@link' => url('admin/config/regional/date-time/formats/add'))),
+  );
+
+  return $build;
+}
+
+/**
+ * Checks if the chosen machine_name exists or not.
+ */
+function system_date_format_exists($candidate_machine_name) {
+  if ($formats = system_get_date_formats()) {
+    return array_key_exists($candidate_machine_name, $formats);
+  }
+  return FALSE;
+}
+
+/**
  * Page callback: Displays edit date format links for each language.
  *
  * @see locale_menu()
@@ -882,23 +1440,25 @@ function system_date_format_localize_form($form, &$form_state, $langcode) {
   );
 
   // Get list of available formats.
-  $date_service = Drupal::service('date');
-  $formats = Drupal::entityManager()
-    ->getStorageController('date_format')
-    ->loadMultiple();
+  $formats = system_get_date_formats();
   $choices = array();
   foreach ($formats as $date_format_id => $format_info) {
     // Ignore values that are localized.
-    if (!$format_info->hasLocales()) {
-      $choices[$date_format_id] = $date_service->format(REQUEST_TIME, $date_format_id);
+    if (empty($format_info['locales'])) {
+      $choices[$date_format_id] = format_date(REQUEST_TIME, $date_format_id);
+    }
+    else {
+      unset($formats[$date_format_id]);
     }
   }
 
   // Get configured formats for each language.
-  $config_prefix = 'locale.config.' . $langcode . '.system.date_format.';
-  foreach (config_get_storage_names_with_prefix($config_prefix) as $config_id) {
-    $date_format_id = substr($config_id, strlen($config_prefix));
-    $choices[$date_format_id] = $date_service->format(REQUEST_TIME, $date_format_id);
+  $locale_formats = system_date_format_locale($langcode);
+  if (!empty($locale_formats)) {
+    $formats += $locale_formats;
+    foreach ($locale_formats as $date_format_id => $format_info) {
+      $choices[$date_format_id] = format_date(REQUEST_TIME, $date_format_id);
+    }
   }
 
   // Display a form field for each format type.
@@ -906,7 +1466,7 @@ function system_date_format_localize_form($form, &$form_state, $langcode) {
     // Show date format select list.
     $form['date_formats']['date_format_' . $date_format_id] = array(
       '#type' => 'select',
-      '#title' => check_plain($format_info->label()),
+      '#title' => check_plain($format_info['name']),
       '#attributes' => array('class' => array('date-format')),
       '#default_value' => isset($choices[$date_format_id]) ? $date_format_id : 'custom',
       '#options' => $choices,
@@ -923,16 +1483,32 @@ function system_date_format_localize_form($form, &$form_state, $langcode) {
 }
 
 /**
+ * Ajax callback; Returns the date for a given format string.
+ */
+function system_date_time_lookup($form, &$form_state) {
+  $format = '';
+  if (!empty($form_state['values']['date_format_pattern'])) {
+    $format = t('Displayed as %date_format', array('%date_format' => format_date(REQUEST_TIME, 'custom', $form_state['values']['date_format_pattern'])));
+  }
+  // Return a command instead of a string, since the Ajax framework
+  // automatically prepends an additional empty DIV element for a string, which
+  // breaks the layout.
+  $response = new AjaxResponse();
+  $response->addCommand(new ReplaceCommand('#edit-date-format-suffix', '<small id="edit-date-format-suffix">' . $format . '</small>'));
+  return $response;
+}
+
+/**
  * Form submission handler for system_date_format_localize_form().
  */
 function system_date_format_localize_form_submit($form, &$form_state) {
   $langcode = $form_state['values']['langcode'];
 
-  $formats = entity_load_multiple('date_format');
+  $formats = system_get_date_formats();
   foreach ($formats as $date_format_id => $format_info) {
     if (isset($form_state['values']['date_format_' . $date_format_id])) {
       $format = $form_state['values']['date_format_' . $date_format_id];
-      system_date_format_localize_form_save($langcode, $date_format_id, $formats[$format]);
+      system_date_format_localize_form_save($langcode, $date_format_id, $formats[$format]['pattern']);
     }
   }
   drupal_set_message(t('Configuration saved.'));
@@ -973,17 +1549,16 @@ function theme_system_date_format_localize_form($variables) {
 /**
  * Save locale specific date formats to the database.
  *
- * @param string $langcode
+ * @param $langcode
  *   Language code, can be 2 characters, e.g. 'en' or 5 characters, e.g.
  *   'en-CA'.
- * @param string $date_format_id
+ * @param $date_format_id
  *   Date format id, e.g. 'short', 'medium'.
- * @param \Drupal\system\DateFormatInterface $format
- *   The date format entity.
+ * @param $format
+ *   The date format string.
  */
-function system_date_format_localize_form_save($langcode, $date_format_id, DateFormatInterface $format) {
-  $format->addLocale($langcode)->save();
-  config('locale.config.' . $langcode . '.system.date_format.' . $date_format_id)
-    ->set('pattern', $format->get('pattern'))
+function system_date_format_localize_form_save($langcode, $date_format_id, $format) {
+  config('locale.config.' . $langcode . '.system.date')
+    ->set('formats.' . $date_format_id . '.pattern', $format)
     ->save();
 }
diff --git a/core/modules/system/system.api.php b/core/modules/system/system.api.php
index a8dcd13..1e1bae3 100644
--- a/core/modules/system/system.api.php
+++ b/core/modules/system/system.api.php
@@ -821,6 +821,31 @@ function hook_menu() {
 }
 
 /**
+ * Define route-based local actions.
+ *
+ * Instead of using MENU_LOCAL_ACTION in hook_menu(), implement
+ * hook_local_actions().
+ *
+ * @return array
+ *   An associative array containing the following keys:
+ *   - route_name: The machine name of the local action route.
+ *   - title: The title of the local action.
+ *   - appears_on: An array of route names for this action to be display on.
+ */
+function hook_local_actions() {
+  return array(
+    array(
+      'route_name' => 'mymodule.route.action',
+      'title' => t('Perform local action'),
+      'appears_on' => array(
+        'mymodule.other_route',
+        'mymodule.other_other_route',
+      ),
+    ),
+  );
+}
+
+/**
  * Alter the data being saved to the {menu_router} table after hook_menu is invoked.
  *
  * This hook is invoked by menu_router_build(). The menu definitions are passed
@@ -914,32 +939,6 @@ function hook_menu_local_tasks_alter(&$data, $router_item, $root_path) {
 }
 
 /**
- * Alter local actions plugins.
- *
- * @param array $local_actions
- *   The array of local action plugin definitions, keyed by plugin ID.
- *
- * @see \Drupal\Core\Menu\LocalActionInterface
- * @see \Drupal\Core\Menu\LocalActionManager
- */
-function hook_menu_local_actions_alter(&$local_actions) {
-}
-
-/**
- * Alter local tasks plugins.
- *
- * @param array $local_tasks
- *   The array of local tasks plugin definitions, keyed by plugin ID.
- *
- * @see \Drupal\Core\Menu\LocalTaskInterface
- * @see \Drupal\Core\Menu\LocalTaskManager
- */
-function hook_local_task_alter(&$local_tasks) {
-  // Remove a specified local task plugin.
-  unset($local_tasks['example_plugin_id']);
-}
-
-/**
  * Alter links in the active trail before it is rendered as the breadcrumb.
  *
  * This hook is invoked by menu_get_active_breadcrumb() and allows alteration
@@ -1716,7 +1715,9 @@ function hook_template_preprocess_default_variables_alter(&$variables) {
  */
 function hook_custom_theme() {
   // Allow the user to request a particular theme via a query parameter.
-  return Drupal::request()->query->get('theme');
+  if (isset($_GET['theme'])) {
+    return $_GET['theme'];
+  }
 }
 
 /**
@@ -2174,7 +2175,7 @@ function hook_file_url_alter(&$uri) {
   global $user;
 
   // User 1 will always see the local file in this example.
-  if ($user->id() == 1) {
+  if ($user->uid == 1) {
     return;
   }
 
@@ -2645,11 +2646,11 @@ function hook_update_N(&$sandbox) {
     $user->name .= '!';
     db_update('users')
       ->fields(array('name' => $user->name))
-      ->condition('uid', $user->id())
+      ->condition('uid', $user->uid)
       ->execute();
 
     $sandbox['progress']++;
-    $sandbox['current_uid'] = $user->id();
+    $sandbox['current_uid'] = $user->uid;
   }
 
   $sandbox['#finished'] = empty($sandbox['max']) ? 1 : ($sandbox['progress'] / $sandbox['max']);
@@ -3073,7 +3074,7 @@ function hook_url_outbound_alter(&$path, &$options, $original_path) {
   // Instead of pointing to user/[uid]/edit, point to user/me/edit.
   if (preg_match('|^user/([0-9]*)/edit(/.*)?|', $path, $matches)) {
     global $user;
-    if ($user->id() == $matches[1]) {
+    if ($user->uid == $matches[1]) {
       $path = 'user/me/edit' . $matches[2];
     }
   }
diff --git a/core/modules/system/system.install b/core/modules/system/system.install
index d246507..71f136b 100644
--- a/core/modules/system/system.install
+++ b/core/modules/system/system.install
@@ -4,9 +4,7 @@
  * @file
  * Install, update and uninstall functions for the system module.
  */
-
 use Drupal\Component\Utility\Crypt;
-use Drupal\Component\Uuid\Uuid;
 use Drupal\Core\Config\FileStorage;
 use Drupal\Core\Database\Database;
 use Drupal\Core\Language\Language;
@@ -967,7 +965,8 @@ function system_schema() {
       ),
     ),
     'indexes' => array(
-      'pattern_outline_fit' => array('pattern_outline', 'fit'),
+      'fit' => array('fit'),
+      'pattern_outline' => array('pattern_outline'),
       'route_set' => array('route_set'),
     ),
     'primary key' => array('name'),
@@ -1623,7 +1622,8 @@ function system_update_8022() {
       ),
     ),
     'indexes' => array(
-      'pattern_outline_fit' => array('pattern_outline', 'fit'),
+      'fit' => array('fit'),
+      'pattern_outline' => array('pattern_outline'),
       'route_set' => array('route_set'),
     ),
     'primary key' => array('name'),
@@ -1880,51 +1880,33 @@ function system_update_8044() {
 
 /**
  * Convert existing date formats to the new config system.
- *
- * @ingroup config_upgrade
  */
 function system_update_8045() {
-  $uuid = new Uuid();
+  // Get the date config object.
+  $config = config('system.date');
+
   // Fetch all date types from {date_format_type}.
   $date_formats = db_query('SELECT * FROM {date_format_type}')->fetchAllAssoc('type', PDO::FETCH_ASSOC);
   if (!empty($date_formats)) {
     foreach ($date_formats as $type => $format) {
       // Set name and locked properties.
-      $config = config("system.date_format.$type")
-        ->set('id', $type)
-        ->set('label', $format['title'])
-        ->set('locked', $format['locked'])
-        ->set('status', 1)
-        ->set('uuid', $uuid->generate());
+      $config->set("formats.{$type}.name", $format['title']);
+      $config->set("formats.{$type}.locked", $format['locked']);
 
       // Get the default date format for this type.
       $variable_name = 'date_format_' . $type;
       $default_format = update_variable_get($variable_name, NULL);
       if ($default_format) {
         // In Drupal 7 we only used PHP date types.
-        $config->set('pattern.php', $default_format);
+        $config->set("formats.{$type}.pattern.php", $default_format);
 
         // Delete the migrated variables.
         update_variable_del($variable_name);
       }
-      // Save the date configuration object.
-      $config->save();
     }
-  }
 
-  // Install the new HTML date formats.
-  $new_formats = array(
-    'system.date_format.fallback',
-    'system.date_format.html_date',
-    'system.date_format.html_datetime',
-    'system.date_format.html_month',
-    'system.date_format.html_time',
-    'system.date_format.html_week',
-    'system.date_format.html_year',
-    'system.date_format.html_yearless_date',
-  );
-  foreach ($new_formats as $new_format) {
-    update_7_to_8_install_default_config('module', $new_format);
+    // Save the date configuration object.
+    $config->save();
   }
 }
 
@@ -1944,7 +1926,7 @@ function system_update_8046() {
   foreach ($config_to_import as $config_name => $module) {
     $module_config_path = drupal_get_path('module', $module) . '/config';
     $module_filestorage = new FileStorage($module_config_path);
-    $config_storage = drupal_container()->get('config.storage');
+    $config_storage = Drupal::service('config.storage');
     // If this file already exists, something in the upgrade path went
     // completely wrong and we want to know.
     if ($config_storage->exists($config_name)) {
@@ -2182,6 +2164,9 @@ function system_update_8056() {
       'search_result' => 'Search result',
       'print' => 'Print',
     ),
+    'file' => array(
+      'full' => 'File default',
+    ),
     'comment' => array(
       'full' => 'Full comment',
     ),
@@ -2192,6 +2177,9 @@ function system_update_8056() {
     'taxonomy_term' => array(
       'full' => 'Taxonomy term page',
     ),
+    'taxonomy_vocabulary' => array(
+      'full' => 'Taxonomy vocabulary',
+    ),
   );
 
   foreach ($entity_view_modes as $entity_type => $view_modes) {
@@ -2253,19 +2241,6 @@ function system_update_8058() {
 }
 
 /**
- * Move variable language_types to config.
- *
- * @ingroup config_upgrade
- */
-function system_update_8059() {
-  update_variables_to_config('system.language.types', array(
-    'language_interface' => 'configurable.language_interface',
-    'language_content' => 'configurable.language_content',
-    'language_url' => 'configurable.language_content',
-  ));
-}
-
-/**
  * @} End of "defgroup updates-7.x-to-8.x".
  * The next series of updates should start at 9000.
  */
diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index e771d4e..4e50408 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -124,7 +124,7 @@ function system_help($path, $arg) {
       break;
     case 'admin/config/development/maintenance':
       global $user;
-      if ($user->id() == 1) {
+      if ($user->uid == 1) {
         return '<p>' . t('Use maintenance mode when making major updates, particularly if the updates could disrupt visitors or the update process. Examples include upgrading, importing or exporting content, modifying a theme, modifying content types, and making backups.') . '</p>';
       }
       break;
@@ -161,7 +161,7 @@ function system_theme() {
       'file' => 'system.admin.inc',
     ),
     'status_report' => array(
-      'variables' => array('requirements' => NULL),
+      'render element' => 'requirements',
       'file' => 'system.admin.inc',
     ),
     'admin_page' => array(
@@ -283,10 +283,14 @@ function system_element_info() {
   $types['styles'] = array(
     '#items' => array(),
     '#pre_render' => array('drupal_pre_render_styles'),
+    '#group_callback' => 'drupal_group_css',
+    '#aggregate_callback' => 'drupal_aggregate_css',
   );
   $types['scripts'] = array(
     '#items' => array(),
     '#pre_render' => array('drupal_pre_render_scripts'),
+    '#group_callback' => 'drupal_group_js',
+    '#aggregate_callback' => 'drupal_aggregate_js',
   );
 
   // Input elements.
@@ -719,7 +723,10 @@ function system_menu() {
   $items['admin/modules'] = array(
     'title' => 'Extend',
     'description' => 'Add and enable modules to extend site functionality.',
-    'route_name' => 'system_modules_list',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('system_modules'),
+    'access arguments' => array('administer modules'),
+    'file' => 'system.admin.inc',
     'weight' => -2,
   );
   $items['admin/modules/list'] = array(
@@ -728,19 +735,22 @@ function system_menu() {
   );
   $items['admin/modules/list/confirm'] = array(
     'title' => 'List',
-    'route_name' => 'system_modules_list_confirm',
+    'access arguments' => array('administer modules'),
     'type' => MENU_VISIBLE_IN_BREADCRUMB,
   );
   $items['admin/modules/uninstall'] = array(
     'title' => 'Uninstall',
-    'route_name' => 'system_modules_uninstall',
+    'page arguments' => array('system_modules_uninstall'),
+    'access arguments' => array('administer modules'),
     'type' => MENU_LOCAL_TASK,
+    'file' => 'system.admin.inc',
     'weight' => 20,
   );
   $items['admin/modules/uninstall/confirm'] = array(
     'title' => 'Uninstall',
-    'route_name' => 'system_modules_uninstall_confirm',
+    'access arguments' => array('administer modules'),
     'type' => MENU_VISIBLE_IN_BREADCRUMB,
+    'file' => 'system.admin.inc',
   );
 
   // Configuration.
@@ -839,8 +849,10 @@ function system_menu() {
   $items['admin/config/regional/date-time'] = array(
     'title' => 'Date and time formats',
     'description' => 'Configure display format strings for date and time.',
-    'route_name' => 'date_format_list',
+    'page callback' => 'system_date_time_formats',
+    'access arguments' => array('administer site configuration'),
     'weight' => -9,
+    'file' => 'system.admin.inc',
   );
   $items['admin/config/regional/date-time/formats/add'] = array(
     'title' => 'Add format',
@@ -849,12 +861,15 @@ function system_menu() {
     'route_name' => 'date_format_add',
     'weight' => -10,
   );
-  $items['admin/config/regional/date-time/formats/manage/%'] = array(
+  $items['admin/config/regional/date-time/formats/%/edit'] = array(
     'title' => 'Edit date format',
     'description' => 'Allow users to edit a configured date format.',
-    'route_name' => 'date_format_edit',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('system_configure_date_formats_form', 5),
+    'access arguments' => array('administer site configuration'),
+    'file' => 'system.admin.inc',
   );
-  $items['admin/config/regional/date-time/formats/manage/%/delete'] = array(
+  $items['admin/config/regional/date-time/formats/%/delete'] = array(
     'title' => 'Delete date format',
     'description' => 'Allow users to delete a configured date format.',
     'route_name' => 'date_format_delete',
@@ -973,7 +988,7 @@ function system_menu() {
     );
   }
 
-  foreach (drupal_container()->get('plugin.manager.system.plugin_ui')->getDefinitions() as $plugin_id => $plugin) {
+  foreach (Drupal::service('plugin.manager.system.plugin_ui')->getDefinitions() as $plugin_id => $plugin) {
     if ($plugin['menu'] === TRUE) {
       $items[$plugin['path'] . '/' . $plugin_id . '/' . $plugin['suffix']] = array(
         'title' => $plugin['title'],
@@ -1006,6 +1021,13 @@ function system_menu() {
           $items[$plugin['path'] . '/' . $plugin_id . '/%']['file path'] = $plugin['file_path'];
         }
       }
+      $items['system/autocomplete/' . $plugin_id] = array(
+        'page callback' => 'system_plugin_autocomplete',
+        'page arguments' => array($plugin_id),
+        'access callback' => 'system_plugin_ui_access',
+        'access arguments' => array($plugin_id),
+        'type' => MENU_CALLBACK,
+      );
     }
   }
 
@@ -1019,7 +1041,7 @@ function system_menu() {
  *   documentation. Also "proxies" is a weird word to use.
  */
 function system_plugin_ui_form($form, &$form_state, $plugin, $facet = NULL) {
-  $plugin_ui = drupal_container()->get('plugin.manager.system.plugin_ui')->createInstance($plugin);
+  $plugin_ui = Drupal::service('plugin.manager.system.plugin_ui')->createInstance($plugin);
   $form = $plugin_ui->form($form, $form_state, $facet);
   $form['#validate'][] = array($plugin_ui, 'formValidate');
   $form['#submit'][] = array($plugin_ui, 'formSubmit');
@@ -1027,13 +1049,44 @@ function system_plugin_ui_form($form, &$form_state, $plugin, $facet = NULL) {
 }
 
 /**
+ * Page callback: Autocompletes any plugin system tied to a plugin UI plugin.
+ *
+ * The passed plugin_id indicates the specific plugin_ui plugin that is in use
+ * here. The documentation within the annotation of that plugin will contain a
+ * manager for the plugins that need to be autocompleted allowing this function
+ * to autocomplete plugins for any plugin type.
+ *
+ * @param $plugin_id
+ *   The plugin id for the calling plugin.
+ *
+ * @return object JsonResponse
+ */
+function system_plugin_autocomplete($plugin_id) {
+  $string_typed = Drupal::request()->query->get('q');
+  $string_typed = drupal_explode_tags($string_typed);
+  $string = drupal_strtolower(array_pop($string_typed));
+  $matches = array();
+  if ($string) {
+    $plugin_ui = Drupal::service('plugin.manager.system.plugin_ui')->getDefinition($plugin_id);
+    $manager = Drupal::service($plugin_ui['manager']);
+    $titles = array();
+    foreach($manager->getDefinitions() as $plugin_id => $plugin) {
+      $titles[$plugin_id] = $plugin[$plugin_ui['title_attribute']];
+    }
+    $matches = preg_grep("/\b". $string . "/i", $titles);
+  }
+
+  return new JsonResponse($matches);
+}
+
+/**
  * Checks access for a given plugin using the plugin's access() method.
  *
  * @todo This needs more explanation, some @see, and parameter documentation.
  * @todo What the heck kind of parameter name is "facet"?
  */
 function system_plugin_ui_access($plugin, $facet = NULL) {
-  $plugin_ui = drupal_container()->get('plugin.manager.system.plugin_ui')->createInstance($plugin);
+  $plugin_ui = Drupal::service('plugin.manager.system.plugin_ui')->createInstance($plugin);
   return $plugin_ui->access($facet);
 }
 
@@ -1042,7 +1095,7 @@ function system_plugin_ui_access($plugin, $facet = NULL) {
  */
 function system_forms() {
   $forms = array();
-  foreach (drupal_container()->get('plugin.manager.system.plugin_ui')->getDefinitions() as $plugin_id => $plugin) {
+  foreach (Drupal::service('plugin.manager.system.plugin_ui')->getDefinitions() as $plugin_id => $plugin) {
     if (empty($forms[$plugin['id']])) {
       $forms[$plugin['id']]['callback'] = 'system_plugin_ui_form';
     }
@@ -1489,23 +1542,11 @@ function system_library_info() {
     'css' => array(
       'core/assets/vendor/normalize-css/normalize.css' => array(
         'every_page' => TRUE,
-        'weight' => CSS_BASE - 20,
+        'weight' => -10,
       ),
     ),
   );
 
-  // Drupal's base CSS.
-  $libraries['drupal.base'] = array(
-    'title' => 'Drupal base CSS',
-    'version' => VERSION,
-    'css' => array(
-      'core/misc/drupal.base.css' => array(
-        'every_page' => TRUE,
-        'weight' => CSS_BASE - 10,
-       ),
-     ),
-   );
-
   // jQuery UI.
   $libraries['jquery.ui.core'] = array(
     'title' => 'jQuery UI: Core',
@@ -2323,8 +2364,6 @@ function system_filetransfer_info() {
  * Implements hook_page_build().
  */
 function system_page_build(&$page) {
-  // Note: ensure the same CSS is loaded in _drupal_maintenance_theme().
-  $page['#attached']['library'][] = array('system', 'drupal.base');
   $path = drupal_get_path('module', 'system');
   // Adjust the weights to load these early.
   $page['#attached']['css'][$path . '/css/system.module.css'] = array('weight' => CSS_COMPONENT - 10, 'every_page' => TRUE);
@@ -2335,11 +2374,31 @@ function system_page_build(&$page) {
 }
 
 /**
+ * Select locale date format details from database.
+ *
+ * @param $languages
+ *   An array of language codes.
+ *
+ * @return
+ *   An array of date formats.
+ */
+function system_get_localized_date_format($languages) {
+  // Get list of different format types.
+  foreach ($languages as $language) {
+    $date_formats = config('locale.config.' . $language . '.system.date')->get('formats');
+    if (!empty($date_formats)) {
+      return $date_formats;
+    }
+  }
+  return array();
+}
+
+/**
  * Implements hook_custom_theme().
  */
 function system_custom_theme() {
   if (drupal_container()->isScopeActive('request')) {
-    $request = drupal_container()->get('request');
+    $request = Drupal::request();
     $path = $request->attributes->get('system_path');
     if (user_access('view the administration theme') && path_is_admin($path)) {
       return config('system.theme')->get('admin');
@@ -2383,7 +2442,7 @@ function system_user_login($account) {
   $config = config('system.timezone');
   // If the user has a NULL time zone, notify them to set a time zone.
   if (!$account->timezone && $config->get('user.configurable') && $config->get('user.warn')) {
-    drupal_set_message(t('Configure your <a href="@user-edit">account time zone setting</a>.', array('@user-edit' => url("user/$account->id()/edit", array('query' => drupal_get_destination(), 'fragment' => 'edit-timezone')))));
+    drupal_set_message(t('Configure your <a href="@user-edit">account time zone setting</a>.', array('@user-edit' => url("user/$account->uid/edit", array('query' => drupal_get_destination(), 'fragment' => 'edit-timezone')))));
   }
 }
 
@@ -2402,11 +2461,11 @@ function system_user_timezone(&$form, &$form_state) {
   $form['timezone']['timezone'] = array(
     '#type' => 'select',
     '#title' => t('Time zone'),
-    '#default_value' => isset($account->timezone) ? $account->timezone : ($account->id() == $user->id() ? config('system.timezone')->get('default') : ''),
-    '#options' => system_time_zones($account->id() != $user->id()),
+    '#default_value' => isset($account->timezone) ? $account->timezone : ($account->uid == $user->uid ? config('system.timezone')->get('default') : ''),
+    '#options' => system_time_zones($account->uid != $user->uid),
     '#description' => t('Select the desired local time and time zone. Dates and times throughout this site will be displayed using this time zone.'),
   );
-  if (!isset($account->timezone) && $account->id() == $user->id() && empty($form_state['input']['timezone'])) {
+  if (!isset($account->timezone) && $account->uid == $user->uid && empty($form_state['input']['timezone'])) {
     $form['timezone']['#description'] = t('Your time zone setting will be automatically detected if possible. Confirm the selection and click save.');
     $form['timezone']['timezone']['#attributes'] = array('class' => array('timezone-detect'));
     drupal_add_library('system', 'drupal.timezone');
@@ -3373,6 +3432,114 @@ function system_run_automated_cron() {
 }
 
 /**
+ * Gets the list of defined date formats and attributes.
+ *
+ * @return array
+ *   An associative array of date formats. The top-level keys are the
+ *   machine-readable names of the date formats. The values are associative
+ *   arrays with the following keys:
+ *   - name: The string human readable name of the date format.
+ *   - pattern: An associative array of patterns that will modify the format
+ *     of the date, keyed with 'php' for normal PHP date pattern and 'intl'
+ *     for the alternate pattern used by the IntlDateFormatter.
+ */
+function system_get_date_formats() {
+  return config('system.date')->get('formats');
+}
+
+/**
+ * Gets the appropriate date format string for a date type and locale.
+ *
+ * @param $langcode
+ *   (optional) String language code for the current locale. This can be a 2 character
+ *   language code like 'en' and 'fr' or a 5 character language code like
+ *   'en-gb' and 'en-us'.
+ * @param $date_format_id
+ *   (optional) String machine name for the date format.
+ *
+ * @return
+ *   If $date_format_id and $langcode are specified, returns the corresponding
+ *   date format string. If only $langcode is specified, returns an array of
+ *   all date format strings for that locale, keyed by the date type. If
+ *   neither is specified returns FALSE.
+ */
+function system_date_format_locale($langcode = NULL, $date_format_id = NULL) {
+  $formats = &drupal_static(__FUNCTION__);
+
+  if (!isset($formats[$langcode])) {
+    $formats[$langcode] = config('locale.config.' . $langcode . '.system.date')->get('formats');
+  }
+
+  if ($date_format_id && $langcode && !empty($formats[$langcode][$date_format_id])) {
+    return $formats[$langcode][$date_format_id];
+  }
+  elseif ($langcode && !empty($formats[$langcode])) {
+    return $formats[$langcode];
+  }
+
+  return FALSE;
+}
+
+/**
+ * Saves a date format to the database.
+ *
+ * @param string $date_format_id
+ *   If set, replace the existing date format having this ID with the
+ *   information specified in $format_info.
+ * @param array $format_info
+ *   A date format array containing the following keys:
+ *   - name: The string name of the date type this format is associated with.
+ *   - pattern: An associative array keyed by 'php' and 'intl' with the PHP
+ *     and/or IntlDateFormatter date format strings for each.
+ *   - locked: A boolean indicating whether or not this format should be
+ *     configurable from the user interface.
+ *
+ * @see http://php.net/date
+ */
+function system_date_format_save($date_format_id, $format_info) {
+  config('system.date')
+    ->set('formats.' . $date_format_id, $format_info)
+    ->save();
+
+  $languages = language_list();
+
+  $locale_format = array(
+    'name' => $format_info['name'],
+    'pattern' => $format_info['pattern'],
+  );
+
+  // Check if the suggested language codes are configured.
+  if (!empty($format_info['locales'])) {
+    foreach ($format_info['locales'] as $langcode) {
+      if (isset($languages[$langcode])) {
+        config('locale.config.' . $langcode . '.system.date')
+          ->set('formats.' . $date_format_id, $locale_format)
+          ->save();
+      }
+    }
+  }
+}
+
+/**
+ * Deletes a date format from the database.
+ *
+ * @param $date_format_id
+ *   The date format ID.
+ */
+function system_date_format_delete($date_format_id) {
+  $format_id = 'formats.' . $date_format_id;
+  config('system.date')->clear($format_id)->save();
+
+  // Clean up the localized entry if required.
+  foreach (language_list() as $langcode => $data) {
+    $config = config('locale.config.' . $langcode . '.system.date');
+    if ($config->get($format_id)) {
+      $config->clear($format_id)->save();
+    }
+  }
+}
+
+/**
  * Returns HTML for a confirmation form.
  *
  * By default this does not alter the appearance of a form at all,
diff --git a/core/modules/system/system.modules.js b/core/modules/system/system.modules.js
index 4d97652..1efe863 100644
--- a/core/modules/system/system.modules.js
+++ b/core/modules/system/system.modules.js
@@ -2,6 +2,68 @@
 
 "use strict";
 
+$.extend(Drupal.settings, {
+  hideModules: {
+    method: 'toggle',
+    duration: 0
+  }
+});
+
+/**
+ * Show/hide the requirements information on modules page.
+ */
+Drupal.behaviors.hideModuleInformation = {
+  attach: function (context, settings) {
+    var $table = $('#system-modules').once('expand-modules');
+    var effect = settings.hideModules;
+    if ($table.length) {
+      var $tbodies = $table.find('tbody');
+
+      // Fancy animating.
+      $tbodies.on('click keydown', '.description', function (e) {
+        if (e.keyCode && (e.keyCode !== 13 && e.keyCode !== 32)) {
+          return;
+        }
+        e.preventDefault();
+        var $tr = $(this).closest('tr');
+        var $toggleElements = $tr.find('.requirements, .links');
+
+        $toggleElements[effect.method](effect.duration)
+          .promise().done(function() {
+            $tr.toggleClass('expanded');
+          });
+
+        // Change screen reader text.
+        $tr.find('.module-description-prefix').text(function () {
+          if ($tr.hasClass('expanded')) {
+            return Drupal.t('Hide description');
+          }
+          else {
+            return Drupal.t('Show description');
+          }
+        });
+      });
+      // Makes the whole cell a click target.
+      $tbodies.on('click', 'td.checkbox', function (e) {
+        e.stopPropagation();
+        var input = $(this).find('input').get(0);
+        if (!input.readOnly && !input.disabled) {
+          input.checked = !input.checked;
+        }
+      });
+      // Catch the event on the checkbox to avoid triggering previous handler.
+      $tbodies.on('click', 'input', function (e) {
+        e.stopPropagation();
+      });
+      // Don't close the row when clicking a link in the description.
+      $tbodies.on('click', '.description a', function (e) {
+        e.stopPropagation();
+      });
+    }
+    $table.find('.requirements, .links').hide();
+  }
+};
+
 /**
  * Filters the module list table by a text input search string.
  *
@@ -50,7 +112,7 @@ Drupal.behaviors.tableFilterByText = {
     if ($table.length) {
       $rowsAndDetails = $table.find('tr, details');
       $rows = $table.find('tbody tr');
-      $details = $rowsAndDetails.filter('.package-listing');
+      $details = $table.find('details');
 
       $input.on('keyup', filterModuleList);
     }
diff --git a/core/modules/system/system.routing.yml b/core/modules/system/system.routing.yml
index 0785e5c..1e09f79 100644
--- a/core/modules/system/system.routing.yml
+++ b/core/modules/system/system.routing.yml
@@ -74,40 +74,33 @@ system_site_maintenance_mode:
   requirements:
     _permission: 'administer site configuration'
 
-system_run_cron:
-  pattern: '/admin/reports/status/run-cron'
+date_format_add:
+  pattern: '/admin/config/regional/date-time/formats/add'
   defaults:
-    _controller: '\Drupal\system\CronController::runManually'
+    _form: '\Drupal\system\Form\DateFormatAddForm'
   requirements:
     _permission: 'administer site configuration'
 
-date_format_list:
-  pattern: '/admin/config/regional/date-time'
+date_format_edit:
+  pattern: '/admin/config/regional/date-time/formats/{date_format_id}/edit'
   defaults:
-    _entity_list: 'date_format'
+    _form: '\Drupal\system\Form\DateFormatEditForm'
   requirements:
     _permission: 'administer site configuration'
 
-date_format_add:
-  pattern: '/admin/config/regional/date-time/formats/add'
+system_run_cron:
+  pattern: '/admin/reports/status/run-cron'
   defaults:
-    _entity_form: 'date_format.add'
+    _controller: '\Drupal\system\CronController::runManually'
   requirements:
     _permission: 'administer site configuration'
 
-date_format_edit:
-  pattern: '/admin/config/regional/date-time/formats/manage/{date_format}'
-  defaults:
-    _entity_form: 'date_format.edit'
-  requirements:
-    _entity_access: 'date_format.update'
-
 date_format_delete:
-  pattern: 'admin/config/regional/date-time/formats/manage/{date_format}/delete'
+  pattern: 'admin/config/regional/date-time/formats/{format_id}/delete'
   defaults:
-    _entity_form: 'date_format.delete'
+    _form: '\Drupal\system\Form\DateFormatDeleteForm'
   requirements:
-    _entity_access: 'date_format.delete'
+    _permission: 'administer site configuration'
 
 date_format_localize_reset:
   pattern: 'admin/config/regional/date-time/locale/{langcode}/reset'
@@ -116,20 +109,6 @@ date_format_localize_reset:
   requirements:
     _permission: 'administer site configuration'
 
-system_modules_list:
-  pattern: 'admin/modules'
-  defaults:
-    _form: 'Drupal\system\Form\ModulesListForm'
-  requirements:
-    _permission: 'administer modules'
-
-system_modules_list_confirm:
-  pattern: 'admin/modules/list/confirm'
-  defaults:
-    _form: 'Drupal\system\Form\ModulesListConfirmForm'
-  requirements:
-    _permission: 'administer modules'
-
 system_theme_disable:
   pattern: '/admin/appearance/disable'
   defaults:
@@ -179,30 +158,9 @@ system_theme_settings_global:
   requirements:
     _permission: 'administer themes'
 
-system_modules_uninstall:
-  pattern: 'admin/modules/uninstall'
-  defaults:
-    _form: 'Drupal\system\Form\ModulesUninstallForm'
-  requirements:
-    _permission: 'administer modules'
-
-system_modules_uninstall_confirm:
-  pattern: 'admin/modules/uninstall/confirm'
-  defaults:
-    _form: 'Drupal\system\Form\ModulesUninstallConfirmForm'
-  requirements:
-    _permission: 'administer modules'
-
 system_timezone:
   pattern: '/system/timezone'
   defaults:
     _controller: '\Drupal\system\Controller\TimezoneController::getTimezone'
   requirements:
     _access: 'TRUE'
-
-system_plugin_autocomplete:
-  pattern: '/system/autocomplete/{plugin_id}'
-  defaults:
-    _controller: 'Drupal\system\Controller\SystemController::autocomplete'
-  requirements:
-    _access_system_plugin_ui: 'TRUE'
diff --git a/core/modules/system/system.services.yml b/core/modules/system/system.services.yml
index 3b9eac7..6aefa00 100644
--- a/core/modules/system/system.services.yml
+++ b/core/modules/system/system.services.yml
@@ -3,11 +3,6 @@ services:
     class: Drupal\system\Access\CronAccessCheck
     tags:
       - { name: access_check }
-  access_check.system_plugin_ui:
-    class: Drupal\system\Access\SystemPluginUiCheck
-    tags:
-      - { name: access_check }
-    arguments: ['@plugin.manager.system.plugin_ui']
   plugin.manager.system.plugin_ui:
     class: Drupal\system\Plugin\Type\PluginUIManager
     arguments: ['@container.namespaces']
diff --git a/core/modules/system/tests/modules/database_test/database_test.module b/core/modules/system/tests/modules/database_test/database_test.module
index 8772662..0440082 100644
--- a/core/modules/system/tests/modules/database_test/database_test.module
+++ b/core/modules/system/tests/modules/database_test/database_test.module
@@ -221,19 +221,18 @@ function database_test_theme_tablesort($form, &$form_state) {
     ->extend('Drupal\Core\Database\Query\PagerSelectExtender')
     ->extend('Drupal\Core\Database\Query\TableSortExtender');
   $query
-    ->fields('u', array('uid'))
+    ->fields('u', array('uid', 'name', 'status', 'created', 'access'))
     ->limit(50)
     ->orderByHeader($header)
     ->setCountQuery($count_query);
-  $uids = $query
-    ->execute()
-    ->fetchCol();
+  $result = $query->execute();
 
   $options = array();
 
   $status = array(t('blocked'), t('active'));
-  foreach (user_load_multiple($uids) as $account) {
-    $options[$account->id()] = array(
+  $accounts = array();
+  foreach ($result as $account) {
+    $options[$account->uid] = array(
       'username' => check_plain($account->name),
       'status' =>  $status[$account->status],
     );
diff --git a/core/modules/system/tests/modules/design_test/design_test.module b/core/modules/system/tests/modules/design_test/design_test.module
index f69f961..35b8a73 100644
--- a/core/modules/system/tests/modules/design_test/design_test.module
+++ b/core/modules/system/tests/modules/design_test/design_test.module
@@ -95,7 +95,7 @@ function design_test_menu_local_tasks_alter(&$data, $router_item, $root_path) {
   if ($router_item['number_parts'] > 2 && strpos($root_path, 'design_test/') === 0) {
     $actions = &$data['actions']['output'];
     // Determine the currently selected theme, if any.
-    $selected_theme = drupal_container()->get('request')->query->get('theme');
+    $selected_theme = Drupal::request()->query->get('theme');
     $default_theme = config('system.theme')->get('default');
 
     // Expand all enabled themes into action links.
@@ -129,5 +129,5 @@ function design_test_menu_local_tasks_alter(&$data, $router_item, $root_path) {
  * query parameter. The returned value is validated by the menu system already.
  */
 function design_test_menu_theme_callback() {
-  return drupal_container()->get('request')->query->get('theme');
+  return Drupal::request()->query->get('theme');
 }
diff --git a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestAccessController.php b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestAccessController.php
index 034caa3..c2b5594 100644
--- a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestAccessController.php
+++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestAccessController.php
@@ -27,16 +27,9 @@ protected function checkAccess(EntityInterface $entity, $operation, $langcode, A
       }
       return user_access('view test entity', $account);
     }
-    elseif (in_array($operation, array('update', 'delete'))) {
+    elseif (in_array($operation, array('create', 'update', 'delete'))) {
       return user_access('administer entity_test content', $account);
     }
   }
 
-  /**
-   * {@inheritdoc}
-   */
-  protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) {
-    return user_access('administer entity_test content', $account);
-  }
-
 }
diff --git a/core/modules/system/tests/modules/form_test/form_test.module b/core/modules/system/tests/modules/form_test/form_test.module
index cb56e2b..25ae931 100644
--- a/core/modules/system/tests/modules/form_test/form_test.module
+++ b/core/modules/system/tests/modules/form_test/form_test.module
@@ -2262,7 +2262,7 @@ function form_test_user_register_form_rebuild($form, &$form_state) {
 function form_test_two_instances() {
   global $user;
   $node1 = entity_create('node', array(
-    'uid' => $user->id(),
+    'uid' => $user->uid,
     'name' => (isset($user->name) ? $user->name : ''),
     'type' => 'page',
     'langcode' => Language::LANGCODE_NOT_SPECIFIED,
diff --git a/core/modules/system/tests/modules/menu_test/lib/Drupal/menu_test/Plugin/Menu/LocalAction/MenuTestLocalAction.php b/core/modules/system/tests/modules/menu_test/lib/Drupal/menu_test/Plugin/Menu/LocalAction/MenuTestLocalAction.php
deleted file mode 100644
index d09a8fb..0000000
--- a/core/modules/system/tests/modules/menu_test/lib/Drupal/menu_test/Plugin/Menu/LocalAction/MenuTestLocalAction.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\menu_test\Plugin\Menu\MenuTestLocalAction.
- */
-
-namespace Drupal\menu_test\Plugin\Menu\LocalAction;
-
-use Drupal\Core\Annotation\Translation;
-use Drupal\Core\Menu\LocalActionBase;
-use Drupal\Core\Annotation\Menu\LocalAction;
-
-/**
- * @LocalAction(
- *   id = "menu_test_local_action3",
- *   route_name = "menu_test_local_action3",
- *   title = @Translation("My routing action"),
- *   appears_on = {"menu_test_local_action1"}
- * )
- */
-class MenuTestLocalAction extends LocalActionBase {
-
-}
diff --git a/core/modules/system/tests/modules/menu_test/lib/Drupal/menu_test/Plugin/Menu/LocalTask/TestTasksEdit.php b/core/modules/system/tests/modules/menu_test/lib/Drupal/menu_test/Plugin/Menu/LocalTask/TestTasksEdit.php
deleted file mode 100644
index 40996c8..0000000
--- a/core/modules/system/tests/modules/menu_test/lib/Drupal/menu_test/Plugin/Menu/LocalTask/TestTasksEdit.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\menu_test\Plugin\Menu\LocalTask\TestTasksEdit.
- */
-
-namespace Drupal\menu_test\Plugin\Menu\LocalTask;
-
-use Drupal\Core\Annotation\Menu\LocalTask;
-use Drupal\Core\Menu\LocalTaskBase;
-use Drupal\Core\Annotation\Translation;
-
-/**
- * @LocalTask(
- *   id = "menu_local_task_test_tasks_edit",
- *   route_name = "menu_local_task_test_tasks_edit",
- *   title = @Translation("Edit"),
- *   tab_root_id = "menu_local_task_test_tasks_view",
- *   weight = "10"
- * )
- */
-class TestTasksEdit extends LocalTaskBase {
-
-}
diff --git a/core/modules/system/tests/modules/menu_test/lib/Drupal/menu_test/Plugin/Menu/LocalTask/TestTasksSettings.php b/core/modules/system/tests/modules/menu_test/lib/Drupal/menu_test/Plugin/Menu/LocalTask/TestTasksSettings.php
deleted file mode 100644
index 67b2f65..0000000
--- a/core/modules/system/tests/modules/menu_test/lib/Drupal/menu_test/Plugin/Menu/LocalTask/TestTasksSettings.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\menu_test\Plugin\Menu\LocalTask\TestTasksSettings.
- */
-
-namespace Drupal\menu_test\Plugin\Menu\LocalTask;
-
-use Drupal\Core\Annotation\Menu\LocalTask;
-use Drupal\Core\Menu\LocalTaskBase;
-use Drupal\Core\Annotation\Translation;
-
-/**
- * @LocalTask(
- *   id = "menu_local_task_test_tasks_settings",
- *   route_name = "menu_local_task_test_tasks_settings",
- *   title = @Translation("Settings"),
- *   tab_root_id = "menu_local_task_test_tasks_view"
- * )
- */
-class TestTasksSettings extends LocalTaskBase {
-
-}
diff --git a/core/modules/system/tests/modules/menu_test/lib/Drupal/menu_test/Plugin/Menu/LocalTask/TestTasksSettingsSub1.php b/core/modules/system/tests/modules/menu_test/lib/Drupal/menu_test/Plugin/Menu/LocalTask/TestTasksSettingsSub1.php
deleted file mode 100644
index 2b0729a..0000000
--- a/core/modules/system/tests/modules/menu_test/lib/Drupal/menu_test/Plugin/Menu/LocalTask/TestTasksSettingsSub1.php
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\menu_test\Plugin\Menu\LocalTask\TestTasksSettingsSub1.
- */
-
-namespace Drupal\menu_test\Plugin\Menu\LocalTask;
-
-use Drupal\Core\Annotation\Menu\LocalTask;
-use Drupal\Core\Menu\LocalTaskBase;
-use Drupal\Core\Annotation\Translation;
-
-/**
- * @LocalTask(
- *   id = "menu_local_task_test_tasks_settings_sub1",
- *   route_name = "menu_local_task_test_tasks_settings_sub1",
- *   title = @Translation("sub1"),
- *   tab_root_id = "menu_local_task_test_tasks_view",
- *   tab_parent_id = "menu_local_task_test_tasks_settings",
- *   weight = "-10"
- * )
- */
-class TestTasksSettingsSub1 extends LocalTaskBase {
-
-}
diff --git a/core/modules/system/tests/modules/menu_test/lib/Drupal/menu_test/Plugin/Menu/LocalTask/TestTasksSettingsSub2.php b/core/modules/system/tests/modules/menu_test/lib/Drupal/menu_test/Plugin/Menu/LocalTask/TestTasksSettingsSub2.php
deleted file mode 100644
index f3cedfe..0000000
--- a/core/modules/system/tests/modules/menu_test/lib/Drupal/menu_test/Plugin/Menu/LocalTask/TestTasksSettingsSub2.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\menu_test\Plugin\Menu\LocalTask\TestTasksSettingsSub2.
- */
-
-namespace Drupal\menu_test\Plugin\Menu\LocalTask;
-
-use Drupal\Core\Annotation\Menu\LocalTask;
-use Drupal\Core\Menu\LocalTaskBase;
-use Drupal\Core\Annotation\Translation;
-
-/**
- * @LocalTask(
- *   id = "menu_local_task_test_tasks_settings_sub2",
- *   route_name = "menu_local_task_test_tasks_settings_sub2",
- *   title = @Translation("sub2"),
- *   tab_root_id = "menu_local_task_test_tasks_view",
- *   tab_parent_id = "menu_local_task_test_tasks_settings"
- * )
- */
-class TestTasksSettingsSub2 extends LocalTaskBase {
-
-}
diff --git a/core/modules/system/tests/modules/menu_test/lib/Drupal/menu_test/Plugin/Menu/LocalTask/TestTasksView.php b/core/modules/system/tests/modules/menu_test/lib/Drupal/menu_test/Plugin/Menu/LocalTask/TestTasksView.php
deleted file mode 100644
index 76bf0a3..0000000
--- a/core/modules/system/tests/modules/menu_test/lib/Drupal/menu_test/Plugin/Menu/LocalTask/TestTasksView.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\menu_test\Plugin\Menu\LocalTask\TestTasksView.
- */
-
-namespace Drupal\menu_test\Plugin\Menu\LocalTask;
-
-use Drupal\Core\Menu\LocalTaskBase;
-use Drupal\Core\Annotation\Menu\LocalTask;
-use Drupal\Core\Annotation\Translation;
-
-/**
- * @LocalTask(
- *   id = "menu_local_task_test_tasks_view",
- *   route_name = "menu_local_task_test_tasks_view",
- *   title = @Translation("View"),
- *   tab_root_id = "menu_local_task_test_tasks_view"
- * )
- */
-class TestTasksView extends LocalTaskBase {
-
-}
diff --git a/core/modules/system/tests/modules/menu_test/lib/Drupal/menu_test/TestControllers.php b/core/modules/system/tests/modules/menu_test/lib/Drupal/menu_test/TestControllers.php
index 48c2da3..34d42f4 100644
--- a/core/modules/system/tests/modules/menu_test/lib/Drupal/menu_test/TestControllers.php
+++ b/core/modules/system/tests/modules/menu_test/lib/Drupal/menu_test/TestControllers.php
@@ -15,13 +15,6 @@
 class TestControllers {
 
   /**
-   * Returns page to be used as a login path.
-   */
-  public function testLogin() {
-    return 'This is TestControllers::testLogin.';
-  }
-
-  /**
    * Prints out test data.
    */
   public function test1() {
diff --git a/core/modules/system/tests/modules/menu_test/menu_test.module b/core/modules/system/tests/modules/menu_test/menu_test.module
index eb43fdf..f8792cc 100644
--- a/core/modules/system/tests/modules/menu_test/menu_test.module
+++ b/core/modules/system/tests/modules/menu_test/menu_test.module
@@ -311,6 +311,13 @@ function menu_test_menu() {
     'access arguments' => array('access content'),
   );
 
+  // Test the access key with a function callback.
+  $items['menu_login_callback'] = array(
+    'title' => 'Used as a login path',
+    'page callback' => 'menu_login_callback',
+    'access callback' => TRUE,
+  );
+
   // Test the access key.
   $items['menu-title-test/case1'] = array(
    'title' => 'Example title - Case 1',
@@ -434,11 +441,6 @@ function menu_test_menu() {
     'type' => MENU_LOCAL_ACTION,
   );
 
-  $items['menu-local-task-test/tasks'] = array(
-    'title' => 'Local tasks',
-    'route_name' => 'menu_local_task_test_tasks',
-  );
-
   return $items;
 }
 
@@ -450,6 +452,21 @@ function menu_test_local_action_dynamic_title($arg) {
 }
 
 /**
+ * Implements hook_local_actions().
+ */
+function menu_test_local_actions() {
+  return array(
+    array(
+      'route_name' => 'menu_test_local_action3',
+      'title' => t('My routing action'),
+      'appears_on' => array(
+        'menu_test_local_action1',
+      ),
+    ),
+  );
+}
+
+/**
  * Implements hook_menu_local_tasks().
  *
  * If the menu_test.settings configuration 'tasks.add' has been set, adds
@@ -720,6 +737,18 @@ function menu_test_static_variable($value = NULL) {
 }
 
 /**
+ * Page callback: Provides a login path.
+ *
+ * @return string
+ *   A text string that can be used for comparison.
+ *
+ * @see menu_test_menu().
+ */
+function menu_login_callback() {
+  return 'This is menu_login_callback().';
+}
+
+/**
  * Title callback: Concatenates the title and case number.
  *
  * @param string $title
diff --git a/core/modules/system/tests/modules/menu_test/menu_test.routing.yml b/core/modules/system/tests/modules/menu_test/menu_test.routing.yml
index 4eee7ed..3154626 100644
--- a/core/modules/system/tests/modules/menu_test/menu_test.routing.yml
+++ b/core/modules/system/tests/modules/menu_test/menu_test.routing.yml
@@ -1,9 +1,3 @@
-menu_login_callback:
-  pattern: '/menu_login_callback'
-  defaults:
-    _content: '\Drupal\menu_test\TestControllers::testLogin'
-  requirements:
-    _access: 'TRUE'
 menu_router_test1:
   pattern: '/foo/{bar}'
   defaults:
@@ -50,52 +44,3 @@ menu_test_local_action4:
     _content: '\Drupal\menu_test\TestControllers::test2'
   requirements:
     _access: 'TRUE'
-
-menu_local_task_test_tasks:
-  pattern: '/menu-local-task-test/tasks'
-  defaults:
-    _content: '\Drupal\menu_test\TestControllers::test1'
-  requirements:
-    _access: 'TRUE'
-
-menu_local_task_test_tasks_tasks:
-  pattern: '/menu-local-task-test/tasks/tasks'
-  defaults:
-    _content: '\Drupal\menu_test\TestControllers::test1'
-  requirements:
-    _access: 'TRUE'
-
-menu_local_task_test_tasks_view:
-  pattern: '/menu-local-task-test/tasks/view'
-  defaults:
-    _content: '\Drupal\menu_test\TestControllers::test1'
-  requirements:
-    _access: 'TRUE'
-
-menu_local_task_test_tasks_edit:
-  pattern: '/menu-local-task-test/tasks/edit'
-  defaults:
-    _content: '\Drupal\menu_test\TestControllers::test1'
-  requirements:
-    _access: 'TRUE'
-
-menu_local_task_test_tasks_settings:
-  pattern: '/menu-local-task-test/tasks/settings'
-  defaults:
-    _content: '\Drupal\menu_test\TestControllers::test1'
-  requirements:
-    _access: 'TRUE'
-
-menu_local_task_test_tasks_settings_sub1:
-  pattern: '/menu-local-task-test/tasks/settings/sub1'
-  defaults:
-    _content: '\Drupal\menu_test\TestControllers::test1'
-  requirements:
-    _access: 'TRUE'
-
-menu_local_task_test_tasks_settings_sub2:
-  pattern: '/menu-local-task-test/tasks/settings/sub2'
-  defaults:
-    _content: '\Drupal\menu_test\TestControllers::test1'
-  requirements:
-    _access: 'TRUE'
diff --git a/core/modules/system/tests/modules/plugin_test/lib/Drupal/plugin_test/Plugin/plugin_test/fruit/NonAnnotatedClass.php b/core/modules/system/tests/modules/plugin_test/lib/Drupal/plugin_test/Plugin/plugin_test/fruit/NonAnnotatedClass.php
deleted file mode 100644
index c4fa863..0000000
--- a/core/modules/system/tests/modules/plugin_test/lib/Drupal/plugin_test/Plugin/plugin_test/fruit/NonAnnotatedClass.php
+++ /dev/null
@@ -1,10 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\plugin_test\Plugin\plugin_test\fruit\NonAnnotatedClass.
- */
-
-namespace Drupal\plugin_test\Plugin\plugin_test\fruit;
-
-class NonAnnotatedClass {}
diff --git a/core/modules/system/tests/modules/theme_test/lib/Drupal/theme_test/ThemeTestController.php b/core/modules/system/tests/modules/theme_test/lib/Drupal/theme_test/ThemeTestController.php
deleted file mode 100644
index c790a84..0000000
--- a/core/modules/system/tests/modules/theme_test/lib/Drupal/theme_test/ThemeTestController.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\theme_test\ThemeTestController.
- */
-
-namespace Drupal\theme_test;
-
-use Drupal\Core\Controller\ControllerInterface;
-use Symfony\Component\DependencyInjection\ContainerInterface;
-
-/**
- * Controller routines for theme test routes.
- */
-class ThemeTestController implements ControllerInterface {
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function create(ContainerInterface $container) {
-    return new static();
-  }
-
-  /**
-   * Menu callback for testing that a theme template overrides a theme function.
-   */
-  function functionTemplateOverridden() {
-    return array(
-      '#theme' => 'theme_test_function_template_override',
-    );
-  }
-
-}
diff --git a/core/modules/system/tests/modules/theme_test/theme_test.module b/core/modules/system/tests/modules/theme_test/theme_test.module
index 51cb6d3..ca8439d 100644
--- a/core/modules/system/tests/modules/theme_test/theme_test.module
+++ b/core/modules/system/tests/modules/theme_test/theme_test.module
@@ -24,9 +24,6 @@ function theme_test_theme($existing, $type, $theme, $path) {
   $items['theme_test_render_element_children'] = array(
     'render element' => 'element',
   );
-  $items['theme_test_function_template_override'] = array(
-    'variables' => array(),
-  );
   return $items;
 }
 
@@ -74,10 +71,6 @@ function theme_test_menu() {
     'access callback' => TRUE,
     'type' => MENU_CALLBACK,
   );
-  $items['theme-test/function-template-overridden'] = array(
-    'theme callback' => '_theme_custom_theme',
-    'route_name' => 'function_template_override',
-  );
   return $items;
 }
 
@@ -155,11 +148,6 @@ function _theme_test_suggestion() {
 function theme_test_preprocess_html(&$variables) {
   $variables['html_attributes']['theme_test_html_attribute'] = 'theme test html attribute value';
   $variables['attributes']['theme_test_body_attribute'] = 'theme test body attribute value';
-
-  // Check that the page variable is not flattened yet.
-  if (is_array($variables['page'])) {
-    $variables['attributes']['theme_test_page_variable'] = 'Page variable is an array.';
-  }
 }
 
 /**
@@ -170,13 +158,6 @@ function theme_theme_test_foo($variables) {
 }
 
 /**
- * Theme function for testing theme('theme_test_function_template_override').
- */
-function theme_theme_test_function_template_override($variables) {
-  return 'theme_test_function_template_override test failed.';
-}
-
-/**
  * Process variables for theme-test-render-element.tpl.php.
  */
 function template_preprocess_theme_test_render_element(&$variables) {
diff --git a/core/modules/system/tests/modules/theme_test/theme_test.routing.yml b/core/modules/system/tests/modules/theme_test/theme_test.routing.yml
deleted file mode 100644
index 866171e..0000000
--- a/core/modules/system/tests/modules/theme_test/theme_test.routing.yml
+++ /dev/null
@@ -1,6 +0,0 @@
-function_template_override:
-  pattern: '/theme-test/function-template-overridden'
-  defaults:
-    _content: '\Drupal\theme_test\ThemeTestController::functionTemplateOverridden'
-  requirements:
-    _permission: 'access content'
diff --git a/core/modules/system/tests/modules/url_alter_test/lib/Drupal/url_alter_test/PathProcessor.php b/core/modules/system/tests/modules/url_alter_test/lib/Drupal/url_alter_test/PathProcessor.php
index 1632d5e..b3611be 100644
--- a/core/modules/system/tests/modules/url_alter_test/lib/Drupal/url_alter_test/PathProcessor.php
+++ b/core/modules/system/tests/modules/url_alter_test/lib/Drupal/url_alter_test/PathProcessor.php
@@ -22,7 +22,7 @@ public function processInbound($path, Request $request) {
     if (preg_match('!^user/([^/]+)(/.*)?!', $path, $matches)) {
       if ($account = user_load_by_name($matches[1])) {
         $matches += array(2 => '');
-        $path = 'user/' . $account->id() . $matches[2];
+        $path = 'user/' . $account->uid . $matches[2];
       }
     }
 
diff --git a/core/modules/system/tests/modules/url_alter_test/lib/Drupal/url_alter_test/PathProcessorTest.php b/core/modules/system/tests/modules/url_alter_test/lib/Drupal/url_alter_test/PathProcessorTest.php
index a27c65c..e649f6d 100644
--- a/core/modules/system/tests/modules/url_alter_test/lib/Drupal/url_alter_test/PathProcessorTest.php
+++ b/core/modules/system/tests/modules/url_alter_test/lib/Drupal/url_alter_test/PathProcessorTest.php
@@ -24,7 +24,7 @@ public function processInbound($path, Request $request) {
     if (preg_match('!^user/([^/]+)(/.*)?!', $path, $matches)) {
       if ($account = user_load_by_name($matches[1])) {
         $matches += array(2 => '');
-        $path = 'user/' . $account->id() . $matches[2];
+        $path = 'user/' . $account->uid . $matches[2];
       }
     }
 
diff --git a/core/modules/system/tests/themes/test_theme/theme-test-function-template-override.html.twig b/core/modules/system/tests/themes/test_theme/theme-test-function-template-override.html.twig
deleted file mode 100644
index 15f90eb..0000000
--- a/core/modules/system/tests/themes/test_theme/theme-test-function-template-override.html.twig
+++ /dev/null
@@ -1,2 +0,0 @@
-{# Output for Theme API test #}
-Success: Template overrides theme function.
diff --git a/core/modules/taxonomy/config/entity.view_mode.taxonomy_vocabulary.full.yml b/core/modules/taxonomy/config/entity.view_mode.taxonomy_vocabulary.full.yml
new file mode 100644
index 0000000..bb47091
--- /dev/null
+++ b/core/modules/taxonomy/config/entity.view_mode.taxonomy_vocabulary.full.yml
@@ -0,0 +1,4 @@
+id: vocabulary.full
+label: Taxonomy vocabulary
+status: '0'
+targetEntityType: taxonomy_vocabulary
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Access/TaxonomyTermCreateAccess.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Access/TaxonomyTermCreateAccess.php
deleted file mode 100644
index b6305e6..0000000
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Access/TaxonomyTermCreateAccess.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\taxonomy\Access\TaxonomyTermCreateAccess.
- */
-
-namespace Drupal\taxonomy\Access;
-
-use Drupal\Core\Entity\EntityCreateAccessCheck;
-use Symfony\Component\HttpFoundation\Request;
-use Symfony\Component\Routing\Route;
-
-/**
- * Provides an access check for taxonomy term creation.
- */
-class TaxonomyTermCreateAccess extends EntityCreateAccessCheck {
-
-  /**
-   * {@inheritdoc}
-   */
-  protected $requirementsKey = '_access_taxonomy_term_create';
-
-  /**
-   * {@inheritdoc}
-   */
-  public function access(Route $route, Request $request) {
-    $entity_type = $route->getRequirement($this->requirementsKey);
-    if ($vocabulary = $request->attributes->get('taxonomy_vocabulary')) {
-      return $this->entityManager->getAccessController($entity_type)->createAccess($vocabulary->id());
-    }
-    return parent::access($route, $request);
-  }
-
-}
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Controller/TaxonomyController.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Controller/TaxonomyController.php
deleted file mode 100644
index 74c3d12..0000000
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Controller/TaxonomyController.php
+++ /dev/null
@@ -1,88 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\taxonomy\Controller\TaxonomyController.
- */
-
-namespace Drupal\taxonomy\Controller;
-
-use Drupal\Core\Controller\ControllerInterface;
-use Drupal\Core\Entity\EntityManager;
-use Drupal\Core\Extension\ModuleHandlerInterface;
-use Drupal\taxonomy\TermStorageControllerInterface;
-use Drupal\taxonomy\VocabularyInterface;
-use Symfony\Component\DependencyInjection\ContainerInterface;
-
-/**
- * Provides route responses for taxonomy.module.
- */
-class TaxonomyController implements ControllerInterface {
-
-  /**
-   * The module handler.
-   *
-   * @var \Drupal\Core\Extension\ModuleHandlerInterface
-   */
-  protected $moduleHandler;
-
-  /**
-   * The entity manager.
-   *
-   * @var \Drupal\Core\Entity\EntityManager
-   */
-  protected $entityManager;
-
-  /**
-   * The taxonomy term storage.
-   *
-   * @var \Drupal\taxonomy\TermStorageControllerInterface
-   */
-  protected $termStorage;
-
-  /**
-   * Constructs a new TaxonomyController.
-   *
-   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
-   *   The module handler.
-   * @param \Drupal\Core\Entity\EntityManager $entity_manager
-   *   The entity manager.
-   * @param \Drupal\taxonomy\TermStorageControllerInterface $term_storage
-   *   The taxonomy term storage.
-   */
-  public function __construct(ModuleHandlerInterface $module_handler, EntityManager $entity_manager, TermStorageControllerInterface $term_storage) {
-    $this->moduleHandler = $module_handler;
-    $this->entityManager = $entity_manager;
-    $this->termStorage = $term_storage;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function create(ContainerInterface $container) {
-    $entity_manager = $container->get('plugin.manager.entity');
-    return new static(
-      $container->get('module_handler'),
-      $entity_manager,
-      $entity_manager->getStorageController('taxonomy_term')
-    );
-  }
-
-  /**
-   * Returns a rendered edit form to create a new term associated to the given vocabulary.
-   *
-   * @param \Drupal\taxonomy\VocabularyInterface $taxonomy_vocabulary
-   *   The vocabulary this term will be added to.
-   *
-   * @return array
-   *   The taxonomy term add form.
-   */
-  public function addForm(VocabularyInterface $taxonomy_vocabulary) {
-    $term = $this->termStorage->create(array('vid' => $taxonomy_vocabulary->id()));
-    if ($this->moduleHandler->moduleExists('language')) {
-      $term->langcode = language_get_default_langcode('taxonomy_term', $taxonomy_vocabulary->id());
-    }
-    return $this->entityManager->getForm($term);
-  }
-
-}
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/entity_reference/selection/TermSelection.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/entity_reference/selection/TermSelection.php
index e15fbbf..35b04a0 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/entity_reference/selection/TermSelection.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/entity_reference/selection/TermSelection.php
@@ -7,16 +7,17 @@
 
 namespace Drupal\taxonomy\Plugin\entity_reference\selection;
 
+use Drupal\Component\Annotation\Plugin;
 use Drupal\Core\Annotation\Translation;
 use Drupal\Core\Database\Query\SelectInterface;
-use Drupal\entity_reference\Annotation\EntityReferenceSelection;
 use Drupal\entity_reference\Plugin\entity_reference\selection\SelectionBase;
 
 /**
  * Provides specific access control for the taxonomy_term entity type.
  *
- * @EntityReferenceSelection(
+ * @Plugin(
  *   id = "taxonomy_term_default",
+ *   module = "taxonomy",
  *   label = @Translation("Taxonomy Term selection"),
  *   entity_types = {"taxonomy_term"},
  *   group = "default",
@@ -26,14 +27,14 @@
 class TermSelection extends SelectionBase {
 
   /**
-   * {@inheritdoc}
+   * Overrides SelectionBase::entityQueryAlter().
    */
   public function entityQueryAlter(SelectInterface $query) {
     // @todo: How to set access, as vocabulary is now config?
   }
 
   /**
-   * {@inheritdoc}
+   * Overrides SelectionBase::settingsForm().
    */
   public static function settingsForm(&$field, &$instance) {
     $form = parent::settingsForm($field, $instance);
@@ -48,8 +49,9 @@ public static function settingsForm(&$field, &$instance) {
 
   }
 
+
   /**
-   * {@inheritdoc}
+   * Overrides SelectionBase::getReferenceableEntities().
    */
   public function getReferenceableEntities($match = NULL, $match_operator = 'CONTAINS', $limit = 0) {
     if ($match || $limit) {
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/field/LinkEdit.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/field/LinkEdit.php
index 00d6c71..7034aee 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/field/LinkEdit.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/field/LinkEdit.php
@@ -53,7 +53,7 @@ public function query() {
     $this->addAdditionalFields();
   }
 
-  public function render($values) {
+  function render($values) {
     // Check there is an actual value, as on a relationship there may not be.
     if ($tid = $this->getValue($values, 'tid')) {
       // Mock a term object for taxonomy_term_access(). Use machine name and
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/field/Taxonomy.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/field/Taxonomy.php
index 65106d0..793c8de 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/field/Taxonomy.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/field/Taxonomy.php
@@ -87,7 +87,7 @@ function render_link($data, $values) {
     return $data;
   }
 
-  public function render($values) {
+  function render($values) {
     $value = $this->getValue($values);
     return $this->render_link($this->sanitizeValue($value), $values);
   }
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/filter/TaxonomyIndexTid.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/filter/TaxonomyIndexTid.php
index 9ef575f..ef6101a 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/filter/TaxonomyIndexTid.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/filter/TaxonomyIndexTid.php
@@ -137,7 +137,7 @@ protected function valueForm(&$form, &$form_state) {
 
         if ($tree) {
           foreach ($tree as $term) {
-            $choice = new \stdClass();
+            $choice = new stdClass();
             $choice->option = array($term->tid => str_repeat('-', $term->depth) . $term->name);
             $options[] = $choice;
           }
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/wizard/TaxonomyTerm.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/wizard/TaxonomyTerm.php
index 770fee1..e33c11d 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/wizard/TaxonomyTerm.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/wizard/TaxonomyTerm.php
@@ -53,7 +53,6 @@ protected function defaultDisplayOptions() {
     $display_options['fields']['name']['id'] = 'name';
     $display_options['fields']['name']['table'] = 'taxonomy_term_data';
     $display_options['fields']['name']['field'] = 'name';
-    $display_options['fields']['name']['provider'] = 'taxonomy';
     $display_options['fields']['name']['label'] = '';
     $display_options['fields']['name']['alter']['alter_text'] = 0;
     $display_options['fields']['name']['alter']['make_link'] = 0;
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/TermAccessController.php b/core/modules/taxonomy/lib/Drupal/taxonomy/TermAccessController.php
index d945ef5..d562e84 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/TermAccessController.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/TermAccessController.php
@@ -27,6 +27,10 @@ protected function checkAccess(EntityInterface $entity, $operation, $langcode, A
         return user_access('access content', $account);
         break;
 
+      case 'create':
+        return user_access('administer taxonomy', $account);
+        break;
+
       case 'update':
         return user_access("edit terms in {$entity->bundle()}", $account) || user_access('administer taxonomy', $account);
         break;
@@ -37,11 +41,4 @@ protected function checkAccess(EntityInterface $entity, $operation, $langcode, A
     }
   }
 
-  /**
-   * {@inheritdoc}
-   */
-  protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) {
-    return user_access('administer taxonomy', $account);
-  }
-
 }
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyTermIndentationTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyTermIndentationTest.php
deleted file mode 100644
index 59970c4..0000000
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyTermIndentationTest.php
+++ /dev/null
@@ -1,60 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\taxonomy\Tests\TaxonomyTermIndentationTest.
- */
-
-namespace Drupal\taxonomy\Tests;
-
-/**
- * Testing term indentation functionality in term list page.
- */
-class TaxonomyTermIndentationTest extends TaxonomyTestBase {
-
-  /**
-   * Modules to enable.
-   *
-   * @var array
-   */
-  public static $modules = array('taxonomy');
-
-  public static function getInfo() {
-    return array(
-      'name' => 'Taxonomy term indentation',
-      'description' => 'Ensure that the term indentation works properly.',
-      'group' => 'Taxonomy',
-    );
-  }
-
-  public function setUp() {
-    parent::setUp();
-    $this->admin_user = $this->drupalCreateUser(array('administer taxonomy', 'bypass node access'));
-    $this->drupalLogin($this->admin_user);
-    $this->vocabulary = $this->createVocabulary();
-  }
-
-  /**
-   * Tests term indentation.
-   */
-  function testTermIndentation() {
-    // Create three taxonomy terms.
-    $term1 = $this->createTerm($this->vocabulary);
-    $term2 = $this->createTerm($this->vocabulary);
-    $term3 = $this->createTerm($this->vocabulary);
-
-    // Indent the second term under the first one.
-    $edit = array(
-      'terms[tid:' . $term2->id() . ':0][term][tid]' => 2,
-      'terms[tid:' . $term2->id() . ':0][term][parent]' => 1,
-      'terms[tid:' . $term2->id() . ':0][term][depth]' => 1,
-      'terms[tid:' . $term2->id() . ':0][weight]' => 1,
-    );
-
-    // Submit the edited form and check for HTML indentation element presence.
-    $this->drupalPost('admin/structure/taxonomy/manage/' . $this->vocabulary->get('vid'), $edit, t('Save'));
-    $this->assertPattern('|<div class="indentation">&nbsp;</div>|');
-  }
-
-}
-
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermLanguageTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermLanguageTest.php
index 1c1a23f..ba53d03 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermLanguageTest.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermLanguageTest.php
@@ -67,7 +67,7 @@ function testTermLanguage() {
 
     // Check if on the edit page the language is correct.
     $this->drupalGet('taxonomy/term/' . $term->id() . '/edit');
-    $this->assertOptionSelected('edit-langcode', $edit['langcode'], 'The term language was correctly selected.');
+    $this->assertOptionSelected('edit-langcode', $edit['langcode'], t('The term language was correctly selected.'));
 
     // Change the language of the term.
     $edit['langcode'] = 'bb';
@@ -75,7 +75,7 @@ function testTermLanguage() {
 
     // Check again that on the edit page the language is correct.
     $this->drupalGet('taxonomy/term/' . $term->id() . '/edit');
-    $this->assertOptionSelected('edit-langcode', $edit['langcode'], 'The term language was correctly selected.');
+    $this->assertOptionSelected('edit-langcode', $edit['langcode'], t('The term language was correctly selected.'));
   }
 
   function testDefaultTermLanguage() {
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/Views/TaxonomyIndexTidUiTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/Views/TaxonomyIndexTidUiTest.php
deleted file mode 100644
index 1075d7b..0000000
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/Views/TaxonomyIndexTidUiTest.php
+++ /dev/null
@@ -1,98 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\taxonomy\Tests\Views\TaxonomyIndexTidUiTest.
- */
-
-namespace Drupal\taxonomy\Tests\Views;
-
-use Drupal\views\Tests\ViewTestData;
-use Drupal\views_ui\Tests\UITestBase;
-
-/**
- * Tests the taxonomy index filter handler UI.
- *
- * @see \Drupal\taxonomy\Plugin\views\field\TaxonomyIndexTid
- */
-class TaxonomyIndexTidUiTest extends UITestBase {
-
-  /**
-   * Views used by this test.
-   *
-   * @var array
-   */
-  public static $testViews = array('test_filter_taxonomy_index_tid');
-
-  /**
-   * Modules to enable.
-   *
-   * @var array
-   */
-  public static $modules = array('node', 'taxonomy', 'taxonomy_test_views');
-
-  public static function getInfo() {
-    return array(
-      'name' => 'Taxonomy: node index Filter (UI)',
-      'description' => 'Tests the taxonomy index filter handler UI.',
-      'group' => 'Views module integration',
-    );
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  protected function setUp() {
-    parent::setUp();
-
-    ViewTestData::importTestViews(get_class($this), array('taxonomy_test_views'));
-  }
-
-  /**
-   * Tests the filter UI.
-   */
-  public function testFilterUI() {
-    entity_create('taxonomy_vocabulary', array(
-      'vid' => 'tags',
-      'name' => 'Tags',
-    ))->save();
-
-    $terms = array();
-    // Setup a hierarchy which looks like this:
-    // term 0.0
-    // term 1.0
-    // - term 1.1
-    // term 2.0
-    // - term 2.1
-    // - term 2.2
-    for ($i = 0; $i < 3; $i++) {
-      for ($j = 0; $j <= $i; $j++) {
-        $terms[$i][$j] = $term = entity_create('taxonomy_term', array(
-          'vid' => 'tags',
-          'name' => "Term $i.$j",
-          'parent' => isset($terms[$i][0]) ? $terms[$i][0]->id() : 0,
-        ));
-        $term->save();
-      }
-    }
-
-    $this->drupalGet('admin/structure/views/nojs/config-item/test_filter_taxonomy_index_tid/default/filter/tid');
-
-    $result = $this->xpath('//select[@id="edit-options-value"]/option');
-
-    // Ensure that the expected hierarchy is available in the UI.
-    $counter = 0;
-    for ($i = 0; $i < 3; $i++) {
-      for ($j = 0; $j <= $i; $j++) {
-        $option = $result[$counter++];
-        $prefix = $terms[$i][$j]->parent->value ? '-' : '';
-        $attributes = $option->attributes();
-        $tid = (string) $attributes->value;
-
-        $this->assertEqual($prefix . $terms[$i][$j]->label(), (string) $option);
-        $this->assertEqual($terms[$i][$j]->id(), $tid);
-      }
-    }
-  }
-
-}
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyTest.php
index 124c76e..efc49c8 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyTest.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyTest.php
@@ -150,6 +150,6 @@ function testTaxonomyAdminDeletingVocabulary() {
     $this->drupalPost(NULL, NULL, t('Delete'));
     $this->assertRaw(t('Deleted vocabulary %name.', array('%name' => $vocabulary->name)), 'Vocabulary deleted.');
     $this->container->get('plugin.manager.entity')->getStorageController('taxonomy_vocabulary')->resetCache();
-    $this->assertFalse(taxonomy_vocabulary_load($vid), 'Vocabulary not found.');
+    $this->assertFalse(taxonomy_vocabulary_load($vid), t('Vocabulary not found.'));
   }
 }
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyAccessController.php b/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyAccessController.php
index ac5ebe9..0750593 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyAccessController.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyAccessController.php
@@ -25,11 +25,4 @@ protected function checkAccess(EntityInterface $entity, $operation, $langcode, A
     return user_access('administer taxonomy', $account);
   }
 
-  /**
-   * {@inheritdoc}
-   */
-  protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) {
-    return user_access('administer taxonomy', $account);
-  }
-
 }
diff --git a/core/modules/taxonomy/taxonomy.admin.inc b/core/modules/taxonomy/taxonomy.admin.inc
index 4161f5a..7db05ef 100644
--- a/core/modules/taxonomy/taxonomy.admin.inc
+++ b/core/modules/taxonomy/taxonomy.admin.inc
@@ -159,15 +159,8 @@ function taxonomy_overview_terms($form, &$form_state, Vocabulary $vocabulary) {
   );
   foreach ($current_page as $key => $term) {
     $form['terms'][$key]['#term'] = $term;
-    $indentation = array();
-    if (isset($term->depth) && $term->depth > 0) {
-      $indentation = array(
-        '#theme' => 'indentation',
-        '#size' => $term->depth,
-      );
-    }
     $form['terms'][$key]['term'] = array(
-      '#prefix' => !empty($indentation) ? drupal_render($indentation) : '',
+      '#prefix' => isset($term->depth->value) && $term->depth->value > 0 ? theme('indentation', array('size' => $term->depth->value)) : '',
       '#type' => 'link',
       '#title' => $term->label(),
       '#href' => "taxonomy/term/" . $term->id(),
@@ -398,6 +391,17 @@ function taxonomy_overview_terms_submit($form, &$form_state) {
 }
 
 /**
+ * Returns a rendered edit form to create a new term associated to the given vocabulary.
+ */
+function taxonomy_term_add($vocabulary) {
+  $term = entity_create('taxonomy_term', array('vid' => $vocabulary->id()));
+  if (module_exists('language')) {
+    $term->langcode = language_get_default_langcode('taxonomy_term', $vocabulary->id());
+  }
+  return Drupal::entityManager()->getForm($term);
+}
+
+/**
  * Form builder for the term delete form.
  *
  * @ingroup forms
diff --git a/core/modules/taxonomy/taxonomy.module b/core/modules/taxonomy/taxonomy.module
index 402a8e6..d4fd3d7 100644
--- a/core/modules/taxonomy/taxonomy.module
+++ b/core/modules/taxonomy/taxonomy.module
@@ -329,14 +329,31 @@ function taxonomy_menu() {
 
   $items['admin/structure/taxonomy/manage/%taxonomy_vocabulary/add'] = array(
     'title' => 'Add term',
-    'route_name' => 'taxonomy_term_add',
+    'page callback' => 'taxonomy_term_add',
+    'page arguments' => array(4),
+    'access callback' => 'taxonomy_term_create_access',
+    'access arguments' => array(4),
     'type' => MENU_LOCAL_ACTION,
+    'file' => 'taxonomy.admin.inc',
   );
 
   return $items;
 }
 
 /**
+ * Access callback for creating a new taxonomy term.
+ *
+ * @param \Drupal\taxonomy\Plugin\Core\Entity\Vocabulary $vocabulary
+ *   The vocabulary entity that represents the term bundle.
+ *
+ * @return bool
+ *   TRUE if access is allowed, FALSE if not.
+ */
+function taxonomy_term_create_access(Vocabulary $vocabulary) {
+  return entity_page_create_access('taxonomy_term', $vocabulary->id());
+}
+
+/**
  * Implements hook_admin_paths().
  */
 function taxonomy_admin_paths() {
diff --git a/core/modules/taxonomy/taxonomy.routing.yml b/core/modules/taxonomy/taxonomy.routing.yml
index 389ca7c..8715476 100644
--- a/core/modules/taxonomy/taxonomy.routing.yml
+++ b/core/modules/taxonomy/taxonomy.routing.yml
@@ -4,10 +4,3 @@ taxonomy_vocabulary_list:
     _entity_list: 'taxonomy_vocabulary'
   requirements:
     _permission: 'administer taxonomy'
-
-taxonomy_term_add:
-  pattern: '/admin/structure/taxonomy/manage/{taxonomy_vocabulary}/add'
-  defaults:
-    _content: '\Drupal\taxonomy\Controller\TaxonomyController::addForm'
-  requirements:
-    _access_taxonomy_term_create: 'taxonomy_term'
diff --git a/core/modules/taxonomy/taxonomy.services.yml b/core/modules/taxonomy/taxonomy.services.yml
deleted file mode 100644
index 265eb5d..0000000
--- a/core/modules/taxonomy/taxonomy.services.yml
+++ /dev/null
@@ -1,6 +0,0 @@
-services:
-  access_check.taxonomy_term.create:
-    class: Drupal\taxonomy\Access\TaxonomyTermCreateAccess
-    arguments: ['@plugin.manager.entity']
-    tags:
-      - { name: access_check }
diff --git a/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_filter_taxonomy_index_tid.yml b/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_filter_taxonomy_index_tid.yml
deleted file mode 100644
index d14ecff..0000000
--- a/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_filter_taxonomy_index_tid.yml
+++ /dev/null
@@ -1,173 +0,0 @@
-base_field: nid
-base_table: node
-core: 8.x
-description: ''
-status: '1'
-display:
-  default:
-    display_plugin: default
-    id: default
-    display_title: Master
-    position: '1'
-    display_options:
-      access:
-        type: perm
-        options:
-          perm: 'access content'
-      cache:
-        type: none
-        options: {  }
-      query:
-        type: views_query
-        options:
-          disable_sql_rewrite: '0'
-          distinct: '0'
-          slave: '0'
-          query_comment: ''
-          query_tags: {  }
-      exposed_form:
-        type: basic
-        options:
-          submit_button: Apply
-          reset_button: '0'
-          reset_button_label: Reset
-          exposed_sorts_label: 'Sort by'
-          expose_sort_order: '1'
-          sort_asc_label: Asc
-          sort_desc_label: Desc
-      pager:
-        type: full
-        options:
-          items_per_page: '10'
-          offset: '0'
-          id: '0'
-          total_pages: ''
-          expose:
-            items_per_page: '0'
-            items_per_page_label: 'Items per page'
-            items_per_page_options: '5, 10, 20, 40, 60'
-            items_per_page_options_all: '0'
-            items_per_page_options_all_label: '- All -'
-            offset: '0'
-            offset_label: Offset
-          tags:
-            previous: 'â€¹ previous'
-            next: 'next â€º'
-            first: 'Â« first'
-            last: 'last Â»'
-          quantity: '9'
-      style:
-        type: default
-        options:
-          grouping: {  }
-          row_class: ''
-          default_row_class: '1'
-          row_class_special: '1'
-          uses_fields: '0'
-      row:
-        type: fields
-        options:
-          inline: {  }
-          separator: ''
-          hide_empty: '0'
-          default_field_elements: '1'
-      fields:
-        title:
-          id: title
-          table: node_field_data
-          field: title
-          provider: node
-          label: ''
-          alter:
-            alter_text: '0'
-            make_link: '0'
-            absolute: '0'
-            trim: '0'
-            word_boundary: '0'
-            ellipsis: '0'
-            strip_tags: '0'
-            html: '0'
-          hide_empty: '0'
-          empty_zero: '0'
-          link_to_node: '1'
-          relationship: none
-          group_type: group
-          admin_label: ''
-          exclude: '0'
-          element_type: ''
-          element_class: ''
-          element_label_type: ''
-          element_label_class: ''
-          element_label_colon: '1'
-          element_wrapper_type: ''
-          element_wrapper_class: ''
-          element_default_classes: '1'
-          empty: ''
-          hide_alter_empty: '1'
-      filters:
-        status:
-          value: '1'
-          table: node_field_data
-          field: status
-          provider: node
-          id: status
-          expose:
-            operator: '0'
-          group: '1'
-        tid:
-          id: tid
-          table: taxonomy_index
-          field: tid
-          relationship: none
-          group_type: group
-          admin_label: ''
-          operator: or
-          value:
-            2: '2'
-          group: '1'
-          exposed: '0'
-          expose:
-            operator_id: '0'
-            label: ''
-            description: ''
-            use_operator: '0'
-            operator: ''
-            identifier: ''
-            required: '0'
-            remember: '0'
-            multiple: '0'
-            remember_roles:
-              authenticated: authenticated
-            reduce: '0'
-          is_grouped: '0'
-          group_info:
-            label: ''
-            description: ''
-            identifier: ''
-            optional: '1'
-            widget: select
-            multiple: '0'
-            remember: '0'
-            default_group: All
-            default_group_multiple: {  }
-            group_items: {  }
-          reduce_duplicates: '0'
-          type: select
-          limit: '1'
-          vid: tags
-          hierarchy: '1'
-          error_message: '1'
-          plugin_id: taxonomy_index_tid
-          provider: taxonomy
-      sorts: {  }
-      header: {  }
-      footer: {  }
-      empty: {  }
-      relationships: {  }
-      arguments: {  }
-label: test_filter_taxonomy_index_tid
-module: views
-id: test_filter_taxonomy_index_tid
-tag: ''
-uuid: b8bb8999-3e2c-4170-9500-ebafe26e5a78
-langcode: en
diff --git a/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_groupwise_term.yml b/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_groupwise_term.yml
index 957f2b2..4c4af55 100644
--- a/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_groupwise_term.yml
+++ b/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_groupwise_term.yml
@@ -18,14 +18,12 @@ display:
           id: name
           table: taxonomy_term_data
           plugin_id: taxonomy
-          provider: taxonomy
         nid:
           field: nid
           id: nid
           relationship: tid_representative
           table: node
           plugin_id: node
-          provider: node
       pager:
         options:
           items_per_page: '10'
@@ -48,7 +46,6 @@ display:
           subquery_view: ''
           table: taxonomy_term_data
           plugin_id: groupwise_max
-          provider: views
       row:
         type: fields
       sorts:
@@ -58,7 +55,6 @@ display:
           order: DESC
           table: taxonomy_term_data
           plugin_id: standard
-          provider: views
       style:
         type: default
       title: test_groupwise
diff --git a/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_taxonomy_node_term_data.yml b/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_taxonomy_node_term_data.yml
index 2aebe47..b347dbd 100644
--- a/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_taxonomy_node_term_data.yml
+++ b/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_taxonomy_node_term_data.yml
@@ -20,7 +20,6 @@ display:
             items_per_page: '25'
           table: taxonomy_term_data
           plugin_id: taxonomy
-          provider: taxonomy
         tid_1:
           default_argument_type: fixed
           field: tid
@@ -33,7 +32,6 @@ display:
             items_per_page: '25'
           table: taxonomy_term_data
           plugin_id: taxonomy
-          provider: taxonomy
       cache:
         type: none
       exposed_form:
@@ -51,7 +49,6 @@ display:
           vocabularies:
             tags: '0'
           plugin_id: node_term_data
-          provider: taxonomy
         term_node_tid_1:
           field: term_node_tid
           id: term_node_tid_1
@@ -60,15 +57,12 @@ display:
           vocabularies:
             tags: '0'
           plugin_id: node_term_data
-          provider: taxonomy
       sorts:
         nid:
           field: nid
           id: nid
           order: DESC
           table: nid
-          plugin_id: standard
-          provider: views
       style:
         type: default
       row:
diff --git a/core/modules/text/lib/Drupal/text/Plugin/field/field_type/TextItem.php b/core/modules/text/lib/Drupal/text/Plugin/field/field_type/TextItem.php
index 1c79cf7..26326fc 100644
--- a/core/modules/text/lib/Drupal/text/Plugin/field/field_type/TextItem.php
+++ b/core/modules/text/lib/Drupal/text/Plugin/field/field_type/TextItem.php
@@ -63,27 +63,6 @@ public static function schema(Field $field) {
   /**
    * {@inheritdoc}
    */
-  public function getConstraints() {
-    $constraint_manager = \Drupal::typedData()->getValidationConstraintManager();
-    $constraints = parent::getConstraints();
-
-    if ($max_length = $this->getFieldDefinition()->getFieldSetting('max_length')) {
-      $constraints[] = $constraint_manager->create('ComplexData', array(
-        'value' => array(
-          'Length' => array(
-            'max' => $max_length,
-            'maxMessage' => t('%name: the text may not be longer than @max characters.', array('%name' => $this->getFieldDefinition()->getFieldLabel(), '@max' => $max_length)),
-          )
-        ),
-      ));
-    }
-
-    return $constraints;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
   public function settingsForm(array $form, array &$form_state) {
     $element = array();
     $field = $this->getInstance()->getField();
diff --git a/core/modules/text/lib/Drupal/text/Plugin/field/field_type/TextItemBase.php b/core/modules/text/lib/Drupal/text/Plugin/field/field_type/TextItemBase.php
index df9cea0..80c93b3 100644
--- a/core/modules/text/lib/Drupal/text/Plugin/field/field_type/TextItemBase.php
+++ b/core/modules/text/lib/Drupal/text/Plugin/field/field_type/TextItemBase.php
@@ -70,17 +70,38 @@ public function isEmpty() {
   /**
    * {@inheritdoc}
    */
+  public function getConstraints() {
+    $constraint_manager = \Drupal::typedData()->getValidationConstraintManager();
+    $constraints = parent::getConstraints();
+
+    if (!empty($this->getInstance()->getField()->settings['max_length'])) {
+      $max_length = $this->getInstance()->getField()->settings['max_length'];
+      $constraints[] = $constraint_manager->create('ComplexData', array(
+        'value' => array(
+          'Length' => array(
+            'max' => $max_length,
+            'maxMessage' => t('%name: the text may not be longer than @max characters.', array('%name' => $this->getInstance()->label, '@max' => $max_length)),
+          )
+        ),
+      ));
+    }
+
+    return $constraints;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
   public function prepareCache() {
     // Where possible, generate the sanitized version of each field early so
     // that it is cached in the field cache. This avoids the need to look up the
     // field in the filter cache separately.
-    $text_processing = $this->getFieldDefinition()->getFieldSetting('text_processing');
-    if (!$text_processing || filter_format_allowcache($this->get('format')->getValue())) {
+    if (!$this->getInstance()->settings['text_processing'] || filter_format_allowcache($this->get('format')->getValue())) {
       $itemBC = $this->getValue();
       $langcode = $this->getParent()->getParent()->language()->id;
-      $this->set('safe_value', text_sanitize($text_processing, $langcode, $itemBC, 'value'));
+      $this->set('safe_value', text_sanitize($this->getInstance()->settings['text_processing'], $langcode, $itemBC, 'value'));
       if ($this->getType() == 'field_item:text_with_summary') {
-        $this->set('safe_summary', text_sanitize($text_processing, $langcode, $itemBC, 'summary'));
+        $this->set('safe_summary', text_sanitize($this->getInstance()->settings['text_processing'], $langcode, $itemBC, 'summary'));
       }
     }
   }
diff --git a/core/modules/text/lib/Drupal/text/Plugin/field/field_type/TextWithSummaryItem.php b/core/modules/text/lib/Drupal/text/Plugin/field/field_type/TextWithSummaryItem.php
index 7aecf67..4d9030d 100644
--- a/core/modules/text/lib/Drupal/text/Plugin/field/field_type/TextWithSummaryItem.php
+++ b/core/modules/text/lib/Drupal/text/Plugin/field/field_type/TextWithSummaryItem.php
@@ -106,6 +106,28 @@ public function isEmpty() {
   /**
    * {@inheritdoc}
    */
+  public function getConstraints() {
+    $constraint_manager = \Drupal::typedData()->getValidationConstraintManager();
+    $constraints = parent::getConstraints();
+
+    if (!empty($this->getInstance()->getField()->settings['max_length'])) {
+      $max_length = $this->getInstance()->getField()->settings['max_length'];
+      $constraints[] = $constraint_manager->create('ComplexData', array(
+        'summary' => array(
+          'Length' => array(
+            'max' => $max_length,
+            'maxMessage' => t('%name: the summary may not be longer than @max characters.', array('%name' => $this->getInstance()->label, '@max' => $max_length)),
+          )
+        ),
+      ));
+    }
+
+    return $constraints;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
   public function instanceSettingsForm(array $form, array &$form_state) {
     $element = array();
 
diff --git a/core/modules/toolbar/css/toolbar.icons.css b/core/modules/toolbar/css/toolbar.icons.css
index 0aee152..3175b0b 100644
--- a/core/modules/toolbar/css/toolbar.icons.css
+++ b/core/modules/toolbar/css/toolbar.icons.css
@@ -1,15 +1,15 @@
 /**
  * @file toolbar.icons.css
  */
-.toolbar .toolbar-icon {
+.toolbar .icon {
   padding-left: 2.75em; /* LTR */
   position: relative;
 }
-[dir="rtl"] .toolbar .toolbar-icon {
+[dir="rtl"] .toolbar .icon {
   padding-left: 1.3333em;
   padding-right: 2.75em;
 }
-.toolbar .toolbar-icon:before {
+.toolbar .icon:before {
   background-attachment: scroll;
   background-color: transparent;
   background-position: center center;
@@ -22,36 +22,36 @@
   top: 0;
   width: 20px;
 }
-[dir="rtl"] .toolbar .toolbar-icon:before {
+[dir="rtl"] .toolbar .icon:before {
   left: auto;
   right: 0.6667em;
 }
-.toolbar button.toolbar-icon {
+.toolbar button.icon {
   background-color: transparent;
   border: 0;
   font-size: 1em;
 }
-.toolbar .menu ul .toolbar-icon {
+.toolbar .menu ul .icon {
   padding-left: 1.3333em; /* LTR */
 }
-[dir="rtl"] .toolbar .menu ul .toolbar-icon {
+[dir="rtl"] .toolbar .menu ul .icon {
   padding-left: 0;
   padding-right: 1.3333em;
 }
-.toolbar .menu ul a.toolbar-icon:before {
+.toolbar .menu ul a.icon:before {
   display: none;
 }
-.toolbar .toolbar-tray-vertical .menu ul {
+.toolbar .vertical .menu ul {
   margin-left: 1.5em; /* LTR */
 }
-[dir="rtl"] .toolbar .toolbar-tray-vertical .menu ul {
+[dir="rtl"] .toolbar .vertical .menu ul {
   margin-left: 0;
   margin-right: 1.5em;
 }
-.toolbar .toolbar-tray-vertical .menu ul ul {
+.toolbar .vertical .menu ul ul {
   margin-left: 0.75em; /* LTR */
 }
-[dir="rtl"] .toolbar .toolbar-tray-vertical .menu ul ul {
+[dir="rtl"] .toolbar .vertical .menu ul ul {
   margin-left: 0;
   margin-right: 0.75em;
 }
@@ -59,83 +59,83 @@
 /**
  * Top level icons
  */
-.toolbar-icon-home:before {
+.icon-home:before {
   background-image: url("../images/icon-home.png");
 }
-.toolbar-icon-home:active:before,
-.toolbar-icon-home.active:before {
+.icon-home:active:before,
+.icon-home.active:before {
   background-image: url("../images/icon-home-active.png");
 }
-.toolbar-icon-menu:before {
+.icon-menu:before {
   background-image: url("../images/icon-menu.png");
 }
-.toolbar-icon-menu:active:before,
-.toolbar-icon-menu.active:before {
+.icon-menu:active:before,
+.icon-menu.active:before {
   background-image: url("../images/icon-menu-active.png");
 }
 
 /**
  * Main menu icons.
  */
-.toolbar-icon-content:before {
+.icon-content:before {
   background-image: url("../images/icon-content.png");
 }
-.toolbar-icon-content:active:before,
-.toolbar-icon-content.active:before {
+.icon-content:active:before,
+.icon-content.active:before {
   background-image: url("../images/icon-content-active.png");
 }
-.toolbar-icon-structure:before {
+.icon-structure:before {
   background-image: url("../images/icon-structure.png");
 }
-.toolbar-icon-structure:active:before,
-.toolbar-icon-structure.active:before {
+.icon-structure:active:before,
+.icon-structure.active:before {
   background-image: url("../images/icon-structure-active.png");
 }
-.toolbar-icon-appearance:before {
+.icon-appearance:before {
   background-image: url("../images/icon-appearance.png");
 }
-.toolbar-icon-appearance:active:before,
-.toolbar-icon-appearance.active:before {
+.icon-appearance:active:before,
+.icon-appearance.active:before {
   background-image: url("../images/icon-appearance-active.png");
 }
-.toolbar-icon-people:before {
+.icon-people:before {
   background-image: url("../images/icon-people.png");
 }
-.toolbar-icon-people:active:before,
-.toolbar-icon-people.active:before {
+.icon-people:active:before,
+.icon-people.active:before {
   background-image: url("../images/icon-people-active.png");
 }
-.toolbar-icon-extend:before {
+.icon-extend:before {
   background-image: url("../images/icon-extend.png");
 }
-.toolbar-icon-extend:active:before,
-.toolbar-icon-extend.active:before {
+.icon-extend:active:before,
+.icon-extend.active:before {
   background-image: url("../images/icon-extend-active.png");
 }
-.toolbar-icon-configuration:before {
+.icon-configuration:before {
   background-image: url("../images/icon-configuration.png");
 }
-.toolbar-icon-configuration:active:before,
-.toolbar-icon-configuration.active:before {
+.icon-configuration:active:before,
+.icon-configuration.active:before {
   background-image: url("../images/icon-configuration-active.png");
 }
-.toolbar-icon-reports:before {
+.icon-reports:before {
   background-image: url("../images/icon-reports.png");
 }
-.toolbar-icon-reports:active:before,
-.toolbar-icon-reports.active:before {
+.icon-reports:active:before,
+.icon-reports.active:before {
   background-image: url("../images/icon-reports-active.png");
 }
-.toolbar-icon-help:before {
+.icon-help:before {
   background-image: url("../images/icon-help.png");
 }
-.toolbar-icon-help:active:before,
-.toolbar-icon-help.active:before {
+.icon-help:active:before,
+.icon-help.active:before {
   background-image: url("../images/icon-help-active.png");
 }
 
 @media only screen and (min-width: 16.5em) {
-  .toolbar .toolbar-bar .toolbar-icon {
+  .toolbar .bar .icon {
     margin-left: 0;
     margin-right: 0;
     padding-left: 0;
@@ -143,11 +143,11 @@
     text-indent: -9999px;
     width: 4em;
   }
-  .toolbar .toolbar-bar .toolbar-icon:before {
+  .toolbar .bar .icon:before {
     left: 0; /* LTR */
     width: 100%;
   }
-  [dir="rtl"] .toolbar .toolbar-bar .toolbar-icon:before {
+  [dir="rtl"] .toolbar .bar .icon:before {
     background-size: auto auto;
     left: auto;
     right: 0;
@@ -155,23 +155,23 @@
 }
 
 @media only screen and (min-width: 36em) {
-  .toolbar .toolbar-bar .toolbar-icon {
+  .toolbar .bar .icon {
     background-position: left center; /* LTR */
     padding-left: 2.75em; /* LTR */
     padding-right: 1.3333em; /* LTR */
     text-indent: 0;
     width: auto;
   }
-  [dir="rtl"] .toolbar .toolbar-bar .toolbar-icon {
+  [dir="rtl"] .toolbar .bar .icon {
     background-position: right center;
     padding-left: 1.3333em;
     padding-right: 2.75em;
   }
-  .toolbar .toolbar-bar .toolbar-icon:before {
+  .toolbar .bar .icon:before {
     left: 0.6667em; /* LTR */
     width: 20px;
   }
-  [dir="rtl"] .toolbar .toolbar-bar .toolbar-icon:before {
+  [dir="rtl"] .toolbar .bar .icon:before {
     left: 0;
     right: 0.6667em;
   }
diff --git a/core/modules/toolbar/css/toolbar.menu.css b/core/modules/toolbar/css/toolbar.menu.css
index 060f102..93d81c1 100644
--- a/core/modules/toolbar/css/toolbar.menu.css
+++ b/core/modules/toolbar/css/toolbar.menu.css
@@ -6,29 +6,29 @@
   margin: 0;
   padding: 0;
 }
-.toolbar .toolbar-box {
+.toolbar .box {
   display: block;
   line-height: 1em; /* this prevents the value "normal" from being returned as the line-height */
   position: relative;
   width: auto;
 }
-.toolbar .toolbar-tray-horizontal .menu .toolbar-handle,
-.toolbar .toolbar-tray-horizontal .menu ul,
-.toolbar .toolbar-tray-vertical .menu ul {
+.toolbar .horizontal .menu .handle,
+.toolbar .horizontal .menu ul,
+.toolbar .vertical .menu ul {
   display: none;
 }
-.toolbar .toolbar-tray-vertical li.open > ul {
+.toolbar .vertical li.open > ul {
   display: block; /* Show the sub-menus */
 }
-.toolbar .toolbar-tray-vertical .toolbar-handle + a {
+.toolbar .vertical .handle + a {
   margin-right: 3em; /* LTR */
 }
-[dir="rtl"] .toolbar .toolbar-tray-vertical .toolbar-handle + a {
+[dir="rtl"] .toolbar .vertical .handle + a {
   margin-left: 3em;
   margin-right: 0;
 }
-.toolbar .toolbar-tray .active-trail > .toolbar-box a,
-.toolbar .toolbar-tray a.active {
+.toolbar .tray .active-trail > .box a,
+.toolbar .tray a.active {
   color: #000;
   font-weight: bold;
 }
@@ -75,10 +75,10 @@
 /**
  * Handle.
  */
-.toolbar .toolbar-handle:hover {
+.toolbar .handle:hover {
   cursor: pointer;
 }
-.toolbar .toolbar-icon.toolbar-handle {
+.toolbar .icon.handle {
   bottom: 0;
   display: block;
   height: 100%;
@@ -90,24 +90,24 @@
   width: 3em;
   z-index: 1;
 }
-[dir="rtl"] .toolbar .toolbar-icon.toolbar-handle {
+[dir="rtl"] .toolbar .icon.handle {
   left: 0;
   right: auto;
 }
-.toolbar .toolbar-icon.toolbar-handle:before {
+.toolbar .icon.handle:before {
   background-image: url("../images/icon-open.png");
   left: 0; /* LTR */
 }
-[dir="rtl"] .toolbar .toolbar-icon.toolbar-handle:before {
+[dir="rtl"] .toolbar .icon.handle:before {
   left: auto;
   right: 0;
 }
-.toolbar .toolbar-icon.toolbar-handle.open:before {
+.toolbar .icon.handle.open:before {
   background-image: url("../images/icon-collapse.png");
 }
-.toolbar .menu .menu .toolbar-icon.toolbar-handle:before {
+.toolbar .menu .menu .icon.handle:before {
   background-image: url("../images/icon-child-open.png");
 }
-.toolbar .menu .menu .toolbar-icon.toolbar-handle.open:before {
+.toolbar .menu .menu .icon.handle.open:before {
   background-image: url("../images/icon-child-collapse.png");
 }
diff --git a/core/modules/toolbar/css/toolbar.module.css b/core/modules/toolbar/css/toolbar.module.css
index d3e3f9e..f193d58 100644
--- a/core/modules/toolbar/css/toolbar.module.css
+++ b/core/modules/toolbar/css/toolbar.module.css
@@ -5,20 +5,30 @@
  * Aggressive resets so we can achieve a consistent look in hostile CSS
  * environments.
  */
-#toolbar-administration,
-#toolbar-administration * {
+html.js #toolbar-administration,
+html .toolbar * {
   -moz-box-sizing: border-box;
   -o-box-sizing: border-box;
   -webkit-box-sizing: border-box;
   box-sizing: border-box;
-}
-#toolbar-administration {
-  font-size: small;
-  line-height: 1;
   margin: 0;
   padding: 0;
   vertical-align: baseline;
 }
+html.js #toolbar-administration {
+  font-size: small;
+  line-height: 1;
+}
+html.js .toolbar {
+  left: 0; /* LTR */
+  position: absolute;
+  top: 0;
+  width: 100%;
+}
+html.js[dir="rtl"] .toolbar {
+   left: auto;
+   right: 0;
+ }
 
 /**
  * Very specific overrides for Drupal system CSS.
@@ -34,210 +44,239 @@
 .toolbar .menu li {
   padding-top: 0;
 }
-.toolbar .toolbar-bar .toolbar-tab,
-.toolbar .menu li {
+.js .toolbar .bar .tab,
+.js .toolbar .menu li {
   display: block;
 }
-.toolbar a {
+.js .toolbar .bar .tab,
+.js .toolbar .horizontal .tab  {
+  float: left; /* LTR */
+}
+.js[dir="rtl"] .toolbar .bar .tab,
+.js[dir="rtl"] .toolbar .horizontal .tab {
+  float: right;
+}
+.js .toolbar a {
   display: block;
   line-height: 1;
 }
-
 /**
  * Administration menu.
  */
-.toolbar .toolbar-bar,
-.toolbar .toolbar-tray {
-  position: relative;
-  z-index: 1250;
-}
-/* Position the admin toolbar absolutely when the configured standard breakpoint
- * is active. The toolbar container, that contains the bar and the trays, is
- * position absolutely so that it scrolls with the page. Otherwise, on smaller
- * screens, the components of the admin toolbar are positioned statically. */
-body.toolbar-paneled .toolbar-oriented,
-.toolbar-oriented .toolbar-bar,
-.toolbar-oriented .toolbar-tray {
-  left: 0;
+.js .toolbar .bar {
+  left: 0; /* LTR */
   position: absolute;
-  right: 0;
   top: 0;
+  z-index: 1250;
+  width: 100%;
 }
-/* Layer the bar just above the trays and above contextual link triggers. */
-.toolbar-oriented .toolbar-bar {
-  z-index: 502;
-}
-/* Position the admin toolbar fixed when the configured standard breakpoint is
- * active. */
-body.toolbar-paneled .toolbar-oriented .toolbar-bar {
-  position: fixed;
-}
-/* When the configured narrow breakpoint is active, the toolbar is sized to wrap
- * around the trays in order to provide a context for scrolling tray content
- * that is taller than the viewport. */
-body.toolbar-tray-open.toolbar-paneled.toolbar-vertical .toolbar-oriented {
-  bottom: 0;
-  width: 240px;
-  width: 15rem;
-}
-/* Present the admin toolbar tabs horizontally as a default on user agents that
- * do not understand media queries or on user agents where JavaScript is
- * disabled. */
-.toolbar .toolbar-bar .toolbar-tab,
-.toolbar .toolbar-tray-horizontal li {
-  float: left; /* LTR */
-}
-[dir="rtl"] .toolbar .toolbar-bar .toolbar-tab,
-[dir="rtl"] .toolbar .toolbar-tray-horizontal li {
-  float: right;
+.js[dir="rtl"] .toolbar .bar {
+  left: auto;
+  right: 0;
 }
-/* Present the admin toolbar tabs vertically by default on user agents that
- * that understand media queries. This will be the small screen default. */
 @media only screen {
-  .toolbar .toolbar-bar .toolbar-tab,
-  .toolbar .toolbar-tray-horizontal li {
+  .js .toolbar .bar .tab,
+  .js .toolbar .tray li {
     float: none; /* LTR */
   }
-  [dir="rtl"] .toolbar .toolbar-bar .toolbar-tab,
-  [dir="rtl"] .toolbar .toolbar-tray-horizontal li {
+  .js[dir="rtl"] .toolbar .bar .tab,
+  .js[dir="rtl"] .toolbar .tray li {
     float: none;
   }
 }
-/* This min-width media query is meant to provide basic horizontal layout to
- * the main menu tabs when JavaScript is disabled on user agents that understand
- * media queries. */
-@media (min-width:16.5em) {
-  .toolbar .toolbar-bar .toolbar-tab,
-  .toolbar .toolbar-tray-horizontal li {
+@media only screen and (min-width: 16.5em) {
+  .js .toolbar .bar .tab,
+  .js .toolbar .horizontal li {
     float: left; /* LTR */
   }
-  [dir="rtl"] .toolbar .toolbar-bar .toolbar-tab,
-  [dir="rtl"] .toolbar .toolbar-tray-horizontal li {
+  .js[dir="rtl"] .toolbar .bar .tab,
+  .js[dir="rtl"] .toolbar .horizontal li {
     float: right;
   }
 }
-/* Present the admin toolbar tabs horizontally when the configured narrow
- * breakpoint is active. */
-.toolbar-oriented .toolbar-bar .toolbar-tab,
-.toolbar-oriented .toolbar-tray-horizontal li {
-  float: left; /* LTR */
-}
-[dir="rtl"] .toolbar-oriented .toolbar-bar .toolbar-tab,
-[dir="rtl"] .toolbar-oriented .toolbar-tray-horizontal li {
-  float: right;
+@media only screen and (min-width: 28.125em) {
+  .js .toolbar .bar {
+    position: fixed;
+  }
 }
 
 /**
  * Toolbar tray.
  */
-.toolbar .toolbar-tray {
+.js .toolbar .tray {
   display: none;
-  z-index: 501;
-}
-.toolar .toolbar-tray > .toolbar-lining {
-  position: relative;
+  position: fixed;
 }
-.toolbar-oriented .toolbar-tray-vertical {
-  left: -100%; /* LTR */
+/* Make vertical toolbar tray scroll with page for touch devices. */
+.touch .toolbar .tray {
   position: absolute;
-  width: 240px;
-  width: 15rem;
-}
-[dir="rtl"] .toolbar-oriented .toolbar-tray-vertical {
-  left: auto;
-  right: -100%;
 }
-.toolbar .toolbar-tray-vertical > .toolbar-lining {
-  min-height: 100%;
+.toolbar .tray {
+  z-index: 1200;
 }
-.toolbar .toolbar-tray-vertical > .toolbar-lining:before {
+.toolbar .horizontal {
   width: 100%;
 }
-.toolbar-oriented .toolbar-tray-vertical > .toolbar-lining:before {
+.toolbar .vertical,
+.toolbar .vertical > .lining:before {
   bottom: 0;
-  content: '';
-  display: block;
-  left: 0; /* LTR */
-  position: fixed;
-  top: 0;
   width: 240px;
   width: 15rem;
-  z-index: -1;
 }
-[dir="rtl"] .toolbar .toolbar-tray-vertical > .toolbar-lining:before {
+.toolbar .vertical {
+  left: -100%; /* LTR */
+  position: absolute;
+}
+[dir="rtl"] .toolbar .vertical {
   left: auto;
-  right: 0;
+  right: -100%;
 }
-/* Hide secondary menus when the tray is horizontal. */
-.toolbar-oriented .toolbar-tray-horizontal .menu li ul {
-  display: none;
+.toolbar .horizontal {
+  left: 0; /* LTR */
+  height: 0;
+  /* Set one higher than the contextual links gear. */
+  z-index: 1000;
 }
-/* When the configured standard breakpoint is active and the tray is in a
- * horizontal position, the tray is fixed to the top of the viewport and does
- * not scroll with the page contents. */
-body.toolbar-paneled .toolbar .toolbar-tray-horizontal {
-  position: fixed;
+[dir="rtl"] .toolbar .horizontal {
+  left: auto;
+  right: 0;
 }
-/* When the configured standard breakpoint is active and the tray is in a
- * vertical position, the tray does not scroll with the page. The contents of
- * the tray scroll within the confines of the viewport. */
-body.toolbar-paneled .toolbar .toolbar-tray-vertical {
-  height: 100%;
+.toolar .tray .lining {
+  position: relative;
+}
+.toolbar .vertical > .lining,
+.toolbar .vertical > .lining:before {
+  left: -100%; /* LTR */
+  min-height: 100%;
   overflow-x: hidden;
   overflow-y: auto;
+  position: absolute;
+  width: 100%;
+}
+[dir="rtl"] .toolbar .vertical > .lining,
+[dir="rtl"] .toolbar .vertical > .lining:before {
+  left: auto;
+  right: -100%;
+}
+.toolbar .vertical > .lining:before {
+  bottom: 0;
+  -moz-box-sizing: content-box;
+  -o-box-sizing: content-box;
+  -webkit-box-sizing: content-box;
+  box-sizing: content-box;
+  content: '';
+  display: none;
+  height: 100%;
+  /* Support for devices that do not support position fixed. */
+  position: absolute;
   position: fixed;
+  top: 0;
+  z-index: -1;
 }
-.toolbar .toolbar-tray.active {
+.toolbar .tray.active {
   display: block;
 }
-/* Bring the tray into the viewport. By default it is just off-screen. */
-.toolbar-oriented .toolbar-tray-vertical.active {
+.toolbar .horizontal.active {
+  height: auto;
+}
+.toolbar .vertical.active,
+.toolbar .vertical.active > .lining {
+  bottom: 0;
   left: 0; /* LTR */
+  top: 0;
 }
-[dir="rtl"] .toolbar-oriented .toolbar-tray-vertical.active {
+[dir="rtl"] .toolbar .vertical.active,
+[dir="rtl"] .toolbar .vertical.active > .lining {
   left: auto;
   right: 0;
 }
-/* When the configured standard breakpoint is active, the tray appears to push
- * the page content away from the edge of the viewport. */
-body.toolbar-vertical.toolbar-paneled {
-  margin-left: 240px; /* LTR */
-  margin-left: 15rem; /* LTR */
+/* Make vertical toolbar tray scroll with page for touch devices. */
+.touch .toolbar .vertical.active,
+.touch .toolbar .vertical.active > .lining {
+  bottom: auto;
+  top: auto;
 }
-[dir="rtl"] body.toolbar-vertical.toolbar-paneled {
-  margin-left: auto;
-  margin-left: auto;
-  margin-right: 240px;
-  margin-right: 15rem;
+.toolbar .horizontal .menu li ul {
+  display: none;
+}
+@media only screen {
+  .toolbar .vertical,
+  .toolbar .vertical > .lining:before {
+    bottom: auto;
+    width: 100%;
+  }
 }
 
+@media only screen and (min-width: 16.5em) {
+  .toolbar .vertical {
+    bottom: 0;
+  }
+  .toolbar .vertical,
+  .toolbar .vertical > .lining:before {
+    width: 240px;
+    width: 15rem;
+  }
+  .toolbar .vertical.active > .lining:before {
+    display: block;
+    left: -1px; /* LTR */
+  }
+  [dir="rtl"] .toolbar .vertical.active > .lining:before {
+    left: auto;
+    right: -1px;
+  }
+}
+@media only screen and (min-width: 28.125em) {
+  .toolbar .tray.horizontal {
+    position: fixed;
+  }
+}
+/**
+ * At larger screen sizes, the tray pushes the page content.
+ */
+@media only screen and (min-width: 38.125em) {
+  body.toolbar-tray-open.toolbar-vertical {
+    margin-left: 240px; /* LTR */
+    margin-left: 15rem; /* LTR */
+  }
+  [dir="rtl"] body.toolbar-tray-open.toolbar-vertical {
+    margin-left: 0;
+    margin-right: 240px;
+    margin-right: 15rem;
+  }
+}
 /**
  * ToolBar tray orientation toggle.
+ *
+ * Hide the orientation toggle from browsers that do not interpret
+ * media queries. They get a standard horizontal toolbar.
  */
-/* Hide the orientation toggle when the configured narrow breakpoint is not
- * active. */
-.toolbar .toolbar-tray .toolbar-toggle-orientation {
+.toolbar .horizontal .toggle-orientation {
   display: none;
 }
-/* Show the orientation toggle when the configured narrow breakpoint is
- * active. */
-.toolbar-oriented .toolbar-tray .toolbar-toggle-orientation {
-  display: block;
+@media only screen {
+  .toolbar .tray .toggle-orientation {
+    display: none;
+  }
 }
-.toolbar-oriented .toolbar-tray-horizontal .toolbar-toggle-orientation {
+@media only screen and (min-width: 16.5em)   {
+  .toolbar .tray .toggle-orientation {
+    display: block;
+  }
+}
+.toolbar .horizontal .toggle-orientation {
   bottom: 0;
   position: absolute;
   right: 0; /* LTR */
-  top: auto;
+  top: 0;
 }
-[dir="rtl"] .toolbar-oriented .toolbar-tray-horizontal .toolbar-toggle-orientation {
+[dir="rtl"] .toolbar .horizontal .toggle-orientation {
   left: 0;
   right: auto;
 }
-.toolbar-oriented .toolbar-tray-vertical .toolbar-toggle-orientation {
+.toolbar .vertical .toggle-orientation {
   float: right; /* LTR */
   width: 100%;
 }
-[dir="rtl"] .toolbar-oriented .toolbar-tray-vertical .toolbar-toggle-orientation {
+[dir="rtl"] .toolbar .vertical .toggle-orientation {
   float: left;
 }
diff --git a/core/modules/toolbar/css/toolbar.theme.css b/core/modules/toolbar/css/toolbar.theme.css
index 1d64296..7b08b79 100644
--- a/core/modules/toolbar/css/toolbar.theme.css
+++ b/core/modules/toolbar/css/toolbar.theme.css
@@ -26,26 +26,26 @@
 /**
  * Toolbar bar.
  */
-.toolbar .toolbar-bar {
+.toolbar .bar {
   background-color: #0f0f0f;
   box-shadow: -1px 0 3px 1px rgba(0, 0, 0, 0.3333); /* LTR */
   color: #dddddd;
 }
-[dir="rtl"] .toolbar .toolbar-bar {
+[dir="rtl"] .toolbar .bar {
   box-shadow: 1px 0 3px 1px rgba(0, 0, 0, 0.3333);
 }
-.toolbar .toolbar-bar a {
+.toolbar .bar a {
   color: #ffffff;
 }
-.toolbar .toolbar-bar .toolbar-tab > a {
+.toolbar .bar .tab > a {
   font-weight: bold;
 }
-.toolbar .toolbar-bar .toolbar-tab > a:hover {
+.toolbar .bar .tab > a:hover {
   background-image: -webkit-linear-gradient(rgba(255, 255, 255, 0.125) 20%, transparent 200%);
   background-image: linear-gradient(rgba(255, 255, 255, 0.125) 20%, transparent 200%);
   text-decoration: none;
 }
-.toolbar .toolbar-bar .toolbar-tab > a.active {
+.toolbar .bar .tab > a.active {
   background-image: -webkit-linear-gradient(rgba(255, 255, 255, 0.25) 20%, transparent 200%);
   background-image: linear-gradient(rgba(255, 255, 255, 0.25) 20%, transparent 200%);
 }
@@ -53,97 +53,103 @@
 /**
  * Toolbar tray.
  */
-.toolbar .toolbar-tray {
+.toolbar .tray {
   background-color: #ffffff;
 }
-.toolbar .toolbar-tray-horizontal > .toolbar-lining {
+.toolbar .horizontal > .lining {
   padding-right: 5em; /* LTR */
 }
-[dir="rtl"] .toolbar .toolbar-tray-horizontal > .toolbar-lining {
+[dir="rtl"] .toolbar .horizontal > .lining {
   padding-right: 0;
   padding-left: 5em;
 }
-.toolbar .toolbar-tray-vertical > .toolbar-lining:before {
+.toolbar .vertical > .lining,
+.toolbar .vertical > .lining:before {
   background-color: #ffffff;
   border-right: 1px solid #aaaaaa; /* LTR */
-  box-shadow: -1px 0 5px 2px rgba(0, 0, 0, 0.3333); /* LTR */
 }
-[dir="rtl"] .toolbar .toolbar-tray-vertical > .toolbar-lining:before {
+[dir="rtl"] .toolbar .vertical > .lining,
+[dir="rtl"] .toolbar .vertical > .lining:before {
   border-left: 1px solid #aaaaaa;
   border-right: 0 none;
+}
+.toolbar .vertical > .lining:before {
+  box-shadow: -1px 0 5px 2px rgba(0, 0, 0, 0.3333); /* LTR */
+}
+[dir="rtl"] .toolbar .vertical > .lining:before {
   box-shadow: 1px 0 5px 2px rgba(0, 0, 0, 0.3333);
 }
-.toolbar .toolbar-tray-horizontal {
+.toolbar .horizontal {
   border-bottom: 1px solid #aaaaaa;
   box-shadow: -2px 1px 3px 1px rgba(0, 0, 0, 0.3333); /* LTR */
 }
-[dir="rtl"] .toolbar .toolbar-tray-horizontal {
+[dir="rtl"] .toolbar .horizontal {
   box-shadow: 2px 1px 3px 1px rgba(0, 0, 0, 0.3333);
 }
-.toolbar .toolbar-tray-horizontal .toolbar-tray {
+.toolbar .horizontal .tray {
   background-color: #f5f5f5;
 }
-.toolbar .toolbar-tray a {
+.toolbar .tray a {
   color: #707070;
 }
-.toolbar .toolbar-tray a:hover,
-.toolbar .toolbar-tray a:active,
-.toolbar .toolbar-tray a.active {
+.toolbar .tray a:hover,
+.toolbar .tray a:active,
+.toolbar .tray a.active {
   color: #000;
 }
-.toolbar .toolbar-tray-horizontal .menu {
+.toolbar .horizontal .menu {
   background-color: #ffffff;
 }
-.toolbar .toolbar-tray-horizontal .menu li + li {
+.toolbar .horizontal .menu li + li {
   border-left: 1px solid #dddddd; /* LTR */
 }
-[dir="rtl"] .toolbar .toolbar-tray-horizontal .menu li + li {
+[dir="rtl"] .toolbar .horizontal .menu li + li {
   border-left: 0 none ;
   border-right: 1px solid #dddddd;
 }
-.toolbar .toolbar-tray-horizontal .menu li:last-child {
+.toolbar .horizontal .menu li:last-child {
   border-right: 1px solid #dddddd; /* LTR */
 }
-[dir="rtl"] .toolbar .toolbar-tray-horizontal .menu li:last-child {
+[dir="rtl"] .toolbar .horizontal .menu li:last-child {
   border-left: 1px solid #dddddd;
 }
-.toolbar .toolbar-tray-vertical .menu li + li {
+.toolbar .vertical .menu li + li {
   border-top: 1px solid #dddddd;
 }
-.toolbar .toolbar-tray-vertical .menu li:last-child {
+.toolbar .vertical .menu li:last-child {
   border-bottom: 1px solid #dddddd;
 }
-.toolbar .toolbar-tray-vertical .menu .menu li {
+.toolbar .vertical .menu .menu li {
   border: 0 none;
 }
-.toolbar .toolbar-tray-vertical .menu ul ul {
+.toolbar .vertical .menu ul ul {
   border-bottom: 1px solid #dddddd;
   border-top: 1px solid #dddddd;
 }
-.toolbar .toolbar-tray-vertical .menu li:last-child > ul {
+.toolbar .vertical .menu li:last-child > ul {
   border-bottom: 0;
 }
-.toolbar .toolbar-tray-vertical .menu .menu .menu {
+.toolbar .vertical .menu .menu .menu {
   margin-left: 1.3333em; /* LTR */
 }
-[dir="rtl"] .toolbar .toolbar-tray-vertical .menu .menu .menu {
+[dir="rtl"] .toolbar .vertical .menu .menu .menu {
   margin-left: 0;
   margin-right: 1.3333em;
 }
-.toolbar .toolbar-tray-vertical .menu .menu .menu .menu {
+.toolbar .vertical .menu .menu .menu .menu {
   margin-left: 0.25em; /* LTR */
 }
-[dir="rtl"] .toolbar .toolbar-tray-vertical .menu .menu .menu .menu {
+[dir="rtl"] .toolbar .vertical .menu .menu .menu .menu {
   margin-left: 0;
   margin-right: 0.25em;
 }
 .toolbar .menu .menu a {
   color: #434343;
 }
-.toolbar .toolbar-tray-vertical .menu .menu .menu a {
+.toolbar .vertical .menu .menu .menu a {
   padding-left: 0.6667em; /* LTR */
 }
-[dir="rtl"] .toolbar .toolbar-tray-vertical .menu .menu .menu a {
+[dir="rtl"] .toolbar .vertical .menu .menu .menu a {
   padding-left: 0;
   padding-right: 0.5em;
 }
@@ -151,25 +157,25 @@
 /**
  * Orientation toggle.
  */
-.toolbar .toolbar-toggle-orientation {
+.toolbar .toggle-orientation {
   background-color: #f5f5f5;
   padding: 0.6667em;
 }
-.toolbar .toolbar-tray-horizontal .toolbar-toggle-orientation {
+.toolbar .horizontal .toggle-orientation {
   border-left: 1px solid #c9c9c9; /* LTR */
 }
-[dir="rtl"] .toolbar .toolbar-tray-horizontal .toolbar-toggle-orientation {
+[dir="rtl"] .toolbar .horizontal .toggle-orientation {
   border-left: 0 none;
   border-right: 1px solid #c9c9c9;
 }
-.toolbar .toolbar-toggle-orientation > .toolbar-lining {
+.toolbar .toggle-orientation > .lining {
   float: right; /* LTR */
   padding: 0.1667em;
 }
-[dir="rtl"] .toolbar .toolbar-toggle-orientation > .toolbar-lining {
+[dir="rtl"] .toolbar .toggle-orientation > .lining {
   float: left;
 }
-.toolbar .toolbar-toggle-orientation button {
+.toolbar .toggle-orientation button {
   cursor: pointer;
   display: inline-block;
   height: 16px;
@@ -177,19 +183,19 @@
   text-indent: -999em;
   width: 20px;
 }
-.toolbar .toolbar-toggle-orientation button:before {
+.toolbar .toggle-orientation button:before {
   left: 0; /* LTR */
 }
-[dir="rtl"] .toolbar .toolbar-toggle-orientation button:before {
+[dir="rtl"] .toolbar .toggle-orientation button:before {
   left: auto;
   right: 0;
 }
-.toolbar .toolbar-toggle-orientation [value="vertical"]:before {
+.toolbar .toggle-orientation [value="vertical"]:before {
   background-image: url('../images/icon-toggle-vertical.png'); /* LTR */
 }
-[dir="rtl"] .toolbar .toolbar-toggle-orientation [value="vertical"]:before {
+[dir="rtl"] .toolbar .toggle-orientation [value="vertical"]:before {
   background-image: url('../images/icon-toggle-vertical-rtl.png');
 }
-.toolbar .toolbar-toggle-orientation [value="horizontal"]:before {
+.toolbar .toggle-orientation [value="horizontal"]:before {
   background-image: url('../images/icon-toggle-horizontal.png');
 }
diff --git a/core/modules/toolbar/js/toolbar.js b/core/modules/toolbar/js/toolbar.js
index dea38b5..3e12b55 100644
--- a/core/modules/toolbar/js/toolbar.js
+++ b/core/modules/toolbar/js/toolbar.js
@@ -31,7 +31,6 @@ var $messages;
  * Holds the mediaQueryList object.
  */
 var mql = {
-  narrow: null,
   standard: null,
   wide: null
 };
@@ -46,11 +45,6 @@ var mql = {
  */
 Drupal.behaviors.toolbar = {
   attach: function(context) {
-    // Verify that the sser agent understands media queries. Complex admin
-    // toolbar layouts require media query support.
-    if (!window.matchMedia('only screen').matches) {
-      return;
-    };
     var options = $.extend(this.options, drupalSettings.toolbar);
     var $toolbarOnce = $(context).find('#toolbar-administration').once('toolbar');
     if ($toolbarOnce.length) {
@@ -72,22 +66,17 @@ Drupal.behaviors.toolbar = {
       // readers.
       $messages = $(Drupal.theme('toolbarMessageBox')).appendTo($toolbar);
       // Store the trays in a scoped variable.
-      $trays = $toolbar.find('.toolbar-tray');
+      $trays = $toolbar.find('.tray');
       $trays
         // Add the tray orientation toggles.
-        .find('.toolbar-lining')
+        .find('.lining')
         .append(Drupal.theme('toolbarOrientationToggle'));
-      // Store media queries and attach a handler.
-      mql.narrow = window.matchMedia(options.breakpoints['module.toolbar.narrow']);
-      mql.narrow.addListener(Drupal.toolbar.narrowMediaQueryChangeHandler);
+      // Store media queries.
       mql.standard = window.matchMedia(options.breakpoints['module.toolbar.standard']);
-      mql.standard.addListener(Drupal.toolbar.standardMediaQueryChangeHandler);
+      // Set up switching between the vertical and horizontal presentation
+      // of the toolbar trays based on a breakpoint.
       mql.wide = window.matchMedia(options.breakpoints['module.toolbar.wide']);
-      mql.wide.addListener(Drupal.toolbar.wideMediaQueryChangeHandler);
-      // Fire each MediaQuery change handler so they process once.
-      Drupal.toolbar.narrowMediaQueryChangeHandler.call(this, mql.narrow);
-      Drupal.toolbar.standardMediaQueryChangeHandler.call(this, mql.standard);
-      Drupal.toolbar.wideMediaQueryChangeHandler.call(this, mql.wide);
+      mql.wide.addListener(Drupal.toolbar.mediaQueryChangeHandler);
       // Set the orientation of the tray.
       // If the tray is set to vertical in localStorage, persist the vertical
       // presentation. If the tray is not locked to vertical, let the media
@@ -100,8 +89,8 @@ Drupal.behaviors.toolbar = {
         .on('drupalViewportOffsetChange.toolbar', Drupal.toolbar.adjustPlacement);
       // Attach behaviors to the toolbar.
       $toolbar
-        .on('click.toolbar', '.toolbar-bar a', Drupal.toolbar.toggleTray)
-        .on('click.toolbar', '.toolbar-toggle-orientation button', Drupal.toolbar.orientationChangeHandler);
+        .on('click.toolbar', '.bar a', Drupal.toolbar.toggleTray)
+        .on('click.toolbar', '.toggle-orientation button', Drupal.toolbar.orientationChangeHandler);
       // Restore the open tab. Only open the tab on wide screens.
       if (activeTab && window.matchMedia(options.breakpoints['module.toolbar.standard']).matches) {
         $toolbar.find('[data-toolbar-tray="' + activeTab + '"]').trigger('click.toolbar');
@@ -117,7 +106,6 @@ Drupal.behaviors.toolbar = {
   // Default options.
   options: {
     breakpoints: {
-      'module.toolbar.narrow': '',
       'module.toolbar.standard': '',
       'module.toolbar.wide': ''
     }
@@ -145,7 +133,7 @@ Drupal.toolbar.toggleTray = function (event) {
   var $tab = $(event.target);
   var name = $tab.attr('data-toolbar-tray');
   // Activate the selected tab and associated tray.
-  var $activateTray = $toolbar.find('[data-toolbar-tray="' + name + '"].toolbar-tray').toggleClass('active');
+  var $activateTray = $toolbar.find('[data-toolbar-tray="' + name + '"].tray').toggleClass('active');
   if ($activateTray.length) {
     event.preventDefault();
     event.stopPropagation();
@@ -166,12 +154,12 @@ Drupal.toolbar.toggleTray = function (event) {
       localStorage.removeItem('Drupal.toolbar.activeTab');
     }
     // Disable non-selected tabs and trays.
-    $toolbar.find('.toolbar-bar .trigger')
+    $toolbar.find('.bar .trigger')
       .not($tab)
       .removeClass('active')
       // Set aria-pressed to false.
       .prop('aria-pressed', false);
-    $toolbar.find('.toolbar-tray').not($activateTray).removeClass('active');
+    $toolbar.find('.tray').not($activateTray).removeClass('active');
   }
   // Update the page and toolbar dimension indicators.
   updatePeripherals();
@@ -188,23 +176,18 @@ Drupal.toolbar.toggleTray = function (event) {
  *   viewport offset distances calculated by Drupal.displace().
  */
 Drupal.toolbar.adjustPlacement = function (event, offsets) {
-  if (!mql.narrow.matches) {
-    var $body = $('body');
-    var $trays = $toolbar.find('.toolbar-tray');
-    // Alter the padding on the top of the body element.
-    $body.css('padding-top', 0);
-    $trays.css('padding-top', 0);
-    // Remove any orientation classes. Make vertical the default for trays.
-    $body.removeClass('toolbar-vertical toolbar-horizontal');
-    $trays.removeClass('toolbar-tray-horizontal').addClass('toolbar-tray-vertical');
-  }
-  else {
-    // Alter the padding on the top of the body element.
-    $('body').css('padding-top', offsets.top);
-    // The navbar container is invisible. Its placement is used to determine the
-    // container for the trays.
-    $toolbar.find('.toolbar-tray').css('padding-top', $toolbar.find('.toolbar-bar').outerHeight());
+  // Set the top of the all the trays to the height of the bar.
+  var barHeight = $toolbar.find('.bar').outerHeight();
+  var bhpx =  barHeight + 'px';
+  var tray;
+  for (var i = 0, il = $trays.length; i < il; i++) {
+    tray = $trays[i];
+    if (!tray.style.top.length || (tray.style.top !== bhpx)) {
+      tray.style.top = bhpx;
+    }
   }
+  // Alter the padding on the top of the body element.
+  $('body').css('padding-top', offsets.top);
 };
 
 /**
@@ -216,53 +199,20 @@ Drupal.toolbar.adjustPlacement = function (event, offsets) {
 Drupal.toolbar.setTrayWidth = function () {
   var dir = document.documentElement.dir;
   var edge = (dir === 'rtl') ? 'right' : 'left';
-  // Remove the side offset from the trays.
-  $toolbar.find('.toolbar-tray').removeAttr('data-offset-' + edge + ' data-offset-top');
-  // If the page is wider than the narrow media query, apply offset attributes.
-  if (mql.narrow.matches) {
-    // If an active vertical tray exists, mark it as an offset element.
-    $toolbar.find('.toolbar-tray.toolbar-tray-vertical.active').attr('data-offset-' + edge, '');
-    // If an active horizontal tray exists, mark it as an offset element.
-    $toolbar.find('.toolbar-tray.toolbar-tray-horizontal.active').attr('data-offset-top', '');
-  }
+  // Remove the left offset from the trays.
+  $toolbar.find('.tray').removeAttr('data-offset-' + edge + ' data-offset-top');
+  // If an active vertical tray exists, mark it as an offset element.
+  $toolbar.find('.tray.vertical.active').attr('data-offset-' + edge, '');
+  // If an active horizontal tray exists, mark it as an offset element.
+  $toolbar.find('.tray.horizontal.active').attr('data-offset-top', '');
   // Trigger a recalculation of viewport displacing elements.
   Drupal.displace();
 };
 
 /**
- * Respond to configured narrow media query changes.
- */
-Drupal.toolbar.narrowMediaQueryChangeHandler = function (mql) {
-  var $bar = $toolbar.find('.toolbar-bar');
-  if (mql.matches) {
-    $bar.attr('data-offset-top', '');
-  }
-  else {
-    $bar.removeAttr('data-offset-top');
-  }
-  // Toggle between a basic vertical view and a more sophisticated horizontal
-  // and vertical display of the toolbar bar and trays.
-  $toolbar.toggleClass('toolbar-oriented', mql.matches);
-  if (mql.matches) {
-    changeOrientation('vertical');
-  }
-  // Update the page and toolbar dimension indicators.
-  updatePeripherals();
-};
-
-/**
- * Respond to configured standard media query changes.
- */
-Drupal.toolbar.standardMediaQueryChangeHandler = function (mql) {
-  $('body').toggleClass('toolbar-paneled', mql.matches);
-  // Update the page and toolbar dimension indicators.
-  updatePeripherals();
-};
-
-/**
- * Respond to configured wide media query changes.
+ * Respond to configured media query applicability changes.
  */
-Drupal.toolbar.wideMediaQueryChangeHandler = function (mql) {
+Drupal.toolbar.mediaQueryChangeHandler = function (mql) {
   var orientation = (mql.matches) ? 'horizontal' : 'vertical';
   changeOrientation(orientation);
   // Update the page and toolbar dimension indicators.
@@ -303,8 +253,8 @@ function changeOrientation (newOrientation, isLock) {
   }
   if ((!locked && newOrientation === 'horizontal') || newOrientation === 'vertical') {
     $trays
-      .removeClass('toolbar-tray-horizontal toolbar-tray-vertical')
-      .addClass('toolbar-tray-' + newOrientation);
+      .removeClass('horizontal vertical')
+      .addClass(newOrientation);
     orientation = newOrientation;
     toggleOrientationToggle((newOrientation === 'vertical') ? 'horizontal' : 'vertical');
   }
@@ -330,14 +280,14 @@ function toggleOrientationToggle (orientation) {
     vertical: Drupal.t('Vertical orientation')
   };
   var antiOrientation = (orientation === 'vertical') ? 'horizontal' : 'vertical';
-  var iconClass = 'toolbar-icon-toggle-' + orientation;
-  var iconAntiClass = 'toolbar-icon-toggle-' + antiOrientation;
+  var iconClass = 'icon-toggle-' + orientation;
+  var iconAntiClass = 'icon-toggle-' + antiOrientation;
   // Append a message that the tray orientation has been changed.
   setMessage(Drupal.t('Tray orientation changed to @orientation.', {
     '@orientation': antiOrientation
   }));
   // Change the tray orientation.
-  $trays.find('.toolbar-toggle-orientation button')
+  $trays.find('.toggle-orientation button')
     .val(orientation)
     .text(strings[orientation])
     .removeClass(iconAntiClass)
@@ -376,8 +326,8 @@ function setMessage (message) {
  *   A string representing a DOM fragment.
  */
 Drupal.theme.toolbarOrientationToggle = function () {
-  return '<div class="toolbar-toggle-orientation"><div class="toolbar-lining">' +
-    '<button class="toolbar-icon" type="button"></button>' +
+  return '<div class="toggle-orientation"><div class="lining">' +
+    '<button class="icon" type="button"></button>' +
     '</div></div>';
 };
 
diff --git a/core/modules/toolbar/js/toolbar.menu.js b/core/modules/toolbar/js/toolbar.menu.js
index 4671fce..3c32c50 100644
--- a/core/modules/toolbar/js/toolbar.menu.js
+++ b/core/modules/toolbar/js/toolbar.menu.js
@@ -46,7 +46,7 @@ var activeItem = drupalSettings.basePath + drupalSettings.currentPath;
      *   simply toggling its presence.
      */
     function toggleList ($item, switcher) {
-      var $toggle = $item.find('> .toolbar-box > .toolbar-handle');
+      var $toggle = $item.find('> .box > .handle');
       switcher = (typeof switcher !== 'undefined') ? switcher : !$item.hasClass('open');
       // Toggle the item open state.
       $item.toggleClass('open', switcher);
@@ -63,27 +63,27 @@ var activeItem = drupalSettings.basePath + drupalSettings.currentPath;
      *
      * Items with sub-elements have a list toggle attached to them. Menu item
      * links and the corresponding list toggle are wrapped with in a div
-     * classed with .toolbar-box. The .toolbar-box div provides a positioning
-     * context for the item list toggle.
+     * classed with .box. The .box div provides a positioning context for the
+     * item list toggle.
      *
      * @param {jQuery} $menu
      *   The root of the menu to be initialized.
      */
     function initItems ($menu) {
       var options = {
-        'class': 'toolbar-icon toolbar-handle',
+        'class': 'icon handle',
         'action': ui.handleOpen,
         'text': ''
       };
       // Initialize items and their links.
-      $menu.find('li > a').wrap('<div class="toolbar-box">');
+      $menu.find('li > a').wrap('<div class="box">');
         // Add a handle to each list item if it has a menu.
       $menu.find('li').each(function (index, element) {
           var $item = $(element);
           if ($item.find('> ul.menu').length) {
-            var $box = $item.children('.toolbar-box');
+            var $box = $item.find('> .box');
             options.text = Drupal.t('@label', {'@label': $box.find('a').text()});
-            $item.children('.toolbar-box')
+            $item.find('> .box')
               .append(Drupal.theme('toolbarMenuItemToggle', options));
           }
         });
@@ -130,7 +130,7 @@ var activeItem = drupalSettings.basePath + drupalSettings.currentPath;
     }
     // Bind event handlers.
     $(document)
-      .on('click.toolbar', '.toolbar-handle', toggleClickHandler);
+      .on('click.toolbar', '.handle', toggleClickHandler);
     // Return the jQuery object.
     return this.each(function (selector) {
       var $menu = $(this).once('toolbar-menu');
diff --git a/core/modules/toolbar/lib/Drupal/toolbar/Access/SubtreeAccess.php b/core/modules/toolbar/lib/Drupal/toolbar/Access/SubtreeAccess.php
index f61add9..6f8a90e 100644
--- a/core/modules/toolbar/lib/Drupal/toolbar/Access/SubtreeAccess.php
+++ b/core/modules/toolbar/lib/Drupal/toolbar/Access/SubtreeAccess.php
@@ -7,20 +7,20 @@
 
 namespace Drupal\toolbar\Access;
 
-use Drupal\Core\Access\StaticAccessCheckInterface;
+use Drupal\Core\Access\AccessCheckInterface;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\Routing\Route;
 
 /**
  * Defines a special access checker for the toolbar subtree route.
  */
-class SubtreeAccess implements StaticAccessCheckInterface {
+class SubtreeAccess implements AccessCheckInterface {
 
   /**
    * {@inheritdoc}
    */
-  public function appliesTo() {
-    return array('_access_toolbar_subtree');
+  public function applies(Route $route) {
+    return array_key_exists('_access_toolbar_subtree', $route->getRequirements());
   }
 
   /**
diff --git a/core/modules/toolbar/lib/Drupal/toolbar/Tests/ToolbarMenuTranslationTest.php b/core/modules/toolbar/lib/Drupal/toolbar/Tests/ToolbarMenuTranslationTest.php
index 02c01d4..a11eaab 100644
--- a/core/modules/toolbar/lib/Drupal/toolbar/Tests/ToolbarMenuTranslationTest.php
+++ b/core/modules/toolbar/lib/Drupal/toolbar/Tests/ToolbarMenuTranslationTest.php
@@ -89,7 +89,7 @@ function testToolbarClasses() {
     // Go to another page in the custom language and make sure the menu item
     // was translated.
     $this->drupalGet($langcode . '/admin/structure');
-    $this->assertText($menu_item_translated, 'Found the menu translated.');
+    $this->assertText($menu_item_translated, t('Found the menu translated.'));
 
     // Toolbar icons are included based on the presence of a specific class on
     // the menu item. Ensure that class also exists for a translated menu item.
diff --git a/core/modules/toolbar/toolbar.api.php b/core/modules/toolbar/toolbar.api.php
index 412331f..9bf59f9 100644
--- a/core/modules/toolbar/toolbar.api.php
+++ b/core/modules/toolbar/toolbar.api.php
@@ -16,9 +16,9 @@
  * The toolbar is a container for adminstrative and site-global interactive
  * components.
  *
- * The toolbar provides a common styling for items denoted by the
- * .toolbar-tab class. The theme wrapper toolbar_tab_wrapper is provided to wrap
- * a toolbar item with the appropriate markup to apply the styling.
+ * The toolbar provides a common styling for items denoted by the .tab class.
+ * The theme wrapper toolbar_tab_wrapper is provided to wrap a toolbar item
+ * with the appropriate markup to apply the styling.
  *
  * The toolbar provides a construct called a 'tray'. The tray is a container
  * for content. The tray may be associated with a toggle in the adminstration
@@ -77,7 +77,7 @@ function hook_toolbar() {
       '#options' => array(
         'attributes' => array(
           'title' => t('Home page'),
-          'class' => array('toolbar-icon', 'toolbar-icon-home'),
+          'class' => array('icon', 'icon-home'),
         ),
       ),
     ),
diff --git a/core/modules/toolbar/toolbar.module b/core/modules/toolbar/toolbar.module
index bae1b07..51b7d25 100644
--- a/core/modules/toolbar/toolbar.module
+++ b/core/modules/toolbar/toolbar.module
@@ -90,7 +90,8 @@ function toolbar_element_info() {
       '#heading' => t('Toolbar items'),
       '#attributes' => array(
         'id' => 'toolbar-bar',
-        'class' => array('toolbar-bar', 'clearfix',),
+        'class' => array('bar', 'clearfix',),
+        'data-offset-top' => array(),
       ),
     ),
   );
@@ -132,6 +133,8 @@ function _toolbar_initialize_page_cache() {
     $response = new Response();
     $request = \Drupal::request();
     $response->headers->set('X-Drupal-Cache', 'HIT');
+    // Restore the metadata cached with the page.
+    $_GET['q'] = $cache->data['path'];
     date_default_timezone_set(drupal_get_user_timezone());
 
     drupal_serve_page_from_cache($cache, $response, $request);
@@ -283,7 +286,7 @@ function toolbar_pre_render_item($element) {
       $element['tray']['#wrapper_attributes'] = array();
     }
     $element['tray']['#wrapper_attributes'] += $attributes;
-    $element['tray']['#wrapper_attributes']['class'][] = 'toolbar-tray';
+    $element['tray']['#wrapper_attributes']['class'][] = 'tray';
 
     if (!isset($element['tray']['#theme_wrappers'])) {
       $element['tray']['#theme_wrappers'] = array();
@@ -307,7 +310,7 @@ function template_preprocess_toolbar_tab_wrapper(&$variables) {
   if (!isset($variables['element']['#wrapper_attributes'])) {
     $variables['element']['#wrapper_attributes'] = array();
   }
-  $variables['element']['#wrapper_attributes']['class'][] = 'toolbar-tab';
+  $variables['element']['#wrapper_attributes']['class'][] = 'tab';
 }
 
 /**
@@ -360,7 +363,7 @@ function theme_toolbar_tab_wrapper(&$variables) {
 function theme_toolbar_tray_wrapper(&$variables) {
   if (!empty($variables['element']['#children'])) {
     $element = $variables['element'];
-    return '<div' . new Attribute($element['#wrapper_attributes']) . '><div class="toolbar-lining clearfix">' . $element['#children'] . '</div></div>';
+    return '<div' . new Attribute($element['#wrapper_attributes']) . '><div class="lining clearfix">' . $element['#children'] . '</div></div>';
   }
 }
 
@@ -411,7 +414,7 @@ function toolbar_toolbar() {
       '#options' => array(
         'attributes' => array(
           'title' => t('Home page'),
-          'class' => array('toolbar-icon', 'toolbar-icon-home'),
+          'class' => array('icon', 'icon-home'),
         ),
       ),
     ),
@@ -453,7 +456,7 @@ function toolbar_toolbar() {
       '#options' => array(
         'attributes' => array(
           'title' => t('Admin menu'),
-          'class' => array('toolbar-icon', 'toolbar-icon-menu'),
+          'class' => array('icon', 'icon-menu'),
         ),
       ),
     ),
@@ -509,8 +512,8 @@ function toolbar_menu_navigation_links(&$tree) {
     $tree[$key]['link']['localized_options']['attributes'] = array(
       'id' => 'toolbar-link-' . str_replace(array('/', '<', '>'), array('-', '', ''), $item['link']['link_path']),
       'class' => array(
-        'toolbar-icon',
-        'toolbar-icon-' . strtolower(str_replace(' ', '-', $item['link']['link_title'])),
+        'icon',
+        'icon-' . strtolower(str_replace(' ', '-', $item['link']['link_title'])),
       ),
       'title' => check_plain($item['link']['description']),
     );
@@ -629,7 +632,7 @@ function toolbar_library_info() {
  */
 function _toolbar_get_subtree_hash() {
   global $user;
-  $cid = $user->id() . ':' . language(Language::TYPE_INTERFACE)->id;
+  $cid = $user->uid . ':' . language(Language::TYPE_INTERFACE)->id;
   if ($cache = cache('toolbar')->get($cid)) {
     $hash = $cache->data;
   }
diff --git a/core/modules/tour/css/tour.module.css b/core/modules/tour/css/tour.module.css
index afb0afd..c96ce49 100644
--- a/core/modules/tour/css/tour.module.css
+++ b/core/modules/tour/css/tour.module.css
@@ -4,23 +4,23 @@
  */
 
 /* Tab appearance. */
-.toolbar .toolbar-bar .tour-toolbar-tab.toolbar-tab {
+.js .toolbar .bar .tour-toolbar-tab.tab {
   float: right; /* LTR */
 }
-[dir="rtl"] .toolbar .toolbar-bar .tour-toolbar-tab.toolbar-tab {
+.js[dir="rtl"] .toolbar .bar .tour-toolbar-tab.tab {
   float: left;
 }
-.toolbar .tour-toolbar-tab button {
+.js .toolbar .tour-toolbar-tab button {
   padding-bottom: 1em;
   padding-top: 1em;
   color: #fff;
   font-weight: bold;
 }
-.toolbar .tour-toolbar-tab button.active {
+.js .toolbar .tour-toolbar-tab button.active {
   background-image: -webkit-linear-gradient(rgba(255, 255, 255, 0.25) 20%, transparent 200%);
   background-image: linear-gradient(rgba(255, 255, 255, 0.25) 20%, transparent 200%);
 }
-.tour-toolbar-tab button:focus {
+.js .tour-toolbar-tab button:focus {
   outline: thin dotted;
 }
 
@@ -41,6 +41,6 @@
 }
 
 /* @todo Remove once http://drupal.org/node/1916690 is resolved. */
-.toolbar .tour-toolbar-tab.toolbar-tab.hidden {
+.js .toolbar .tour-toolbar-tab.tab.hidden {
   display: none;
 }
diff --git a/core/modules/tour/lib/Drupal/tour/TipPluginManager.php b/core/modules/tour/lib/Drupal/tour/TipPluginManager.php
index f8b9f76..e23669b 100644
--- a/core/modules/tour/lib/Drupal/tour/TipPluginManager.php
+++ b/core/modules/tour/lib/Drupal/tour/TipPluginManager.php
@@ -7,35 +7,32 @@
 
 namespace Drupal\tour;
 
-use Drupal\Core\Cache\CacheBackendInterface;
-use Drupal\Core\Extension\ModuleHandlerInterface;
-use Drupal\Core\Language\LanguageManager;
-use Drupal\Core\Plugin\DefaultPluginManager;
+use Drupal\Component\Plugin\Discovery\ProcessDecorator;
+use Drupal\Component\Plugin\PluginManagerBase;
+use Drupal\Core\Plugin\Discovery\AlterDecorator;
+use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
+use Drupal\Core\Plugin\Discovery\CacheDecorator;
+use Drupal\Core\Plugin\Factory\ContainerFactory;
 
 /**
  * Configurable tour manager.
  */
-class TipPluginManager extends DefaultPluginManager {
+class TipPluginManager extends PluginManagerBase {
 
   /**
-   * Constructs a new TipPluginManager.
+   * Overrides \Drupal\Component\Plugin\PluginManagerBase::__construct().
    *
    * @param \Traversable $namespaces
    *   An object that implements \Traversable which contains the root paths
    *   keyed by the corresponding namespace to look for plugin implementations,
-   * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend
-   *   Cache backend instance to use.
-   * @param \Drupal\Core\Language\LanguageManager $language_manager
-   *   The language manager.
-   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
-   *   The module handler to invoke the alter hook with.
    */
-  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, LanguageManager $language_manager, ModuleHandlerInterface $module_handler) {
+  public function __construct(\Traversable $namespaces) {
     $annotation_namespaces = array('Drupal\tour\Annotation' => $namespaces['Drupal\tour']);
-    parent::__construct('tour/tip', $namespaces, $annotation_namespaces, 'Drupal\tour\Annotation\Tip');
+    $this->discovery = new AnnotatedClassDiscovery('tour/tip', $namespaces, $annotation_namespaces, 'Drupal\tour\Annotation\Tip');
+    $this->discovery = new AlterDecorator($this->discovery, 'tour_tips_info');
+    $this->discovery = new CacheDecorator($this->discovery, 'tour');
 
-    $this->alterInfo($module_handler, 'tour_tips_info');
-    $this->setCacheBackend($cache_backend, $language_manager, 'tour');
+    $this->factory = new ContainerFactory($this->discovery);
   }
 
 }
diff --git a/core/modules/tour/tour.module b/core/modules/tour/tour.module
index 4f9ea1b..48e44f6 100644
--- a/core/modules/tour/tour.module
+++ b/core/modules/tour/tour.module
@@ -83,7 +83,7 @@ function tour_toolbar() {
       '#tag' => 'button',
       '#value' => t('Tour'),
       '#attributes' => array(
-        'class' => array('toolbar-icon', 'toolbar-icon-help'),
+        'class' => array('icon', 'icon-help'),
         'role' => 'button',
         'aria-pressed' => 'false',
       ),
diff --git a/core/modules/tour/tour.services.yml b/core/modules/tour/tour.services.yml
index 98e5e99..c4cf3fa 100644
--- a/core/modules/tour/tour.services.yml
+++ b/core/modules/tour/tour.services.yml
@@ -1,4 +1,4 @@
 services:
   plugin.manager.tour.tip:
     class: Drupal\tour\TipPluginManager
-    arguments: ['@container.namespaces', '@cache.cache', '@language_manager', '@module_handler']
+    arguments: ['@container.namespaces']
diff --git a/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerNodeAccessTest.php b/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerNodeAccessTest.php
index 76033fb..d9db513 100644
--- a/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerNodeAccessTest.php
+++ b/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerNodeAccessTest.php
@@ -61,7 +61,7 @@ function testTrackerNodeAccess() {
     $this->drupalGet('tracker');
     $this->assertText($private_node->title, 'Private node is visible to user with private access.');
     $this->assertText($public_node->title, 'Public node is visible to user with private access.');
-    $this->drupalGet('user/' . $access_user->id() . '/track');
+    $this->drupalGet('user/' . $access_user->uid . '/track');
     $this->assertText($private_node->title, 'Private node is visible to user with private access.');
     $this->assertText($public_node->title, 'Public node is visible to user with private access.');
 
@@ -70,7 +70,7 @@ function testTrackerNodeAccess() {
     $this->drupalGet('tracker');
     $this->assertNoText($private_node->title, 'Private node is not visible to user without private access.');
     $this->assertText($public_node->title, 'Public node is visible to user without private access.');
-    $this->drupalGet('user/' . $access_user->id() . '/track');
+    $this->drupalGet('user/' . $access_user->uid . '/track');
     $this->assertNoText($private_node->title, 'Private node is not visible to user without private access.');
     $this->assertText($public_node->title, 'Public node is visible to user without private access.');
   }
diff --git a/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php b/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php
index baa48d0..b68b722 100644
--- a/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php
+++ b/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php
@@ -91,22 +91,22 @@ function testTrackerUser() {
 
     $unpublished = $this->drupalCreateNode(array(
       'title' => $this->randomName(8),
-      'uid' => $this->user->id(),
+      'uid' => $this->user->uid,
       'status' => 0,
     ));
     $my_published = $this->drupalCreateNode(array(
       'title' => $this->randomName(8),
-      'uid' => $this->user->id(),
+      'uid' => $this->user->uid,
       'status' => 1,
     ));
     $other_published_no_comment = $this->drupalCreateNode(array(
       'title' => $this->randomName(8),
-      'uid' => $this->other_user->id(),
+      'uid' => $this->other_user->uid,
       'status' => 1,
     ));
     $other_published_my_comment = $this->drupalCreateNode(array(
       'title' => $this->randomName(8),
-      'uid' => $this->other_user->id(),
+      'uid' => $this->other_user->uid,
       'status' => 1,
     ));
     $comment = array(
@@ -115,7 +115,7 @@ function testTrackerUser() {
     );
     $this->drupalPost('comment/reply/' . $other_published_my_comment->nid, $comment, t('Save'));
 
-    $this->drupalGet('user/' . $this->user->id() . '/track');
+    $this->drupalGet('user/' . $this->user->uid . '/track');
     $this->assertNoText($unpublished->label(), "Unpublished nodes do not show up in the users's tracker listing.");
     $this->assertText($my_published->label(), "Published nodes show up in the user's tracker listing.");
     $this->assertNoText($other_published_no_comment->label(), "Other user's nodes do not show up in the user's tracker listing.");
@@ -125,7 +125,7 @@ function testTrackerUser() {
     $admin_user = $this->drupalCreateUser(array('post comments', 'administer comments', 'access user profiles'));
     $this->drupalLogin($admin_user);
     $this->drupalPost('comment/1/edit', array('status' => COMMENT_NOT_PUBLISHED), t('Save'));
-    $this->drupalGet('user/' . $this->user->id() . '/track');
+    $this->drupalGet('user/' . $this->user->uid . '/track');
     $this->assertNoText($other_published_my_comment->label(), 'Unpublished comments are not counted on the tracker listing.');
   }
 
@@ -234,7 +234,7 @@ function testTrackerCronIndexing() {
     $this->drupalLogin($this->user);
 
     // Fetch the user's tracker.
-    $this->drupalGet('tracker/' . $this->user->id());
+    $this->drupalGet('tracker/' . $this->user->uid);
 
     // Assert that all node titles are displayed.
     foreach ($nodes as $i => $node) {
diff --git a/core/modules/tracker/tests/modules/tracker_test_views/test_views/views.view.test_tracker_user_uid.yml b/core/modules/tracker/tests/modules/tracker_test_views/test_views/views.view.test_tracker_user_uid.yml
index a5b5184..fec4c92 100644
--- a/core/modules/tracker/tests/modules/tracker_test_views/test_views/views.view.test_tracker_user_uid.yml
+++ b/core/modules/tracker/tests/modules/tracker_test_views/test_views/views.view.test_tracker_user_uid.yml
@@ -94,7 +94,6 @@ display:
           empty_zero: '0'
           hide_alter_empty: '1'
           link_to_node: '1'
-          provider: node
       filters:
         uid_touch_tracker:
           id: uid_touch_tracker
@@ -136,7 +135,6 @@ display:
             default_group_multiple: {  }
             group_items: {  }
           plugin_id: tracker_user_uid
-          provider: tracker
       arguments:
         uid_touch_tracker:
           id: uid_touch_tracker
@@ -173,7 +171,6 @@ display:
             fail: 'not found'
           validate_options: {  }
           plugin_id: tracker_user_uid
-          provider: tracker
 label: 'tracker test'
 module: views
 id: test_tracker_user_uid
diff --git a/core/modules/tracker/tracker.module b/core/modules/tracker/tracker.module
index edcd297..58de969 100644
--- a/core/modules/tracker/tracker.module
+++ b/core/modules/tracker/tracker.module
@@ -171,7 +171,7 @@ function tracker_cron() {
  */
 function _tracker_myrecent_access($account) {
   // This path is only allowed for authenticated users looking at their own content.
-  return $account->id() && ($GLOBALS['user']->id() == $account->id()) && user_access('access content');
+  return $account->uid && ($GLOBALS['user']->uid == $account->uid) && user_access('access content');
 }
 
 /**
diff --git a/core/modules/tracker/tracker.pages.inc b/core/modules/tracker/tracker.pages.inc
index eabd7f4..3d274e8 100644
--- a/core/modules/tracker/tracker.pages.inc
+++ b/core/modules/tracker/tracker.pages.inc
@@ -22,7 +22,7 @@ function tracker_page($account = NULL, $set_title = FALSE) {
     $query = db_select('tracker_user', 't')
       ->extend('Drupal\Core\Database\Query\PagerSelectExtender')
       ->addMetaData('base_table', 'tracker_user')
-      ->condition('t.uid', $account->id());
+      ->condition('t.uid', $account->uid);
 
     if ($set_title) {
       // When viewed from user/%user/track, display the name of the user
@@ -83,7 +83,7 @@ function tracker_page($account = NULL, $set_title = FALSE) {
         'type' => check_plain(node_get_type_label($node)),
         // Do not use $node->label(), because $node comes from the database.
         'title' => array('data' => l($node->title, 'node/' . $node->nid) . ' ' . drupal_render($mark_build)),
-        'author' => array('data' => array('#theme' => 'username', '#account' => user_load($node->uid))),
+        'author' => array('data' => array('#theme' => 'username', '#account' => $node)),
         'replies' => array('class' => array('replies'), 'data' => $comments),
         'last updated' => array('data' => t('!time ago', array('!time' => format_interval(REQUEST_TIME - $node->last_activity)))),
       );
diff --git a/core/modules/translation/translation.module b/core/modules/translation/translation.module
index 562f0b2..9c88847 100644
--- a/core/modules/translation/translation.module
+++ b/core/modules/translation/translation.module
@@ -121,14 +121,14 @@ function translation_permission() {
 }
 
 /**
- * Implements hook_node_create_access().
+ * Implements hook_node_access().
  */
-function translation_node_create_access($account) {
+function translation_node_access($node, $op, $account, $langcode) {
   $query = Drupal::request()->query;
   $translation = $query->get('translation');
   $target = $query->get('target');
   $request_has_translation_arg = !empty($translation) && !empty($target) && is_numeric($translation);
-  if ($request_has_translation_arg) {
+  if ($op == 'create' && $request_has_translation_arg) {
     $source_node = node_load($translation);
     if (empty($source_node) || !translation_user_can_translate_node($source_node, $account)){
       return NODE_ACCESS_DENY;
@@ -154,7 +154,7 @@ function translation_user_can_translate_node($node, $account = NULL) {
   if (empty($account)) {
     $account = $GLOBALS['user'];
   }
-  return node_access('view', $node, $account) && (user_access('translate all content', $account) || ($node->uid == $account->id() && user_access('translate own content', $account)));
+  return node_access('view', $node, $account) && (user_access('translate all content', $account) || ($node->uid == $account->uid && user_access('translate own content', $account)));
 }
 
 /**
diff --git a/core/modules/update/update.fetch.inc b/core/modules/update/update.fetch.inc
index 3fce023..2d03d49 100644
--- a/core/modules/update/update.fetch.inc
+++ b/core/modules/update/update.fetch.inc
@@ -355,7 +355,7 @@ function _update_cron_notify() {
       $default_langcode = language_default()->id;
       foreach ($notify_list as $target) {
         if ($target_user = user_load_by_mail($target)) {
-          $target_langcode = $target_user->getPreferredLangcode();
+          $target_langcode = user_preferred_langcode($target_user);
         }
         else {
           $target_langcode = $default_langcode;
diff --git a/core/modules/update/update.module b/core/modules/update/update.module
index 111aa14..83ba194 100644
--- a/core/modules/update/update.module
+++ b/core/modules/update/update.module
@@ -444,7 +444,7 @@ function update_get_available($refresh = FALSE) {
  */
 function update_create_fetch_task($project) {
   module_load_include('inc', 'update', 'update.fetch');
-  _update_create_fetch_task($project);
+  return _update_create_fetch_task($project);
 }
 
 /**
@@ -454,7 +454,7 @@ function update_create_fetch_task($project) {
  */
 function update_refresh() {
   module_load_include('inc', 'update', 'update.fetch');
-  _update_refresh();
+  return _update_refresh();
 }
 
 /**
@@ -464,7 +464,7 @@ function update_refresh() {
  */
 function update_fetch_data() {
   module_load_include('inc', 'update', 'update.fetch');
-  _update_fetch_data();
+  return _update_fetch_data();
 }
 
 /**
diff --git a/core/modules/user/config/rdf.mapping.user.user.yml b/core/modules/user/config/rdf.mapping.user.user.yml
deleted file mode 100644
index ad082a9..0000000
--- a/core/modules/user/config/rdf.mapping.user.user.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-id: user.user
-targetEntityType: user
-bundle: user
-types:
-  - 'schema:Person'
-fieldMappings:
-  name:
-    properties:
-      - 'schema:name'
diff --git a/core/modules/user/config/views.view.user_admin_people.yml b/core/modules/user/config/views.view.user_admin_people.yml
index 89fd1c9..6a08227 100644
--- a/core/modules/user/config/views.view.user_admin_people.yml
+++ b/core/modules/user/config/views.view.user_admin_people.yml
@@ -187,7 +187,6 @@ display:
           empty_zero: '0'
           hide_alter_empty: '1'
           plugin_id: user_bulk_form
-          provider: user
         name:
           id: name
           table: users
@@ -241,7 +240,6 @@ display:
           anonymous_text: ''
           format_username: '1'
           plugin_id: user_name
-          provider: user
         status:
           id: status
           table: users
@@ -295,7 +293,6 @@ display:
           type_custom_false: ''
           not: '0'
           plugin_id: boolean
-          provider: views
         rid:
           id: rid
           table: users_roles
@@ -347,7 +344,6 @@ display:
           type: ul
           separator: ', '
           plugin_id: user_roles
-          provider: user
         created:
           id: created
           table: users
@@ -400,7 +396,6 @@ display:
           custom_date_format: ''
           timezone: ''
           plugin_id: date
-          provider: views
         access:
           id: access
           table: users
@@ -453,7 +448,6 @@ display:
           custom_date_format: ''
           timezone: ''
           plugin_id: date
-          provider: views
         edit_node:
           id: edit_node
           table: users
@@ -504,7 +498,6 @@ display:
           hide_alter_empty: '1'
           text: Edit
           plugin_id: user_link_edit
-          provider: user
         translation_link:
           id: translation_link
           table: users
@@ -747,7 +740,6 @@ display:
             group_items: {  }
           reduce_duplicates: '0'
           plugin_id: user_roles
-          provider: user
         permission:
           id: permission
           table: users_roles
@@ -788,7 +780,6 @@ display:
             group_items: {  }
           reduce_duplicates: '0'
           plugin_id: user_permissions
-          provider: user
         status:
           id: status
           table: users
@@ -802,7 +793,7 @@ display:
           exposed: '1'
           expose:
             operator_id: ''
-            label: ''
+            label: Active
             description: ''
             use_operator: '0'
             operator: status_op
@@ -814,28 +805,19 @@ display:
               authenticated: authenticated
               anonymous: '0'
               administrator: '0'
-          is_grouped: '1'
+          is_grouped: '0'
           group_info:
-            label: 'Status'
+            label: ''
             description: ''
-            identifier: status
+            identifier: ''
             optional: '1'
             widget: select
             multiple: '0'
             remember: '0'
             default_group: All
             default_group_multiple: {  }
-            group_items:
-              1:
-                title: Active
-                operator: '='
-                value: '1'
-              2:
-                title: Blocked
-                operator: '='
-                value: '0'
+            group_items: {  }
           plugin_id: boolean
-          provider: views
         uid_raw:
           id: uid_raw
           table: users
@@ -875,7 +857,6 @@ display:
             default_group_multiple: {  }
             group_items: {  }
           plugin_id: numeric
-          provider: views
       sorts:
         created:
           id: created
@@ -890,7 +871,6 @@ display:
             label: ''
           granularity: second
           plugin_id: date
-          provider: views
       title: People
       empty:
         area_text_custom:
@@ -904,7 +884,6 @@ display:
           tokenize: '0'
           content: 'No people available.'
           plugin_id: text_custom
-          provider: views
       use_more: '0'
       use_more_always: '0'
       use_more_text: more
diff --git a/core/modules/user/css/user.module.css b/core/modules/user/css/user.module.css
index 900a60d..c8c0317 100644
--- a/core/modules/user/css/user.module.css
+++ b/core/modules/user/css/user.module.css
@@ -110,10 +110,10 @@ div.password-suggestions ul {
 /**
  * Toolbar icon.
  */
-.toolbar-icon-user:before {
+.icon-user:before {
   background-image: url(../images/icon-user.png);
 }
-.toolbar-icon-user:active:before,
-.toolbar-icon-user.active:before {
+.icon-user:active:before,
+.icon-user.active:before {
   background-image: url(../images/icon-user-active.png);
 }
diff --git a/core/modules/user/lib/Drupal/user/Access/LoginStatusCheck.php b/core/modules/user/lib/Drupal/user/Access/LoginStatusCheck.php
index de92fc4..7148709 100644
--- a/core/modules/user/lib/Drupal/user/Access/LoginStatusCheck.php
+++ b/core/modules/user/lib/Drupal/user/Access/LoginStatusCheck.php
@@ -7,27 +7,27 @@
 
 namespace Drupal\user\Access;
 
-use Drupal\Core\Access\StaticAccessCheckInterface;
+use Drupal\Core\Access\AccessCheckInterface;
 use Symfony\Component\Routing\Route;
 use Symfony\Component\HttpFoundation\Request;
 
 /**
  * Determines access to routes based on login status of current user.
  */
-class LoginStatusCheck implements StaticAccessCheckInterface {
+class LoginStatusCheck implements AccessCheckInterface {
 
   /**
    * {@inheritdoc}
    */
-  public function appliesTo() {
-    return array('_user_is_logged_in');
+  public function applies(Route $route) {
+    return array_key_exists('_user_is_logged_in', $route->getRequirements());
   }
 
   /**
    * {@inheritdoc}
    */
   public function access(Route $route, Request $request) {
-    return (bool) $GLOBALS['user']->id();
+    return (bool) $GLOBALS['user']->uid;
   }
 
 }
diff --git a/core/modules/user/lib/Drupal/user/Access/PermissionAccessCheck.php b/core/modules/user/lib/Drupal/user/Access/PermissionAccessCheck.php
index f175653..519ba86 100644
--- a/core/modules/user/lib/Drupal/user/Access/PermissionAccessCheck.php
+++ b/core/modules/user/lib/Drupal/user/Access/PermissionAccessCheck.php
@@ -7,20 +7,20 @@
 
 namespace Drupal\user\Access;
 
-use Drupal\Core\Access\StaticAccessCheckInterface;
+use Drupal\Core\Access\AccessCheckInterface;
 use Symfony\Component\Routing\Route;
 use Symfony\Component\HttpFoundation\Request;
 
 /**
  * Determines access to routes based on permissions defined via hook_permission().
  */
-class PermissionAccessCheck implements StaticAccessCheckInterface {
+class PermissionAccessCheck implements AccessCheckInterface {
 
   /**
-   * {@inheritdoc}
+   * Implements AccessCheckInterface::applies().
    */
-  public function appliesTo() {
-    return array('_permission');
+  public function applies(Route $route) {
+    return array_key_exists('_permission', $route->getRequirements());
   }
 
   /**
diff --git a/core/modules/user/lib/Drupal/user/Access/RegisterAccessCheck.php b/core/modules/user/lib/Drupal/user/Access/RegisterAccessCheck.php
index a7e3933..f8adae4 100644
--- a/core/modules/user/lib/Drupal/user/Access/RegisterAccessCheck.php
+++ b/core/modules/user/lib/Drupal/user/Access/RegisterAccessCheck.php
@@ -7,20 +7,20 @@
 
 namespace Drupal\user\Access;
 
-use Drupal\Core\Access\StaticAccessCheckInterface;
+use Drupal\Core\Access\AccessCheckInterface;
 use Symfony\Component\Routing\Route;
 use Symfony\Component\HttpFoundation\Request;
 
 /**
  * Access check for user registration routes.
  */
-class RegisterAccessCheck implements StaticAccessCheckInterface {
+class RegisterAccessCheck implements AccessCheckInterface {
 
   /**
-   * {@inheritdoc}
+   * Implements AccessCheckInterface::applies().
    */
-  public function appliesTo() {
-    return array('_access_user_register');
+  public function applies(Route $route) {
+    return array_key_exists('_access_user_register', $route->getRequirements());
   }
 
   /**
diff --git a/core/modules/user/lib/Drupal/user/Access/RoleAccessCheck.php b/core/modules/user/lib/Drupal/user/Access/RoleAccessCheck.php
index e2e9693..fd9756f 100644
--- a/core/modules/user/lib/Drupal/user/Access/RoleAccessCheck.php
+++ b/core/modules/user/lib/Drupal/user/Access/RoleAccessCheck.php
@@ -7,7 +7,7 @@
 
 namespace Drupal\user\Access;
 
-use Drupal\Core\Access\StaticAccessCheckInterface;
+use Drupal\Core\Access\AccessCheckInterface;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\Routing\Route;
 
@@ -18,13 +18,13 @@
  * single role, users with that role with have access. If you specify multiple
  * ones you can conjunct them with AND by using a "+" and with OR by using ",".
  */
-class RoleAccessCheck implements StaticAccessCheckInterface {
+class RoleAccessCheck implements AccessCheckInterface {
 
   /**
    * {@inheritdoc}
    */
-  public function appliesTo() {
-    return array('_role');
+  public function applies(Route $route) {
+    return array_key_exists('_role', $route->getRequirements());
   }
 
   /**
diff --git a/core/modules/user/lib/Drupal/user/AccountFormController.php b/core/modules/user/lib/Drupal/user/AccountFormController.php
index 950c341..6505d29 100644
--- a/core/modules/user/lib/Drupal/user/AccountFormController.php
+++ b/core/modules/user/lib/Drupal/user/AccountFormController.php
@@ -24,7 +24,7 @@ public function form(array $form, array &$form_state) {
     $config = config('user.settings');
 
     $language_interface = language(Language::TYPE_INTERFACE);
-    $register = $account->isAnonymous();
+    $register = empty($account->uid);
     $admin = user_access('administer users');
 
     // Account information.
@@ -43,7 +43,7 @@ public function form(array $form, array &$form_state) {
       '#attributes' => array('class' => array('username'), 'autocorrect' => 'off', 'autocomplete' => 'off', 'autocapitalize' => 'off',
       'spellcheck' => 'false'),
       '#default_value' => (!$register ? $account->name : ''),
-      '#access' => ($register || ($user->id() == $account->id() && user_access('change own username')) || $admin),
+      '#access' => ($register || ($user->uid == $account->uid && user_access('change own username')) || $admin),
       '#weight' => -10,
     );
 
@@ -70,7 +70,7 @@ public function form(array $form, array &$form_state) {
 
       // To skip the current password field, the user must have logged in via a
       // one-time link and have the token in the URL.
-      $pass_reset = isset($_SESSION['pass_reset_' . $account->id()]) && isset($_GET['pass-reset-token']) && ($_GET['pass-reset-token'] == $_SESSION['pass_reset_' . $account->id()]);
+      $pass_reset = isset($_SESSION['pass_reset_' . $account->uid]) && isset($_GET['pass-reset-token']) && ($_GET['pass-reset-token'] == $_SESSION['pass_reset_' . $account->uid]);
       $protected_values = array();
       $current_pass_description = '';
 
@@ -84,7 +84,7 @@ public function form(array $form, array &$form_state) {
       }
 
       // The user must enter their current password to change to a new one.
-      if ($user->id() == $account->id()) {
+      if ($user->uid == $account->uid) {
         $form['account']['current_pass_required_values'] = array(
           '#type' => 'value',
           '#value' => $protected_values,
@@ -176,9 +176,9 @@ public function form(array $form, array &$form_state) {
       '#format' => isset($account->signature_format) ? $account->signature_format : NULL,
     );
 
-    $user_preferred_langcode = $register ? $language_interface->id : $account->getPreferredLangcode();
+    $user_preferred_langcode = $register ? $language_interface->id : user_preferred_langcode($account);
 
-    $user_preferred_admin_langcode = $register ? $language_interface->id : $account->getPreferredAdminLangcode();
+    $user_preferred_admin_langcode = $register ? $language_interface->id : user_preferred_langcode($account, 'admin');
 
     // Is default the interface language?
     include_once DRUPAL_ROOT . '/core/includes/language.inc';
@@ -259,7 +259,7 @@ public function validate(array $form, array &$form_state) {
       else {
         $name_taken = (bool) db_select('users')
         ->fields('users', array('uid'))
-        ->condition('uid', (int) $account->id(), '<>')
+        ->condition('uid', (int) $account->uid, '<>')
         ->condition('name', db_like($form_state['values']['name']), 'LIKE')
         ->range(0, 1)
         ->execute()
@@ -276,7 +276,7 @@ public function validate(array $form, array &$form_state) {
     if (!empty($mail)) {
       $mail_taken = (bool) db_select('users')
       ->fields('users', array('uid'))
-      ->condition('uid', (int) $account->id(), '<>')
+      ->condition('uid', (int) $account->uid, '<>')
       ->condition('mail', db_like($mail), 'LIKE')
       ->range(0, 1)
       ->execute()
@@ -284,7 +284,7 @@ public function validate(array $form, array &$form_state) {
 
       if ($mail_taken) {
         // Format error message dependent on whether the user is logged in or not.
-        if ($GLOBALS['user']->isAuthenticated()) {
+        if ($GLOBALS['user']->uid) {
           form_set_error('mail', t('The e-mail address %email is already taken.', array('%email' => $mail)));
         }
         else {
diff --git a/core/modules/user/lib/Drupal/user/Controller/UserController.php b/core/modules/user/lib/Drupal/user/Controller/UserController.php
index cd63cb0..eb1dbde 100644
--- a/core/modules/user/lib/Drupal/user/Controller/UserController.php
+++ b/core/modules/user/lib/Drupal/user/Controller/UserController.php
@@ -32,8 +32,8 @@ class UserController extends ContainerAware {
    */
   public function userPage(Request $request) {
     global $user;
-    if ($user->id()) {
-      $response = new RedirectResponse(url('user/' . $user->id(), array('absolute' => TRUE)));
+    if ($user->uid) {
+      $response = new RedirectResponse(url('user/' . $user->uid, array('absolute' => TRUE)));
     }
     else {
       $response = drupal_get_form(UserLoginForm::create($this->container), $request);
diff --git a/core/modules/user/lib/Drupal/user/EventSubscriber/MaintenanceModeSubscriber.php b/core/modules/user/lib/Drupal/user/EventSubscriber/MaintenanceModeSubscriber.php
index 2c47414..bfaee91 100644
--- a/core/modules/user/lib/Drupal/user/EventSubscriber/MaintenanceModeSubscriber.php
+++ b/core/modules/user/lib/Drupal/user/EventSubscriber/MaintenanceModeSubscriber.php
@@ -29,7 +29,7 @@ public function onKernelRequestMaintenance(GetResponseEvent $event) {
     $path = $request->attributes->get('system_path');
     if ($site_status == MENU_SITE_OFFLINE) {
       // If the site is offline, log out unprivileged users.
-      if ($GLOBALS['user']->isAuthenticated() && !user_access('access site in maintenance mode')) {
+      if (user_is_logged_in() && !user_access('access site in maintenance mode')) {
         user_logout();
         // Redirect to homepage.
         $event->setResponse(new RedirectResponse(url('<front>', array('absolute' => TRUE))));
@@ -56,7 +56,7 @@ public function onKernelRequestMaintenance(GetResponseEvent $event) {
         }
       }
     }
-    if ($GLOBALS['user']->isAuthenticated()) {
+    if (user_is_logged_in()) {
       if ($path == 'user/login') {
         // If user is logged in, redirect to 'user' instead of giving 403.
         $event->setResponse(new RedirectResponse(url('user', array('absolute' => TRUE))));
@@ -64,7 +64,7 @@ public function onKernelRequestMaintenance(GetResponseEvent $event) {
       }
       if ($path == 'user/register') {
         // Authenticated user should be redirected to user edit page.
-        $event->setResponse(new RedirectResponse(url('user/' . $GLOBALS['user']->id() . '/edit', array('absolute' => TRUE))));
+        $event->setResponse(new RedirectResponse(url('user/' . $GLOBALS['user']->uid . '/edit', array('absolute' => TRUE))));
         return;
       }
     }
diff --git a/core/modules/user/lib/Drupal/user/Form/UserLoginForm.php b/core/modules/user/lib/Drupal/user/Form/UserLoginForm.php
index 9edba58..a80dbdc 100644
--- a/core/modules/user/lib/Drupal/user/Form/UserLoginForm.php
+++ b/core/modules/user/lib/Drupal/user/Form/UserLoginForm.php
@@ -190,7 +190,7 @@ public function validateAuthentication(array &$form, array &$form_state) {
         }
       }
       // We are not limited by flood control, so try to authenticate.
-      // Set $form_state['uid'] as a flag for self::validateFinal().
+      // Set $form_state['uid'] as a flag for user_login_final_validate().
       $form_state['uid'] = user_authenticate($form_state['values']['name'], $password);
     }
   }
diff --git a/core/modules/user/lib/Drupal/user/Form/UserPasswordForm.php b/core/modules/user/lib/Drupal/user/Form/UserPasswordForm.php
index 8e623d1..185a16f 100644
--- a/core/modules/user/lib/Drupal/user/Form/UserPasswordForm.php
+++ b/core/modules/user/lib/Drupal/user/Form/UserPasswordForm.php
@@ -87,7 +87,7 @@ public function buildForm(array $form, array &$form_state, Request $request = NU
       ),
     );
     // Allow logged in users to request this also.
-    if ($user->isAuthenticated()) {
+    if ($user->uid > 0) {
       $form['name']['#type'] = 'value';
       $form['name']['#value'] = $user->mail;
       $form['mail'] = array(
@@ -117,7 +117,7 @@ public function validateForm(array &$form, array &$form_state) {
       $users = $this->userStorageController->loadByProperties(array('name' => $name, 'status' => '1'));
     }
     $account = reset($users);
-    if ($account && $account->id()) {
+    if (isset($account->uid)) {
       form_set_value(array('#parents' => array('account')), $account, $form_state);
     }
     else {
diff --git a/core/modules/user/lib/Drupal/user/Plugin/Action/CancelUser.php b/core/modules/user/lib/Drupal/user/Plugin/Action/CancelUser.php
index 009cb5b..58e9e37 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/Action/CancelUser.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/Action/CancelUser.php
@@ -10,7 +10,6 @@
 use Drupal\Core\Annotation\Action;
 use Drupal\Core\Annotation\Translation;
 use Drupal\Core\Action\ActionBase;
-use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
 use Drupal\user\TempStoreFactory;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 
@@ -24,7 +23,7 @@
  *   confirm_form_path = "admin/people/cancel"
  * )
  */
-class CancelUser extends ActionBase implements ContainerFactoryPluginInterface {
+class CancelUser extends ActionBase {
 
   /**
    * The tempstore factory.
@@ -62,7 +61,7 @@ public static function create(ContainerInterface $container, array $configuratio
    * {@inheritdoc}
    */
   public function executeMultiple(array $entities) {
-    $this->tempStoreFactory->get('user_user_operations_cancel')->set($GLOBALS['user']->id(), $entities);
+    $this->tempStoreFactory->get('user_user_operations_cancel')->set($GLOBALS['user']->uid, $entities);
   }
 
   /**
diff --git a/core/modules/user/lib/Drupal/user/Plugin/Block/UserLoginBlock.php b/core/modules/user/lib/Drupal/user/Plugin/Block/UserLoginBlock.php
index ab4401c..0cc09b7 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/Block/UserLoginBlock.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/Block/UserLoginBlock.php
@@ -63,7 +63,7 @@ public function __construct(array $configuration, $plugin_id, array $plugin_defi
   }
 
   /**
-   * {@inheritdoc}
+   * {@inheritdo}
    */
   public static function create(ContainerInterface $container, array $configuration, $plugin_id, array $plugin_definition) {
     return new static(
@@ -79,7 +79,7 @@ public static function create(ContainerInterface $container, array $configuratio
    * Overrides \Drupal\block\BlockBase::access().
    */
   public function access() {
-    return (!$GLOBALS['user']->id() && !(arg(0) == 'user' && !is_numeric(arg(1))));
+    return (!$GLOBALS['user']->uid && !(arg(0) == 'user' && !is_numeric(arg(1))));
   }
 
   /**
diff --git a/core/modules/user/lib/Drupal/user/Plugin/Block/UserNewBlock.php b/core/modules/user/lib/Drupal/user/Plugin/Block/UserNewBlock.php
index 26be5ba..d7269a3 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/Block/UserNewBlock.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/Block/UserNewBlock.php
@@ -66,12 +66,12 @@ public function blockSubmit($form, &$form_state) {
    */
   public function build() {
     // Retrieve a list of new users who have accessed the site successfully.
-    $uids = db_query_range('SELECT uid FROM {users} WHERE status <> 0 AND access <> 0 ORDER BY created DESC', 0, $this->configuration['whois_new_count'])->fetchCol();
+    $items = db_query_range('SELECT uid, name FROM {users} WHERE status <> 0 AND access <> 0 ORDER BY created DESC', 0, $this->configuration['whois_new_count'])->fetchAll();
     $build = array(
       '#theme' => 'item_list__user__new',
       '#items' => array(),
     );
-    foreach (user_load_multiple($uids) as $account) {
+    foreach ($items as $account) {
       $username = array(
         '#theme' => 'username',
         '#account' => $account,
diff --git a/core/modules/user/lib/Drupal/user/Plugin/Core/Entity/User.php b/core/modules/user/lib/Drupal/user/Plugin/Core/Entity/User.php
index b229ff1..4f89128 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/Core/Entity/User.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/Core/Entity/User.php
@@ -52,6 +52,134 @@
 class User extends EntityNG implements UserInterface {
 
   /**
+   * The user ID.
+   *
+   * @var \Drupal\Core\Entity\Field\FieldInterface
+   */
+  public $uid;
+
+  /**
+   * The user UUID.
+   *
+   * @var \Drupal\Core\Entity\Field\FieldInterface
+   */
+  public $uuid;
+
+  /**
+   * The unique user name.
+   *
+   * @var \Drupal\Core\Entity\Field\FieldInterface
+   */
+  public $name;
+
+  /**
+   * The user's password (hashed).
+   *
+   * @var \Drupal\Core\Entity\Field\FieldInterface
+   */
+  public $pass;
+
+  /**
+   * The user's email address.
+   *
+   * @var \Drupal\Core\Entity\Field\FieldInterface
+   */
+  public $mail;
+
+  /**
+   * The user's default theme.
+   *
+   * @var \Drupal\Core\Entity\Field\FieldInterface
+   */
+  public $theme;
+
+  /**
+   * The user's signature.
+   *
+   * @var \Drupal\Core\Entity\Field\FieldInterface
+   */
+  public $signature;
+
+  /**
+   * The user's signature format.
+   *
+   * @var \Drupal\Core\Entity\Field\FieldInterface
+   */
+  public $signature_format;
+
+  /**
+   * The timestamp when the user was created.
+   *
+   * @var \Drupal\Core\Entity\Field\FieldInterface
+   */
+  public $created;
+
+  /**
+   * The timestamp when the user last accessed the site. A value of 0 means the
+   * user has never accessed the site.
+   *
+   * @var \Drupal\Core\Entity\Field\FieldInterface
+   */
+  public $access;
+
+  /**
+   * The timestamp when the user last logged in. A value of 0 means the user has
+   * never logged in.
+   *
+   * @var \Drupal\Core\Entity\Field\FieldInterface
+   */
+  public $login;
+
+  /**
+   * Whether the user is active (1) or blocked (0).
+   *
+   * @var \Drupal\Core\Entity\Field\FieldInterface
+   */
+  public $status;
+
+  /**
+   * The user's timezone.
+   *
+   * @var \Drupal\Core\Entity\Field\FieldInterface
+   */
+  public $timezone;
+
+  /**
+   * The user's langcode.
+   *
+   * @var \Drupal\Core\Entity\Field\FieldInterface
+   */
+  public $langcode;
+
+  /**
+   * The user's preferred langcode for receiving emails and viewing the site.
+   *
+   * @var \Drupal\Core\Entity\Field\FieldInterface
+   */
+  public $preferred_langcode;
+
+  /**
+   * The user's preferred langcode for viewing administration pages.
+   *
+   * @var \Drupal\Core\Entity\Field\FieldInterface
+   */
+  public $preferred_admin_langcode;
+
+  /**
+   * The email address used for initial account creation.
+   *
+   * @var \Drupal\Core\Entity\Field\FieldInterface
+   */
+  public $init;
+
+  /**
+   * The user's roles.
+   *
+   * @var \Drupal\Core\Entity\Field\FieldInterface
+   */
+  public $roles;
+
+  /**
    * {@inheritdoc}
    */
   public function id() {
@@ -61,6 +189,30 @@ public function id() {
   /**
    * {@inheritdoc}
    */
+  protected function init() {
+    parent::init();
+    unset($this->access);
+    unset($this->created);
+    unset($this->init);
+    unset($this->login);
+    unset($this->mail);
+    unset($this->name);
+    unset($this->pass);
+    unset($this->preferred_admin_langcode);
+    unset($this->preferred_langcode);
+    unset($this->roles);
+    unset($this->signature);
+    unset($this->signature_format);
+    unset($this->status);
+    unset($this->theme);
+    unset($this->timezone);
+    unset($this->uid);
+    unset($this->uuid);
+  }
+
+  /**
+   * {@inheritdoc}
+   */
   static function preCreate(EntityStorageControllerInterface $storage_controller, array &$values) {
     if (!isset($values['created'])) {
       $values['created'] = REQUEST_TIME;
@@ -108,7 +260,7 @@ public function postSave(EntityStorageControllerInterface $storage_controller, $
       // user and recreate the current one.
       if ($this->pass->value != $this->original->pass->value) {
         drupal_session_destroy_uid($this->id());
-        if ($this->id() == $GLOBALS['user']->id()) {
+        if ($this->id() == $GLOBALS['user']->uid) {
           drupal_session_regenerate();
         }
       }
@@ -148,7 +300,6 @@ public static function postDelete(EntityStorageControllerInterface $storage_cont
     $storage_controller->deleteUserRoles($uids);
   }
 
-
   /**
    * {@inheritdoc}
    */
@@ -185,6 +336,7 @@ public function getSecureSessionId() {
   public function getSessionData() {
     return array();
   }
+
   /**
    * {@inheritdoc}
    */
@@ -215,202 +367,4 @@ public function removeRole($rid) {
     $this->set('roles', array_diff($this->getRoles(), array($rid)));
   }
 
-  /**
-   * {@inheritdoc}
-   */
-  public function hasPermission($permission) {
-    // User #1 has all privileges.
-    if ((int) $this->id() === 1) {
-      return TRUE;
-    }
-
-    $roles = \Drupal::entityManager()->getStorageController('user_role')->loadMultiple($this->getRoles());
-
-    foreach ($roles as $role) {
-      if ($role->hasPermission($permission)) {
-        return TRUE;
-      }
-    }
-
-    return FALSE;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getPassword() {
-    return $this->get('pass')->value;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function setPassword($password) {
-    $this->get('pass')->value = $password;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getEmail() {
-    return $this->get('mail')->value;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function setEmail($mail) {
-    $this->get('mail')->value = $mail;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getDefaultTheme() {
-    return $this->get('theme')->value;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getSignature() {
-    return $this->get('signature')->value;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getSignatureFormat() {
-    return $this->get('signature_format')->value;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getCreatedTime() {
-    return $this->get('created')->value;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getLastAccessedTime() {
-    return $this->get('access')->value;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function setLastAccessTime($timestamp) {
-    $this->get('access')->value = $timestamp;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getLastLoginTime() {
-    return $this->get('login')->value;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function setLastLoginTime($timestamp) {
-    $this->get('login')->value = $timestamp;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function isActive() {
-    return $this->get('status')->value == 1;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function isBlocked() {
-    return $this->get('status')->value == 0;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function activate() {
-    $this->get('status')->value = 1;
-    return $this;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function block() {
-    $this->get('status')->value = 0;
-    return $this;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getTimeZone() {
-    return $this->get('timezone')->value;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  function getPreferredLangcode($default = NULL) {
-    $language_list = language_list();
-    $preferred_langcode = $this->get('preferred_langcode')->value;
-    if (!empty($preferred_langcode) && isset($language_list[$preferred_langcode])) {
-      return $language_list[$preferred_langcode]->id;
-    }
-    else {
-      return $default ? $default : language_default()->id;
-    }
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  function getPreferredAdminLangcode($default = NULL) {
-    $language_list = language_list();
-    $preferred_langcode = $this->get('preferred_admin_langcode')->value;
-    if (!empty($preferred_langcode) && isset($language_list[$preferred_langcode])) {
-      return $language_list[$preferred_langcode]->id;
-    }
-    else {
-      return $default ? $default : language_default()->id;
-    }
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getInitialEmail() {
-    return $this->get('init')->value;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function isAuthenticated() {
-    return $this->id() > 0;
-  }
-  /**
-   * {@inheritdoc}
-   */
-  public function isAnonymous() {
-    return $this->id() == 0;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getUsername() {
-    $name = $this->get('name')->value ?: \Drupal::config('user.settings')->get('anonymous');
-    \Drupal::moduleHandler()->alter('user_format_name', $name, $this);
-    return $name;
-  }
-
 }
diff --git a/core/modules/user/lib/Drupal/user/Plugin/entity_reference/selection/UserSelection.php b/core/modules/user/lib/Drupal/user/Plugin/entity_reference/selection/UserSelection.php
index fe96ccc..49f00a5 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/entity_reference/selection/UserSelection.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/entity_reference/selection/UserSelection.php
@@ -7,17 +7,18 @@
 
 namespace Drupal\user\Plugin\entity_reference\selection;
 
+use Drupal\Component\Annotation\Plugin;
 use Drupal\Core\Annotation\Translation;
 use Drupal\Core\Database\Database;
 use Drupal\Core\Database\Query\SelectInterface;
-use Drupal\entity_reference\Annotation\EntityReferenceSelection;
 use Drupal\entity_reference\Plugin\entity_reference\selection\SelectionBase;
 
 /**
  * Provides specific access control for the user entity type.
  *
- * @EntityReferenceSelection(
+ * @Plugin(
  *   id = "user_default",
+ *   module = "user",
  *   label = @Translation("User selection"),
  *   entity_types = {"user"},
  *   group = "default",
@@ -27,7 +28,7 @@
 class UserSelection extends SelectionBase {
 
   /**
-   * {@inheritdoc}
+   * Overrides SelectionBase::settingsForm().
    */
   public static function settingsForm(&$field, &$instance) {
     // Merge in default values.
@@ -77,7 +78,7 @@ public static function settingsForm(&$field, &$instance) {
   }
 
   /**
-   * {@inheritdoc}
+   * Overrides SelectionBase::buildEntityQuery().
    */
   public function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS') {
     $query = parent::buildEntityQuery($match, $match_operator);
@@ -96,7 +97,7 @@ public function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS') {
   }
 
   /**
-   * {@inheritdoc}
+   * Overrides SelectionBase::entityQueryAlter().
    */
   public function entityQueryAlter(SelectInterface $query) {
     if (user_access('administer users')) {
diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/argument_default/CurrentUser.php b/core/modules/user/lib/Drupal/user/Plugin/views/argument_default/CurrentUser.php
index 8ffac71..8ed758e 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/views/argument_default/CurrentUser.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/views/argument_default/CurrentUser.php
@@ -26,7 +26,7 @@ class CurrentUser extends ArgumentDefaultPluginBase {
 
   public function getArgument() {
     global $user;
-    return $user->id();
+    return $user->uid;
   }
 
 }
diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/argument_default/User.php b/core/modules/user/lib/Drupal/user/Plugin/views/argument_default/User.php
index f58c641..45c4c2a 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/views/argument_default/User.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/views/argument_default/User.php
@@ -41,14 +41,14 @@ public function getArgument() {
     foreach (range(1, 3) as $i) {
       $user = menu_get_object('user', $i);
       if (!empty($user)) {
-        return $user->id();
+        return $user->uid;
       }
     }
 
     foreach (range(1, 3) as $i) {
       $user = menu_get_object('user_uid_optional', $i);
       if (!empty($user)) {
-        return $user->id();
+        return $user->uid;
       }
     }
 
diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/argument_validator/User.php b/core/modules/user/lib/Drupal/user/Plugin/views/argument_validator/User.php
index d014602..dc3b42b 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/views/argument_validator/User.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/views/argument_validator/User.php
@@ -112,7 +112,7 @@ public function validateArgument($argument) {
     // However, is_integer() will always fail, since $argument is a string.
     if (is_numeric($argument) && $argument == (int)$argument) {
       if ($type == 'uid' || $type == 'either') {
-        if ($argument == $GLOBALS['user']->id()) {
+        if ($argument == $GLOBALS['user']->uid) {
           // If you assign an object to a variable in PHP, the variable
           // automatically acts as a reference, not a copy, so we use
           // clone to ensure that we don't actually mess with the
@@ -124,7 +124,7 @@ public function validateArgument($argument) {
     }
     else {
       if ($type == 'name' || $type == 'either') {
-        $name = $GLOBALS['user']->getUserName() ?: config('user.settings')->get('anonymous');
+        $name = !empty($GLOBALS['user']->name) ? $GLOBALS['user']->name : config('user.settings')->get('anonymous');
         if ($argument == $name) {
           $account = clone $GLOBALS['user'];
         }
@@ -138,28 +138,31 @@ public function validateArgument($argument) {
     }
 
     if (!isset($account)) {
-      $uid = $this->database->select('users', 'u')
-        ->fields('u', array('uid'))
+      $account = $this->database->select('users', 'u')
+        ->fields('u', array('uid', 'name'))
         ->condition($condition, $argument)
         ->execute()
-        ->fetchField();
-
-      if ($uid === FALSE) {
-        // User not found.
-        return FALSE;
-      }
+        ->fetchObject();
+    }
+    if (empty($account)) {
+      // User not found.
+      return FALSE;
     }
-    $account = user_load($uid);
 
     // See if we're filtering users based on roles.
     if (!empty($this->options['restrict_roles']) && !empty($this->options['roles'])) {
       $roles = $this->options['roles'];
-      if (!(bool) array_intersect($account->getRoles(), $roles)) {
+      $account->roles = array();
+      $account->roles[] = $account->uid ? DRUPAL_AUTHENTICATED_RID : DRUPAL_ANONYMOUS_RID;
+      foreach ($account->getRoles() as $rid) {
+        $account->roles[] = $rid;
+      }
+      if (!(bool) array_intersect($account->roles, $roles)) {
         return FALSE;
       }
     }
 
-    $this->argument->argument = $account->id();
+    $this->argument->argument = $account->uid;
     $this->argument->validated_title = check_plain(user_format_name($account));
     return TRUE;
   }
@@ -171,7 +174,7 @@ public function processSummaryArguments(&$args) {
     if ($this->options['type'] == 'name') {
       $users = user_load_multiple($args);
       foreach ($users as $uid => $account) {
-        $args[$uids_arg_keys[$uid]] = $account->label();
+        $args[$uids_arg_keys[$uid]] = $account->name;
       }
     }
   }
diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/field/Language.php b/core/modules/user/lib/Drupal/user/Plugin/views/field/Language.php
index 1059263..6fe5c35 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/views/field/Language.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/views/field/Language.php
@@ -38,7 +38,7 @@ function render_link($data, $values) {
     return $this->sanitizeValue($lang->name);
   }
 
-  public function render($values) {
+  function render($values) {
     $value = $this->getValue($values);
     return $this->render_link($this->sanitizeValue($value), $values);
   }
diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/field/Link.php b/core/modules/user/lib/Drupal/user/Plugin/views/field/Link.php
index a7bdb24..6656447 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/views/field/Link.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/views/field/Link.php
@@ -59,7 +59,7 @@ public function query() {
   /**
    * Overrides \Drupal\views\Plugin\views\field\FieldPluginBase::render().
    */
-  public function render($values) {
+  function render($values) {
     return $this->render_link($this->getEntity($values), $values);
   }
 
diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/field/Name.php b/core/modules/user/lib/Drupal/user/Plugin/views/field/Name.php
index 564127a..b09e84a 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/views/field/Name.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/views/field/Name.php
@@ -44,23 +44,20 @@ protected function defineOptions() {
     return $options;
   }
 
-  /**
-   * {@inheritdoc}
-   */
   public function buildOptionsForm(&$form, &$form_state) {
-    parent::buildOptionsForm($form, $form_state);
-
     $form['format_username'] = array(
       '#title' => t('Use formatted username'),
       '#type' => 'checkbox',
       '#default_value' => !empty($this->options['format_username']),
       '#description' => t('If checked, the username will be formatted by the system. If unchecked, it will be displayed raw.'),
+      '#fieldset' => 'more',
     );
     $form['overwrite_anonymous'] = array(
       '#title' => t('Overwrite the value to display for anonymous users'),
       '#type' => 'checkbox',
       '#default_value' => !empty($this->options['overwrite_anonymous']),
       '#description' => t('Enable to display different text for anonymous users.'),
+      '#fieldset' => 'more',
     );
     $form['anonymous_text'] = array(
       '#title' => t('Text to display for anonymous users'),
@@ -71,7 +68,10 @@ public function buildOptionsForm(&$form, &$form_state) {
           ':input[name="options[overwrite_anonymous]"]' => array('checked' => TRUE),
         ),
       ),
+      '#fieldset' => 'more',
     );
+
+    parent::buildOptionsForm($form, $form_state);
   }
 
   function render_link($data, $values) {
@@ -79,7 +79,7 @@ function render_link($data, $values) {
     $account->uid = $this->getValue($values, 'uid');
     $account->name = $this->getValue($values);
     if (!empty($this->options['link_to_user']) || !empty($this->options['overwrite_anonymous'])) {
-      if (!empty($this->options['overwrite_anonymous']) && !$account->id()) {
+      if (!empty($this->options['overwrite_anonymous']) && !$account->uid) {
         // This is an anonymous user, and we're overriting the text.
         return check_plain($this->options['anonymous_text']);
       }
diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/field/User.php b/core/modules/user/lib/Drupal/user/Plugin/views/field/User.php
index e6515a6..13edb18 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/views/field/User.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/views/field/User.php
@@ -60,7 +60,7 @@ function render_link($data, $values) {
     return $data;
   }
 
-  public function render($values) {
+  function render($values) {
     $value = $this->getValue($values);
     return $this->render_link($this->sanitizeValue($value), $values);
   }
diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/field/UserData.php b/core/modules/user/lib/Drupal/user/Plugin/views/field/UserData.php
index f0074fa..fe3c6e6 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/views/field/UserData.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/views/field/UserData.php
@@ -46,8 +46,8 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o
   protected function defineOptions() {
     $options = parent::defineOptions();
 
-    $options['data_module'] = array('default' => '');
-    $options['data_name'] = array('default' => '');
+    $options['module'] = array('default' => '');
+    $options['name'] = array('default' => '');
 
     return $options;
   }
@@ -58,28 +58,28 @@ protected function defineOptions() {
   public function buildOptionsForm(&$form, &$form_state) {
     parent::buildOptionsForm($form, $form_state);
 
-    $form['data_module'] = array(
+    $form['module'] = array(
       '#title' => t('Module name'),
       '#type' => 'select',
       '#description' => t('The module which sets this user data.'),
-      '#default_value' => $this->options['data_module'],
+      '#default_value' => $this->options['module'],
       '#options' => system_get_module_info('name'),
     );
 
-    $form['data_name'] = array(
+    $form['name'] = array(
       '#title' => t('Name'),
       '#type' => 'textfield',
       '#description' => t('The name of the data key.'),
-      '#default_value' => $this->options['data_name'],
+      '#default_value' => $this->options['name'],
     );
   }
 
   /**
    * Overrides \Drupal\views\Plugin\views\field\FieldPluginBase::render().
    */
-  public function render($values) {
+  function render($values) {
     $uid = $this->getValue($values);
-    $data = $this->userData->get($this->options['data_module'], $uid, $this->options['data_name']);
+    $data = $this->userData->get($this->options['module'], $uid, $this->options['name']);
 
     // Don't sanitize if no value was found.
     if (isset($data)) {
diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/filter/Name.php b/core/modules/user/lib/Drupal/user/Plugin/views/filter/Name.php
index 5e272a1..b344857 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/views/filter/Name.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/views/filter/Name.php
@@ -155,7 +155,7 @@ public function adminSummary() {
     if ($this->value) {
       $result = entity_load_multiple_by_properties('user', array('uid' => $this->value));
       foreach ($result as $account) {
-        if ($account->id()) {
+        if ($account->uid) {
           $this->value_options[$account->id()] = $account->label();
         }
         else {
diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/wizard/Users.php b/core/modules/user/lib/Drupal/user/Plugin/views/wizard/Users.php
index b524259..10fc837 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/views/wizard/Users.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/views/wizard/Users.php
@@ -54,8 +54,7 @@ class Users extends WizardPluginBase {
     'status' => array(
       'value' => TRUE,
       'table' => 'users',
-      'field' => 'status',
-      'provider' => 'user'
+      'field' => 'status'
     )
   );
 
@@ -76,7 +75,6 @@ protected function defaultDisplayOptions() {
     $display_options['fields']['name']['id'] = 'name';
     $display_options['fields']['name']['table'] = 'users';
     $display_options['fields']['name']['field'] = 'name';
-    $display_options['fields']['name']['provider'] = 'user';
     $display_options['fields']['name']['label'] = '';
     $display_options['fields']['name']['alter']['alter_text'] = 0;
     $display_options['fields']['name']['alter']['make_link'] = 0;
diff --git a/core/modules/user/lib/Drupal/user/ProfileFormController.php b/core/modules/user/lib/Drupal/user/ProfileFormController.php
index 53b29b1..484a4af 100644
--- a/core/modules/user/lib/Drupal/user/ProfileFormController.php
+++ b/core/modules/user/lib/Drupal/user/ProfileFormController.php
@@ -22,7 +22,7 @@ protected function actions(array $form, array &$form_state) {
     $element['delete']['#type'] = 'submit';
     $element['delete']['#value'] = t('Cancel account');
     $element['delete']['#submit'] = array('user_edit_cancel_submit');
-    $element['delete']['#access'] = $account->id() > 1 && (($account->id() == $GLOBALS['user']->id() && user_access('cancel account')) || user_access('administer users'));
+    $element['delete']['#access'] = $account->uid > 1 && (($account->uid == $GLOBALS['user']->uid && user_access('cancel account')) || user_access('administer users'));
 
     return $element;
   }
diff --git a/core/modules/user/lib/Drupal/user/RegisterFormController.php b/core/modules/user/lib/Drupal/user/RegisterFormController.php
index 116f6c2..1b0b76f 100644
--- a/core/modules/user/lib/Drupal/user/RegisterFormController.php
+++ b/core/modules/user/lib/Drupal/user/RegisterFormController.php
@@ -32,8 +32,8 @@ public function form(array $form, array &$form_state) {
     );
 
     // If we aren't admin but already logged on, go to the user page instead.
-    if (!$admin && $user->isAuthenticated()) {
-      return new RedirectResponse(url('user/' . $user->id(), array('absolute' => TRUE)));
+    if (!$admin && $user->uid) {
+      return new RedirectResponse(url('user/' . $user->uid, array('absolute' => TRUE)));
     }
 
     $form['#attached']['library'][] = array('system', 'jquery.cookie');
@@ -99,9 +99,9 @@ public function save(array $form, array &$form_state) {
     $account->save();
 
     $form_state['user'] = $account;
-    $form_state['values']['uid'] = $account->id();
+    $form_state['values']['uid'] = $account->uid;
 
-    watchdog('user', 'New user: %name %email.', array('%name' => $form_state['values']['name'], '%email' => '<' . $form_state['values']['mail'] . '>'), WATCHDOG_NOTICE, l(t('edit'), 'user/' . $account->id() . '/edit'));
+    watchdog('user', 'New user: %name %email.', array('%name' => $form_state['values']['name'], '%email' => '<' . $form_state['values']['mail'] . '>'), WATCHDOG_NOTICE, l(t('edit'), 'user/' . $account->uid . '/edit'));
 
     // Add plain text password into user account to generate mail tokens.
     $account->password = $pass;
diff --git a/core/modules/user/lib/Drupal/user/RoleAccessController.php b/core/modules/user/lib/Drupal/user/RoleAccessController.php
index e98c540..13afa61 100644
--- a/core/modules/user/lib/Drupal/user/RoleAccessController.php
+++ b/core/modules/user/lib/Drupal/user/RoleAccessController.php
@@ -31,11 +31,4 @@ protected function checkAccess(EntityInterface $entity, $operation, $langcode, A
     }
   }
 
-  /**
-   * {@inheritdoc}
-   */
-  protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) {
-    return user_access('administer permissions', $account);
-  }
-
 }
diff --git a/core/modules/user/lib/Drupal/user/RoleStorageController.php b/core/modules/user/lib/Drupal/user/RoleStorageController.php
index ff012f3..fff106e 100644
--- a/core/modules/user/lib/Drupal/user/RoleStorageController.php
+++ b/core/modules/user/lib/Drupal/user/RoleStorageController.php
@@ -17,6 +17,15 @@ class RoleStorageController extends ConfigStorageController implements RoleStora
   /**
    * {@inheritdoc}
    */
+  public function resetCache(array $ids = NULL) {
+    parent::resetCache($ids);
+    // Clear the user access cache.
+    drupal_static_reset('user_access');
+  }
+
+  /**
+   * {@inheritdoc}
+   */
   public function deleteRoleReferences(array $rids) {
     // Remove the role from all users.
     db_delete('users_roles')
diff --git a/core/modules/user/lib/Drupal/user/TempStoreFactory.php b/core/modules/user/lib/Drupal/user/TempStoreFactory.php
index e741048..ddd1a75 100644
--- a/core/modules/user/lib/Drupal/user/TempStoreFactory.php
+++ b/core/modules/user/lib/Drupal/user/TempStoreFactory.php
@@ -61,7 +61,7 @@ function get($collection, $owner = NULL) {
     // Use the currently authenticated user ID or the active user ID unless
     // the owner is overridden.
     if (!isset($owner)) {
-      $owner = $GLOBALS['user']->id() ?: session_id();
+      $owner = $GLOBALS['user']->uid ?: session_id();
     }
 
     // Store the data for this collection in the database.
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserAdminTest.php b/core/modules/user/lib/Drupal/user/Tests/UserAdminTest.php
index 55bef92..171d402 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserAdminTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserAdminTest.php
@@ -46,7 +46,7 @@ function testUserAdmin() {
     $this->assertText($admin_user->name, 'Found Admin user on admin users page');
 
     // Test for existence of edit link in table.
-    $link = l(t('Edit'), "user/" . $user_a->id() . "/edit", array('query' => array('destination' => 'admin/people')));
+    $link = l(t('Edit'), "user/$user_a->uid/edit", array('query' => array('destination' => 'admin/people')));
     $this->assertRaw($link, 'Found user A edit link on admin users page');
 
     // Filter the users by name/e-mail.
@@ -79,17 +79,17 @@ function testUserAdmin() {
     $this->assertText($user_c->name, 'User C on filtered by role on admin users page');
 
     // Test blocking of a user.
-    $account = user_load($user_c->id());
+    $account = user_load($user_c->uid);
     $this->assertEqual($account->status, 1, 'User C not blocked');
     $edit = array();
     $edit['action'] = 'user_block_user_action';
     $edit['user_bulk_form[1]'] = TRUE;
     $this->drupalPost('admin/people', $edit, t('Apply'));
-    $account = user_load($user_c->id(), TRUE);
+    $account = user_load($user_c->uid, TRUE);
     $this->assertEqual($account->status, 0, 'User C blocked');
 
     // Test filtering on admin page for blocked users
-    $this->drupalGet('admin/people', array('query' => array('status' => 2)));
+    $this->drupalGet('admin/people', array('query' => array('status' => 0)));
     $this->assertNoText($user_a->name, 'User A not on filtered by status on admin users page');
     $this->assertNoText($user_b->name, 'User B not on filtered by status on admin users page');
     $this->assertText($user_c->name, 'User C on filtered by status on admin users page');
@@ -99,18 +99,18 @@ function testUserAdmin() {
     $editunblock['action'] = 'user_unblock_user_action';
     $editunblock['user_bulk_form[1]'] = TRUE;
     $this->drupalPost('admin/people', $editunblock, t('Apply'));
-    $account = user_load($user_c->id(), TRUE);
+    $account = user_load($user_c->uid, TRUE);
     $this->assertEqual($account->status, 1, 'User C unblocked');
     $this->assertMail("to", $account->mail, "Activation mail sent to user C");
 
     // Test blocking and unblocking another user from /user/[uid]/edit form and sending of activation mail
     $user_d = $this->drupalCreateUser(array());
-    $account1 = user_load($user_d->id(), TRUE);
-    $this->drupalPost('user/' . $account1->id() . '/edit', array('status' => 0), t('Save'));
-    $account1 = user_load($user_d->id(), TRUE);
+    $account1 = user_load($user_d->uid, TRUE);
+    $this->drupalPost('user/' . $account1->uid . '/edit', array('status' => 0), t('Save'));
+    $account1 = user_load($user_d->uid, TRUE);
     $this->assertEqual($account1->status, 0, 'User D blocked');
-    $this->drupalPost('user/' . $account1->id() . '/edit', array('status' => TRUE), t('Save'));
-    $account1 = user_load($user_d->id(), TRUE);
+    $this->drupalPost('user/' . $account1->uid . '/edit', array('status' => TRUE), t('Save'));
+    $account1 = user_load($user_d->uid, TRUE);
     $this->assertEqual($account1->status, 1, 'User D unblocked');
     $this->assertMail("to", $account1->mail, "Activation mail sent to user D");
   }
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserBlocksTests.php b/core/modules/user/lib/Drupal/user/Tests/UserBlocksTests.php
index 776f383..bf8c988 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserBlocksTests.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserBlocksTests.php
@@ -73,7 +73,7 @@ function testUserLoginBlock() {
     $this->drupalLogout();
     $this->drupalPost('http://example.com/', $edit, t('Log in'), array('external' => FALSE));
     // Check that we remain on the site after login.
-    $this->assertEqual(url('user/' . $user->id(), array('absolute' => TRUE)), $this->getUrl(), 'Redirected to user profile page after login from the frontpage');
+    $this->assertEqual(url('user/' . $user->uid, array('absolute' => TRUE)), $this->getUrl(), 'Redirected to user profile page after login from the frontpage');
   }
 
   /**
@@ -89,14 +89,14 @@ function testWhosOnlineBlock() {
     $user3 = $this->drupalCreateUser(array());
 
     // Update access of two users to be within the active timespan.
-    $this->updateAccess($user1->id());
-    $this->updateAccess($user2->id(), REQUEST_TIME + 1);
+    $this->updateAccess($user1->uid);
+    $this->updateAccess($user2->uid, REQUEST_TIME + 1);
 
     // Insert an inactive user who should not be seen in the block, and ensure
     // that the admin user used in setUp() does not appear.
     $inactive_time = REQUEST_TIME - $config['seconds_online'] - 1;
-    $this->updateAccess($user3->id(), $inactive_time);
-    $this->updateAccess($this->adminUser->id(), $inactive_time);
+    $this->updateAccess($user3->uid, $inactive_time);
+    $this->updateAccess($this->adminUser->uid, $inactive_time);
 
     // Test block output.
     $content = entity_view($block, 'block');
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php b/core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php
index c45a21f..15e9912 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php
@@ -39,25 +39,25 @@ function testUserCancelWithoutPermission() {
     $account = $this->drupalCreateUser(array());
     $this->drupalLogin($account);
     // Load real user object.
-    $account = user_load($account->id(), TRUE);
+    $account = user_load($account->uid, TRUE);
 
     // Create a node.
-    $node = $this->drupalCreateNode(array('uid' => $account->id()));
+    $node = $this->drupalCreateNode(array('uid' => $account->uid));
 
     // Attempt to cancel account.
-    $this->drupalGet('user/' . $account->id() . '/edit');
+    $this->drupalGet('user/' . $account->uid . '/edit');
     $this->assertNoRaw(t('Cancel account'), 'No cancel account button displayed.');
 
     // Attempt bogus account cancellation request confirmation.
     $timestamp = $account->login;
-    $this->drupalGet("user/" . $account->id() . "/cancel/confirm/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login));
+    $this->drupalGet("user/$account->uid/cancel/confirm/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login));
     $this->assertResponse(403, 'Bogus cancelling request rejected.');
-    $account = user_load($account->id());
+    $account = user_load($account->uid);
     $this->assertTrue($account->status == 1, 'User account was not canceled.');
 
     // Confirm user's content has not been altered.
     $test_node = node_load($node->nid, TRUE);
-    $this->assertTrue(($test_node->uid == $account->id() && $test_node->status == 1), 'Node of the user has not been altered.');
+    $this->assertTrue(($test_node->uid == $account->uid && $test_node->status == 1), 'Node of the user has not been altered.');
   }
 
   /**
@@ -109,13 +109,13 @@ function testUserCancelInvalid() {
     $account = $this->drupalCreateUser(array('cancel account'));
     $this->drupalLogin($account);
     // Load real user object.
-    $account = user_load($account->id(), TRUE);
+    $account = user_load($account->uid, TRUE);
 
     // Create a node.
-    $node = $this->drupalCreateNode(array('uid' => $account->id()));
+    $node = $this->drupalCreateNode(array('uid' => $account->uid));
 
     // Attempt to cancel account.
-    $this->drupalPost('user/' . $account->id() . '/edit', NULL, t('Cancel account'));
+    $this->drupalPost('user/' . $account->uid . '/edit', NULL, t('Cancel account'));
 
     // Confirm account cancellation.
     $timestamp = time();
@@ -124,21 +124,21 @@ function testUserCancelInvalid() {
 
     // Attempt bogus account cancellation request confirmation.
     $bogus_timestamp = $timestamp + 60;
-    $this->drupalGet("user/" . $account->id() . "/cancel/confirm/$bogus_timestamp/" . user_pass_rehash($account->pass, $bogus_timestamp, $account->login));
+    $this->drupalGet("user/$account->uid/cancel/confirm/$bogus_timestamp/" . user_pass_rehash($account->pass, $bogus_timestamp, $account->login));
     $this->assertText(t('You have tried to use an account cancellation link that has expired. Please request a new one using the form below.'), 'Bogus cancelling request rejected.');
-    $account = user_load($account->id());
+    $account = user_load($account->uid);
     $this->assertTrue($account->status == 1, 'User account was not canceled.');
 
     // Attempt expired account cancellation request confirmation.
     $bogus_timestamp = $timestamp - 86400 - 60;
-    $this->drupalGet("user/" . $account->id() . "/cancel/confirm/$bogus_timestamp/" . user_pass_rehash($account->pass, $bogus_timestamp, $account->login));
+    $this->drupalGet("user/$account->uid/cancel/confirm/$bogus_timestamp/" . user_pass_rehash($account->pass, $bogus_timestamp, $account->login));
     $this->assertText(t('You have tried to use an account cancellation link that has expired. Please request a new one using the form below.'), 'Expired cancel account request rejected.');
-    $account = user_load($account->id(), TRUE);
+    $account = user_load($account->uid, TRUE);
     $this->assertTrue($account->status, 'User account was not canceled.');
 
     // Confirm user's content has not been altered.
     $test_node = node_load($node->nid, TRUE);
-    $this->assertTrue(($test_node->uid == $account->id() && $test_node->status == 1), 'Node of the user has not been altered.');
+    $this->assertTrue(($test_node->uid == $account->uid && $test_node->status == 1), 'Node of the user has not been altered.');
   }
 
   /**
@@ -152,10 +152,10 @@ function testUserBlock() {
     $this->drupalLogin($web_user);
 
     // Load real user object.
-    $account = user_load($web_user->id(), TRUE);
+    $account = user_load($web_user->uid, TRUE);
 
     // Attempt to cancel account.
-    $this->drupalGet('user/' . $account->id() . '/edit');
+    $this->drupalGet('user/' . $account->uid . '/edit');
     $this->drupalPost(NULL, NULL, t('Cancel account'));
     $this->assertText(t('Are you sure you want to cancel your account?'), 'Confirmation form to cancel account displayed.');
     $this->assertText(t('Your account will be blocked and you will no longer be able to log in. All of your content will remain attributed to your user name.'), 'Informs that all content will be remain as is.');
@@ -168,8 +168,8 @@ function testUserBlock() {
     $this->assertText(t('A confirmation request to cancel your account has been sent to your e-mail address.'), 'Account cancellation request mailed message displayed.');
 
     // Confirm account cancellation request.
-    $this->drupalGet("user/" . $account->id() . "/cancel/confirm/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login));
-    $account = user_load($account->id(), TRUE);
+    $this->drupalGet("user/$account->uid/cancel/confirm/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login));
+    $account = user_load($account->uid, TRUE);
     $this->assertTrue($account->status == 0, 'User has been blocked.');
 
     // Confirm that the confirmation message made it through to the end user.
@@ -186,16 +186,16 @@ function testUserBlockUnpublish() {
     $account = $this->drupalCreateUser(array('cancel account'));
     $this->drupalLogin($account);
     // Load real user object.
-    $account = user_load($account->id(), TRUE);
+    $account = user_load($account->uid, TRUE);
 
     // Create a node with two revisions.
-    $node = $this->drupalCreateNode(array('uid' => $account->id()));
+    $node = $this->drupalCreateNode(array('uid' => $account->uid));
     $settings = get_object_vars($node);
     $settings['revision'] = 1;
     $node = $this->drupalCreateNode($settings);
 
     // Attempt to cancel account.
-    $this->drupalGet('user/' . $account->id() . '/edit');
+    $this->drupalGet('user/' . $account->uid . '/edit');
     $this->drupalPost(NULL, NULL, t('Cancel account'));
     $this->assertText(t('Are you sure you want to cancel your account?'), 'Confirmation form to cancel account displayed.');
     $this->assertText(t('Your account will be blocked and you will no longer be able to log in. All of your content will be hidden from everyone but administrators.'), 'Informs that all content will be unpublished.');
@@ -206,8 +206,8 @@ function testUserBlockUnpublish() {
     $this->assertText(t('A confirmation request to cancel your account has been sent to your e-mail address.'), 'Account cancellation request mailed message displayed.');
 
     // Confirm account cancellation request.
-    $this->drupalGet("user/" . $account->id() . "/cancel/confirm/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login));
-    $account = user_load($account->id(), TRUE);
+    $this->drupalGet("user/$account->uid/cancel/confirm/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login));
+    $account = user_load($account->uid, TRUE);
     $this->assertTrue($account->status == 0, 'User has been blocked.');
 
     // Confirm user's content has been unpublished.
@@ -230,14 +230,14 @@ function testUserAnonymize() {
     $account = $this->drupalCreateUser(array('cancel account'));
     $this->drupalLogin($account);
     // Load real user object.
-    $account = user_load($account->id(), TRUE);
+    $account = user_load($account->uid, TRUE);
 
     // Create a simple node.
-    $node = $this->drupalCreateNode(array('uid' => $account->id()));
+    $node = $this->drupalCreateNode(array('uid' => $account->uid));
 
     // Create a node with two revisions, the initial one belonging to the
     // cancelling user.
-    $revision_node = $this->drupalCreateNode(array('uid' => $account->id()));
+    $revision_node = $this->drupalCreateNode(array('uid' => $account->uid));
     $revision = $revision_node->vid;
     $settings = get_object_vars($revision_node);
     $settings['revision'] = 1;
@@ -245,7 +245,7 @@ function testUserAnonymize() {
     $revision_node = $this->drupalCreateNode($settings);
 
     // Attempt to cancel account.
-    $this->drupalGet('user/' . $account->id() . '/edit');
+    $this->drupalGet('user/' . $account->uid . '/edit');
     $this->drupalPost(NULL, NULL, t('Cancel account'));
     $this->assertText(t('Are you sure you want to cancel your account?'), 'Confirmation form to cancel account displayed.');
     $this->assertRaw(t('Your account will be removed and all account information deleted. All of your content will be assigned to the %anonymous-name user.', array('%anonymous-name' => config('user.settings')->get('anonymous'))), 'Informs that all content will be attributed to anonymous account.');
@@ -256,8 +256,8 @@ function testUserAnonymize() {
     $this->assertText(t('A confirmation request to cancel your account has been sent to your e-mail address.'), 'Account cancellation request mailed message displayed.');
 
     // Confirm account cancellation request.
-    $this->drupalGet("user/" . $account->id() . "/cancel/confirm/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login));
-    $this->assertFalse(user_load($account->id(), TRUE), 'User is not found in the database.');
+    $this->drupalGet("user/$account->uid/cancel/confirm/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login));
+    $this->assertFalse(user_load($account->uid, TRUE), 'User is not found in the database.');
 
     // Confirm that user's content has been attributed to anonymous user.
     $test_node = node_load($node->nid, TRUE);
@@ -283,10 +283,10 @@ function testUserDelete() {
     $account = $this->drupalCreateUser(array('cancel account', 'post comments', 'skip comment approval'));
     $this->drupalLogin($account);
     // Load real user object.
-    $account = user_load($account->id(), TRUE);
+    $account = user_load($account->uid, TRUE);
 
     // Create a simple node.
-    $node = $this->drupalCreateNode(array('uid' => $account->id()));
+    $node = $this->drupalCreateNode(array('uid' => $account->uid));
 
     // Create comment.
     $langcode = Language::LANGCODE_NOT_SPECIFIED;
@@ -303,7 +303,7 @@ function testUserDelete() {
 
     // Create a node with two revisions, the initial one belonging to the
     // cancelling user.
-    $revision_node = $this->drupalCreateNode(array('uid' => $account->id()));
+    $revision_node = $this->drupalCreateNode(array('uid' => $account->uid));
     $revision = $revision_node->vid;
     $settings = get_object_vars($revision_node);
     $settings['revision'] = 1;
@@ -311,7 +311,7 @@ function testUserDelete() {
     $revision_node = $this->drupalCreateNode($settings);
 
     // Attempt to cancel account.
-    $this->drupalGet('user/' . $account->id() . '/edit');
+    $this->drupalGet('user/' . $account->uid . '/edit');
     $this->drupalPost(NULL, NULL, t('Cancel account'));
     $this->assertText(t('Are you sure you want to cancel your account?'), 'Confirmation form to cancel account displayed.');
     $this->assertText(t('Your account will be removed and all account information deleted. All of your content will also be deleted.'), 'Informs that all content will be deleted.');
@@ -322,8 +322,8 @@ function testUserDelete() {
     $this->assertText(t('A confirmation request to cancel your account has been sent to your e-mail address.'), 'Account cancellation request mailed message displayed.');
 
     // Confirm account cancellation request.
-    $this->drupalGet("user/" . $account->id() . "/cancel/confirm/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login));
-    $this->assertFalse(user_load($account->id(), TRUE), 'User is not found in the database.');
+    $this->drupalGet("user/$account->uid/cancel/confirm/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login));
+    $this->assertFalse(user_load($account->uid, TRUE), 'User is not found in the database.');
 
     // Confirm that user's content has been deleted.
     $this->assertFalse(node_load($node->nid, TRUE), 'Node of the user has been deleted.');
@@ -349,7 +349,7 @@ function testUserCancelByAdmin() {
     $this->drupalLogin($admin_user);
 
     // Delete regular user.
-    $this->drupalGet('user/' . $account->id() . '/edit');
+    $this->drupalGet('user/' . $account->uid . '/edit');
     $this->drupalPost(NULL, NULL, t('Cancel account'));
     $this->assertRaw(t('Are you sure you want to cancel the account %name?', array('%name' => $account->name)), 'Confirmation form to cancel account displayed.');
     $this->assertText(t('Select the method to cancel the account above.'), 'Allows to select account cancellation method.');
@@ -357,7 +357,7 @@ function testUserCancelByAdmin() {
     // Confirm deletion.
     $this->drupalPost(NULL, NULL, t('Cancel account'));
     $this->assertRaw(t('%name has been deleted.', array('%name' => $account->name)), 'User deleted.');
-    $this->assertFalse(user_load($account->id()), 'User is not found in the database.');
+    $this->assertFalse(user_load($account->uid), 'User is not found in the database.');
   }
 
   /**
@@ -377,7 +377,7 @@ function testUserWithoutEmailCancelByAdmin() {
     $this->drupalLogin($admin_user);
 
     // Delete regular user without e-mail address.
-    $this->drupalGet('user/' . $account->id() . '/edit');
+    $this->drupalGet('user/' . $account->uid . '/edit');
     $this->drupalPost(NULL, NULL, t('Cancel account'));
     $this->assertRaw(t('Are you sure you want to cancel the account %name?', array('%name' => $account->name)), 'Confirmation form to cancel account displayed.');
     $this->assertText(t('Select the method to cancel the account above.'), 'Allows to select account cancellation method.');
@@ -385,7 +385,7 @@ function testUserWithoutEmailCancelByAdmin() {
     // Confirm deletion.
     $this->drupalPost(NULL, NULL, t('Cancel account'));
     $this->assertRaw(t('%name has been deleted.', array('%name' => $account->name)), 'User deleted.');
-    $this->assertFalse(user_load($account->id()), 'User is not found in the database.');
+    $this->assertFalse(user_load($account->uid), 'User is not found in the database.');
   }
 
   /**
@@ -405,7 +405,7 @@ function testMassUserCancelByAdmin() {
     $users = array();
     for ($i = 0; $i < 3; $i++) {
       $account = $this->drupalCreateUser(array());
-      $users[$account->id()] = $account;
+      $users[$account->uid] = $account;
     }
 
     // Cancel user accounts, including own one.
@@ -425,13 +425,13 @@ function testMassUserCancelByAdmin() {
     $status = TRUE;
     foreach ($users as $account) {
       $status = $status && (strpos($this->content, t('%name has been deleted.', array('%name' => $account->name))) !== FALSE);
-      $status = $status && !user_load($account->id(), TRUE);
+      $status = $status && !user_load($account->uid, TRUE);
     }
     $this->assertTrue($status, 'Users deleted and not found in the database.');
 
     // Ensure that admin account was not cancelled.
     $this->assertText(t('A confirmation request to cancel your account has been sent to your e-mail address.'), 'Account cancellation request mailed message displayed.');
-    $admin_user = user_load($admin_user->id());
+    $admin_user = user_load($admin_user->uid);
     $this->assertTrue($admin_user->status == 1, 'Administrative user is found in the database and enabled.');
 
     // Verify that uid 1's account was not cancelled.
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserDeleteTest.php b/core/modules/user/lib/Drupal/user/Tests/UserDeleteTest.php
index 5626096..2b9442d 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserDeleteTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserDeleteTest.php
@@ -31,7 +31,7 @@ function testUserDeleteMultiple() {
     $user_b = $this->drupalCreateUser(array('access content'));
     $user_c = $this->drupalCreateUser(array('access content'));
 
-    $uids = array($user_a->id(), $user_b->id(), $user_c->id());
+    $uids = array($user_a->uid, $user_b->uid, $user_c->uid);
 
     // These users should have a role
     $query = db_select('users_roles', 'r');
@@ -44,7 +44,7 @@ function testUserDeleteMultiple() {
 
     $this->assertTrue($roles_created > 0, 'Role assigments created for new users and deletion of role assigments can be tested');
     // We should be able to load one of the users.
-    $this->assertTrue(user_load($user_a->id()), 'User is created and deltion of user can be tested');
+    $this->assertTrue(user_load($user_a->uid), 'User is created and deltion of user can be tested');
     // Delete the users.
     user_delete_multiple($uids);
     // Test if the roles assignments are deleted.
@@ -57,8 +57,8 @@ function testUserDeleteMultiple() {
       ->fetchField();
     $this->assertTrue($roles_after_deletion == 0, 'Role assigments deleted along with users');
     // Test if the users are deleted, user_load() will return FALSE.
-    $this->assertFalse(user_load($user_a->id()), format_string('User with id @uid deleted.', array('@uid' => $user_a->id())));
-    $this->assertFalse(user_load($user_b->id()), format_string('User with id @uid deleted.', array('@uid' => $user_b->id())));
-    $this->assertFalse(user_load($user_c->id()), format_string('User with id @uid deleted.', array('@uid' => $user_c->id())));
+    $this->assertFalse(user_load($user_a->uid), format_string('User with id @uid deleted.', array('@uid' => $user_a->uid)));
+    $this->assertFalse(user_load($user_b->uid), format_string('User with id @uid deleted.', array('@uid' => $user_b->uid)));
+    $this->assertFalse(user_load($user_c->uid), format_string('User with id @uid deleted.', array('@uid' => $user_c->uid)));
   }
 }
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserEditTest.php b/core/modules/user/lib/Drupal/user/Tests/UserEditTest.php
index 0c9ded0..178ddda 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserEditTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserEditTest.php
@@ -33,42 +33,42 @@ function testUserEdit() {
 
     // Test that error message appears when attempting to use a non-unique user name.
     $edit['name'] = $user2->name;
-    $this->drupalPost("user/" . $user1->id() . "/edit", $edit, t('Save'));
+    $this->drupalPost("user/$user1->uid/edit", $edit, t('Save'));
     $this->assertRaw(t('The name %name is already taken.', array('%name' => $edit['name'])));
 
     // Check that filling out a single password field does not validate.
     $edit = array();
     $edit['pass[pass1]'] = '';
     $edit['pass[pass2]'] = $this->randomName();
-    $this->drupalPost("user/" . $user1->id() . "/edit", $edit, t('Save'));
+    $this->drupalPost("user/$user1->uid/edit", $edit, t('Save'));
     $this->assertText(t("The specified passwords do not match."), 'Typing mismatched passwords displays an error message.');
 
     $edit['pass[pass1]'] = $this->randomName();
     $edit['pass[pass2]'] = '';
-    $this->drupalPost("user/" . $user1->id() . "/edit", $edit, t('Save'));
+    $this->drupalPost("user/$user1->uid/edit", $edit, t('Save'));
     $this->assertText(t("The specified passwords do not match."), 'Typing mismatched passwords displays an error message.');
 
     // Test that the error message appears when attempting to change the mail or
     // pass without the current password.
     $edit = array();
     $edit['mail'] = $this->randomName() . '@new.example.com';
-    $this->drupalPost("user/" . $user1->id() . "/edit", $edit, t('Save'));
+    $this->drupalPost("user/$user1->uid/edit", $edit, t('Save'));
     $this->assertRaw(t("Your current password is missing or incorrect; it's required to change the %name.", array('%name' => t('E-mail address'))));
 
     $edit['current_pass'] = $user1->pass_raw;
-    $this->drupalPost("user/" . $user1->id() . "/edit", $edit, t('Save'));
+    $this->drupalPost("user/$user1->uid/edit", $edit, t('Save'));
     $this->assertRaw(t("The changes have been saved."));
 
     // Test that the user must enter current password before changing passwords.
     $edit = array();
     $edit['pass[pass1]'] = $new_pass = $this->randomName();
     $edit['pass[pass2]'] = $new_pass;
-    $this->drupalPost("user/" . $user1->id() . "/edit", $edit, t('Save'));
+    $this->drupalPost("user/$user1->uid/edit", $edit, t('Save'));
     $this->assertRaw(t("Your current password is missing or incorrect; it's required to change the %name.", array('%name' => t('Password'))));
 
     // Try again with the current password.
     $edit['current_pass'] = $user1->pass_raw;
-    $this->drupalPost("user/" . $user1->id() . "/edit", $edit, t('Save'));
+    $this->drupalPost("user/$user1->uid/edit", $edit, t('Save'));
     $this->assertRaw(t("The changes have been saved."));
 
     // Make sure the user can log in with their new password.
@@ -82,11 +82,11 @@ function testUserEdit() {
     $this->drupalLogin($user1);
 
     $config->set('password_strength', TRUE)->save();
-    $this->drupalPost("user/" . $user1->id() . "/edit", $edit, t('Save'));
+    $this->drupalPost("user/$user1->uid/edit", $edit, t('Save'));
     $this->assertRaw(t('Password strength:'), 'The password strength indicator is displayed.');
 
     $config->set('password_strength', FALSE)->save();
-    $this->drupalPost("user/" . $user1->id() . "/edit", $edit, t('Save'));
+    $this->drupalPost("user/$user1->uid/edit", $edit, t('Save'));
     $this->assertNoRaw(t('Password strength:'), 'The password strength indicator is not displayed.');
   }
 
@@ -102,7 +102,7 @@ function testUserWithoutEmailEdit() {
     // This user has no e-mail address.
     $user1->mail = '';
     $user1->save();
-    $this->drupalPost("user/" . $user1->id() . "/edit", array('mail' => ''), t('Save'));
+    $this->drupalPost("user/$user1->uid/edit", array('mail' => ''), t('Save'));
     $this->assertRaw(t("The changes have been saved."));
   }
 }
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserEditedOwnAccountTest.php b/core/modules/user/lib/Drupal/user/Tests/UserEditedOwnAccountTest.php
index 6bdb9d0..e06298f 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserEditedOwnAccountTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserEditedOwnAccountTest.php
@@ -34,7 +34,7 @@ function testUserEditedOwnAccount() {
     // Change own username.
     $edit = array();
     $edit['name'] = $this->randomName();
-    $this->drupalPost('user/' . $account->id() . '/edit', $edit, t('Save'));
+    $this->drupalPost('user/' . $account->uid . '/edit', $edit, t('Save'));
 
     // Log out.
     $this->drupalLogout();
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserEntityCallbacksTest.php b/core/modules/user/lib/Drupal/user/Tests/UserEntityCallbacksTest.php
index eb6f1c3..13f6489 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserEntityCallbacksTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserEntityCallbacksTest.php
@@ -53,6 +53,6 @@ function testLabelCallback() {
    */
   function testUriCallback() {
     $uri = $this->account->uri();
-    $this->assertEqual('user/' . $this->account->id(), $uri['path'], 'Correct user URI.');
+    $this->assertEqual('user/' . $this->account->uid, $uri['path'], 'Correct user URI.');
   }
 }
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserLanguageCreationTest.php b/core/modules/user/lib/Drupal/user/Tests/UserLanguageCreationTest.php
index c89dd26..65e3c24 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserLanguageCreationTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserLanguageCreationTest.php
@@ -94,7 +94,7 @@ function testLocalUserCreation() {
 
     // Test if the admin can use the language selector and if the
     // correct language is was saved.
-    $user_edit = $langcode . '/user/' . $user->id() . '/edit';
+    $user_edit = $langcode . '/user/' . $user->uid . '/edit';
 
     $this->drupalLogin($admin_user);
     $this->drupalGet($user_edit);
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserLanguageTest.php b/core/modules/user/lib/Drupal/user/Tests/UserLanguageTest.php
index e2adf72..407bd22 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserLanguageTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserLanguageTest.php
@@ -57,7 +57,7 @@ function testUserLanguageConfiguration() {
 
     // Login as normal user and edit account settings.
     $this->drupalLogin($web_user);
-    $path = 'user/' . $web_user->id() . '/edit';
+    $path = 'user/' . $web_user->uid . '/edit';
     $this->drupalGet($path);
     // Ensure language settings widget is available.
     $this->assertText(t('Language'), 'Language selector available.');
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserLoginTest.php b/core/modules/user/lib/Drupal/user/Tests/UserLoginTest.php
index 4dd289b..36c5f47 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserLoginTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserLoginTest.php
@@ -115,7 +115,7 @@ function testPasswordRehashOnLogin() {
     $this->drupalLogin($account);
     $this->drupalLogout();
     // Load the stored user. The password hash should reflect $default_count_log2.
-    $account = user_load($account->id());
+    $account = user_load($account->uid);
     $this->assertIdentical($password_hasher->getCountLog2($account->pass), $default_count_log2);
 
     // Change the required number of iterations by loading a test-module
@@ -127,7 +127,7 @@ function testPasswordRehashOnLogin() {
     $account->pass_raw = $password;
     $this->drupalLogin($account);
     // Load the stored user, which should have a different password hash now.
-    $account = user_load($account->id(), TRUE);
+    $account = user_load($account->uid, TRUE);
     $this->assertIdentical($password_hasher->getCountLog2($account->pass), $overridden_count_log2);
   }
 
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserPasswordResetTest.php b/core/modules/user/lib/Drupal/user/Tests/UserPasswordResetTest.php
index f01c14e..09a2cf4 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserPasswordResetTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserPasswordResetTest.php
@@ -37,7 +37,7 @@ public function setUp() {
     // Activate user by logging in.
     $this->drupalLogin($account);
 
-    $this->account = user_load($account->id());
+    $this->account = user_load($account->uid);
     $this->drupalLogout();
 
     // Set the last login time that is used to generate the one-time link so
@@ -45,7 +45,7 @@ public function setUp() {
     $account->login = REQUEST_TIME - mt_rand(10, 100000);
     db_update('users')
       ->fields(array('login' => $account->login))
-      ->condition('uid', $account->id())
+      ->condition('uid', $account->uid)
       ->execute();
   }
 
@@ -60,14 +60,14 @@ function testUserPasswordReset() {
     $this->drupalPost(NULL, $edit, t('E-mail new password'));
 
     $this->assertText(t('Sorry, @name is not recognized as a username or an e-mail address.', array('@name' => $edit['name'])), 'Validation error message shown when trying to request password for invalid account.');
-    $this->assertEqual(count($this->drupalGetMails(array('id' => 'user_password_reset'))), 0, 'No e-mail was sent when requesting a password for an invalid account.');
+    $this->assertEqual(count($this->drupalGetMails(array('id' => 'user_password_reset'))), 0, t('No e-mail was sent when requesting a password for an invalid account.'));
 
     // Reset the password by username via the password reset page.
     $edit['name'] = $this->account->name;
     $this->drupalPost(NULL, $edit, t('E-mail new password'));
 
      // Verify that the user was sent an e-mail.
-    $this->assertMail('to', $this->account->mail, 'Password e-mail sent to user.');
+    $this->assertMail('to', $this->account->mail, t('Password e-mail sent to user.'));
     $subject = t('Replacement login information for @username at @site', array('@username' => $this->account->name, '@site' => config('system.site')->get('name')));
     $this->assertMail('subject', $subject, 'Password reset e-mail subject is correct.');
 
@@ -99,7 +99,7 @@ function testUserPasswordReset() {
     // Create a password reset link as if the request time was 60 seconds older than the allowed limit.
     $timeout = config('user.settings')->get('password_reset_timeout');
     $bogus_timestamp = REQUEST_TIME - $timeout - 60;
-    $_uid = $this->account->id();
+    $_uid = $this->account->uid;
     $this->drupalGet("user/reset/$_uid/$bogus_timestamp/" . user_pass_rehash($this->account->pass, $bogus_timestamp, $this->account->login));
     $this->assertText(t('You have tried to use a one-time login link that has expired. Please request a new one using the form below.'), 'Expired password reset request rejected.');
   }
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserPictureTest.php b/core/modules/user/lib/Drupal/user/Tests/UserPictureTest.php
index f4a0662..282dd65 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserPictureTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserPictureTest.php
@@ -65,7 +65,7 @@ function testCreateDeletePicture() {
 
     // Delete the picture.
     $edit = array();
-    $this->drupalPost('user/' . $this->web_user->id() . '/edit', $edit, t('Remove'));
+    $this->drupalPost('user/' . $this->web_user->uid . '/edit', $edit, t('Remove'));
     $this->drupalPost(NULL, array(), t('Save'));
 
     // Call system_cron() to clean up the file. Make sure the timestamp
@@ -131,10 +131,10 @@ function testPictureOnNodeComment() {
    */
   function saveUserPicture($image) {
     $edit = array('files[user_picture_und_0]' => drupal_realpath($image->uri));
-    $this->drupalPost('user/' . $this->web_user->id() . '/edit', $edit, t('Save'));
+    $this->drupalPost('user/' . $this->web_user->uid . '/edit', $edit, t('Save'));
 
     // Load actual user data from database.
-    $account = user_load($this->web_user->id(), TRUE);
+    $account = user_load($this->web_user->uid, TRUE);
     return file_load($account->user_picture[Language::LANGCODE_NOT_SPECIFIED][0]['target_id'], TRUE);
   }
 }
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserRolesAssignmentTest.php b/core/modules/user/lib/Drupal/user/Tests/UserRolesAssignmentTest.php
index e6e37dc..e612374 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserRolesAssignmentTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserRolesAssignmentTest.php
@@ -38,13 +38,13 @@ function testAssignAndRemoveRole()  {
     $account = $this->drupalCreateUser();
 
     // Assign the role to the user.
-    $this->drupalPost('user/' . $account->id() . '/edit', array("roles[$rid]" => $rid), t('Save'));
+    $this->drupalPost('user/' . $account->uid . '/edit', array("roles[$rid]" => $rid), t('Save'));
     $this->assertText(t('The changes have been saved.'));
     $this->assertFieldChecked('edit-roles-' . $rid, 'Role is assigned.');
     $this->userLoadAndCheckRoleAssigned($account, $rid);
 
     // Remove the role from the user.
-    $this->drupalPost('user/' . $account->id() . '/edit', array("roles[$rid]" => FALSE), t('Save'));
+    $this->drupalPost('user/' . $account->uid . '/edit', array("roles[$rid]" => FALSE), t('Save'));
     $this->assertText(t('The changes have been saved.'));
     $this->assertNoFieldChecked('edit-roles-' . $rid, 'Role is removed from user.');
     $this->userLoadAndCheckRoleAssigned($account, $rid, FALSE);
@@ -69,12 +69,12 @@ function testCreateUserWithRole() {
     // Get the newly added user.
     $account = user_load_by_name($edit['name']);
 
-    $this->drupalGet('user/' . $account->id() . '/edit');
+    $this->drupalGet('user/' . $account->uid . '/edit');
     $this->assertFieldChecked('edit-roles-' . $rid, 'Role is assigned.');
     $this->userLoadAndCheckRoleAssigned($account, $rid);
 
     // Remove the role again.
-    $this->drupalPost('user/' . $account->id() . '/edit', array("roles[$rid]" => FALSE), t('Save'));
+    $this->drupalPost('user/' . $account->uid . '/edit', array("roles[$rid]" => FALSE), t('Save'));
     $this->assertText(t('The changes have been saved.'));
     $this->assertNoFieldChecked('edit-roles-' . $rid, 'Role is removed from user.');
     $this->userLoadAndCheckRoleAssigned($account, $rid, FALSE);
@@ -92,7 +92,7 @@ function testCreateUserWithRole() {
    *   Defaults to TRUE.
    */
   private function userLoadAndCheckRoleAssigned($account, $rid, $is_assigned = TRUE) {
-    $account = user_load($account->id(), TRUE);
+    $account = user_load($account->uid, TRUE);
     if ($is_assigned) {
       $this->assertTrue(array_search($rid, $account->roles), 'The role is present in the user object.');
     }
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserSignatureTest.php b/core/modules/user/lib/Drupal/user/Tests/UserSignatureTest.php
index a83a8ca..85925e7 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserSignatureTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserSignatureTest.php
@@ -95,7 +95,7 @@ function testUserSignature() {
     $edit = array(
       'signature[value]' => $signature_text,
     );
-    $this->drupalPost('user/' . $this->web_user->id() . '/edit', $edit, t('Save'));
+    $this->drupalPost('user/' . $this->web_user->uid . '/edit', $edit, t('Save'));
 
     // Verify that values were stored.
     $this->assertFieldByName('signature[value]', $edit['signature[value]'], 'Submitted signature text found.');
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserTimeZoneTest.php b/core/modules/user/lib/Drupal/user/Tests/UserTimeZoneTest.php
index c4ff9ff..8b77915 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserTimeZoneTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserTimeZoneTest.php
@@ -30,8 +30,8 @@ function testUserTimeZone() {
       ->set('user.configurable', 1)
       ->set('default', 'America/Los_Angeles')
       ->save();
-    entity_load('date_format', 'medium')
-      ->setPattern('Y-m-d H:i T')
+    config('system.date')
+      ->set('formats.medium.pattern.php', 'Y-m-d H:i T')
       ->save();
 
     // Create a user account and login.
@@ -60,7 +60,7 @@ function testUserTimeZone() {
     $edit = array();
     $edit['mail'] = $web_user->mail;
     $edit['timezone'] = 'America/Santiago';
-    $this->drupalPost("user/" . $web_user->id() . "/edit", $edit, t('Save'));
+    $this->drupalPost("user/$web_user->uid/edit", $edit, t('Save'));
     $this->assertText(t('The changes have been saved.'), 'Time zone changed to Santiago time.');
 
     // Confirm date format and time zone.
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserTokenReplaceTest.php b/core/modules/user/lib/Drupal/user/Tests/UserTokenReplaceTest.php
index 56f33c0..347f3d0 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserTokenReplaceTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserTokenReplaceTest.php
@@ -56,16 +56,16 @@ function testUserTokenReplacement() {
     $this->drupalLogout();
     $this->drupalLogin($user2);
 
-    $account = user_load($user1->id());
-    $global_account = user_load($GLOBALS['user']->id());
+    $account = user_load($user1->uid);
+    $global_account = user_load($GLOBALS['user']->uid);
 
     // Generate and test sanitized tokens.
     $tests = array();
-    $tests['[user:uid]'] = $account->id();
+    $tests['[user:uid]'] = $account->uid;
     $tests['[user:name]'] = check_plain(user_format_name($account));
     $tests['[user:mail]'] = check_plain($account->mail);
-    $tests['[user:url]'] = url("user/" . $account->id(), $url_options);
-    $tests['[user:edit-url]'] = url("user/" . $account->id() . "/edit", $url_options);
+    $tests['[user:url]'] = url("user/$account->uid", $url_options);
+    $tests['[user:edit-url]'] = url("user/$account->uid/edit", $url_options);
     $tests['[user:last-login]'] = format_date($account->login, 'medium', '', NULL, $language_interface->id);
     $tests['[user:last-login:short]'] = format_date($account->login, 'short', '', NULL, $language_interface->id);
     $tests['[user:created]'] = format_date($account->created, 'medium', '', NULL, $language_interface->id);
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserValidateCurrentPassCustomFormTest.php b/core/modules/user/lib/Drupal/user/Tests/UserValidateCurrentPassCustomFormTest.php
index 8379bbe..56dbc62 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserValidateCurrentPassCustomFormTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserValidateCurrentPassCustomFormTest.php
@@ -57,7 +57,7 @@ function testUserValidateCurrentPassCustomForm() {
     $edit = array();
     $edit['user_form_test_field'] = $this->accessUser->name;
     $edit['current_pass'] = $this->accessUser->pass_raw;
-    $this->drupalPost('user_form_test_current_password/' . $this->accessUser->id(), $edit, t('Test'));
+    $this->drupalPost('user_form_test_current_password/' . $this->accessUser->uid, $edit, t('Test'));
     $this->assertText(t('The password has been validated and the form submitted successfully.'));
   }
 }
diff --git a/core/modules/user/lib/Drupal/user/Tests/Views/AccessPermissionTest.php b/core/modules/user/lib/Drupal/user/Tests/Views/AccessPermissionTest.php
index 21279ff..a71529b 100644
--- a/core/modules/user/lib/Drupal/user/Tests/Views/AccessPermissionTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/Views/AccessPermissionTest.php
@@ -41,7 +41,7 @@ function testAccessPerm() {
     $access_plugin = $view->display_handler->getPlugin('access');
     $this->assertTrue($access_plugin instanceof Permission, 'Make sure the right class got instantiated.');
 
-    $this->assertTrue($view->display_handler->access($this->adminUser), 'Admin-Account should be able to access the view everytime');
+    $this->assertTrue($view->display_handler->access($this->adminUser), t('Admin-Account should be able to access the view everytime'));
     $this->assertFalse($view->display_handler->access($this->webUser));
     $this->assertTrue($view->display_handler->access($this->normalUser));
   }
diff --git a/core/modules/user/lib/Drupal/user/Tests/Views/AccessRoleTest.php b/core/modules/user/lib/Drupal/user/Tests/Views/AccessRoleTest.php
index 4c42a21..fc4a12e 100644
--- a/core/modules/user/lib/Drupal/user/Tests/Views/AccessRoleTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/Views/AccessRoleTest.php
@@ -45,7 +45,7 @@ function testAccessRole() {
     $access_plugin = $view->display_handler->getPlugin('access');
     $this->assertTrue($access_plugin instanceof Role, 'Make sure the right class got instantiated.');
 
-    $this->assertTrue($view->display_handler->access($this->adminUser), 'Admin-Account should be able to access the view everytime');
+    $this->assertTrue($view->display_handler->access($this->adminUser), t('Admin-Account should be able to access the view everytime'));
     $this->assertFalse($view->display_handler->access($this->webUser));
     $this->assertTrue($view->display_handler->access($this->normalUser));
   }
diff --git a/core/modules/user/lib/Drupal/user/Tests/Views/ArgumentDefaultTest.php b/core/modules/user/lib/Drupal/user/Tests/Views/ArgumentDefaultTest.php
index 654d1d7..970e1c3 100644
--- a/core/modules/user/lib/Drupal/user/Tests/Views/ArgumentDefaultTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/Views/ArgumentDefaultTest.php
@@ -41,7 +41,7 @@ public function test_plugin_argument_default_current_user() {
     $view = views_get_view('test_plugin_argument_default_current_user');
     $view->initHandlers();
 
-    $this->assertEqual($view->argument['null']->getDefaultArgument(), $account->id(), 'Uid of the current user is used.');
+    $this->assertEqual($view->argument['null']->getDefaultArgument(), $account->uid, 'Uid of the current user is used.');
     // Switch back.
     $user = $admin;
     drupal_save_session(TRUE);
diff --git a/core/modules/user/lib/Drupal/user/Tests/Views/ArgumentValidateTest.php b/core/modules/user/lib/Drupal/user/Tests/Views/ArgumentValidateTest.php
index 6a1145e..0d89d47 100644
--- a/core/modules/user/lib/Drupal/user/Tests/Views/ArgumentValidateTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/Views/ArgumentValidateTest.php
@@ -37,7 +37,7 @@ function testArgumentValidateUserUid() {
     $account = $this->account;
     // test 'uid' case
     $view = $this->view_argument_validate_user('uid');
-    $this->assertTrue($view->argument['null']->validateArgument($account->id()));
+    $this->assertTrue($view->argument['null']->validateArgument($account->uid));
     // Reset safed argument validation.
     $view->argument['null']->argument_validated = NULL;
     // Fail for a string variable since type is 'uid'
@@ -56,7 +56,7 @@ function testArgumentValidateUserName() {
     // Reset safed argument validation.
     $view->argument['null']->argument_validated = NULL;
     // Fail for a uid variable since type is 'name'
-    $this->assertFalse($view->argument['null']->validateArgument($account->id()));
+    $this->assertFalse($view->argument['null']->validateArgument($account->uid));
     // Reset safed argument validation.
     $view->argument['null']->argument_validated = NULL;
     // Fail for a valid string, but for a user that doesn't exist
@@ -71,7 +71,7 @@ function testArgumentValidateUserEither() {
     // Reset safed argument validation.
     $view->argument['null']->argument_validated = NULL;
     // Fail for a uid variable since type is 'name'
-    $this->assertTrue($view->argument['null']->validateArgument($account->id()));
+    $this->assertTrue($view->argument['null']->validateArgument($account->uid));
     // Reset safed argument validation.
     $view->argument['null']->argument_validated = NULL;
     // Fail for a valid string, but for a user that doesn't exist
diff --git a/core/modules/user/lib/Drupal/user/Tests/Views/HandlerArgumentUserUidTest.php b/core/modules/user/lib/Drupal/user/Tests/Views/HandlerArgumentUserUidTest.php
index db9c51f..24be6f8 100644
--- a/core/modules/user/lib/Drupal/user/Tests/Views/HandlerArgumentUserUidTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/Views/HandlerArgumentUserUidTest.php
@@ -40,7 +40,7 @@ public function testArgumentTitle() {
 
     // Tests a valid user.
     $account = $this->drupalCreateUser();
-    $this->executeView($view, array($account->id()));
+    $this->executeView($view, array($account->uid));
     $this->assertEqual($view->getTitle(), $account->label());
     $view->destroy();
   }
diff --git a/core/modules/user/lib/Drupal/user/Tests/Views/HandlerFilterUserNameTest.php b/core/modules/user/lib/Drupal/user/Tests/Views/HandlerFilterUserNameTest.php
index 45f77b3..4e9b95a 100644
--- a/core/modules/user/lib/Drupal/user/Tests/Views/HandlerFilterUserNameTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/Views/HandlerFilterUserNameTest.php
@@ -172,7 +172,7 @@ public function testExposedFilter() {
     $this->assertNoRaw('Unable to find user');
     // The actual result should contain all of the user ids.
     foreach ($this->accounts as $account) {
-      $this->assertRaw($account->id());
+      $this->assertRaw($account->uid);
     }
   }
 
diff --git a/core/modules/user/lib/Drupal/user/Tests/Views/RelationshipRepresentativeNode.php b/core/modules/user/lib/Drupal/user/Tests/Views/RelationshipRepresentativeNode.php
index c2b3a30..34a0d83 100644
--- a/core/modules/user/lib/Drupal/user/Tests/Views/RelationshipRepresentativeNode.php
+++ b/core/modules/user/lib/Drupal/user/Tests/Views/RelationshipRepresentativeNode.php
@@ -36,11 +36,11 @@ public function testRelationship() {
     $map = array('node_users_nid' => 'nid', 'uid' => 'uid');
     $expected_result = array(
       array(
-        'uid' => $this->users[1]->id(),
+        'uid' => $this->users[1]->uid,
         'nid' => $this->nodes[1]->nid,
       ),
       array(
-        'uid' => $this->users[0]->id(),
+        'uid' => $this->users[0]->uid,
         'nid' => $this->nodes[0]->nid,
       ),
     );
diff --git a/core/modules/user/lib/Drupal/user/Tests/Views/UserDataTest.php b/core/modules/user/lib/Drupal/user/Tests/Views/UserDataTest.php
index 6c27bf9..ca871a6 100644
--- a/core/modules/user/lib/Drupal/user/Tests/Views/UserDataTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/Views/UserDataTest.php
@@ -51,7 +51,7 @@ public function testDataField() {
     $output = $view->field['data']->render($view->result[0]);
     $this->assertEqual($output, $random_value, 'A valid user data got rendered.');
 
-    $view->field['data']->options['data_name'] = $this->randomName();
+    $view->field['data']->options['name'] = $this->randomName();
     $output = $view->field['data']->render($view->result[0]);
     $this->assertFalse($output, 'An invalid configuration does not return anything');
 
diff --git a/core/modules/user/lib/Drupal/user/Tests/Views/UserTestBase.php b/core/modules/user/lib/Drupal/user/Tests/Views/UserTestBase.php
index 88b1c78..6ea9454 100644
--- a/core/modules/user/lib/Drupal/user/Tests/Views/UserTestBase.php
+++ b/core/modules/user/lib/Drupal/user/Tests/Views/UserTestBase.php
@@ -43,7 +43,7 @@ protected function setUp() {
 
     $this->users[] = $this->drupalCreateUser();
     $this->users[] = user_load(1);
-    $this->nodes[] = $this->drupalCreateNode(array('uid' => $this->users[0]->id()));
+    $this->nodes[] = $this->drupalCreateNode(array('uid' => $this->users[0]->uid));
     $this->nodes[] = $this->drupalCreateNode(array('uid' => 1));
   }
 
diff --git a/core/modules/user/lib/Drupal/user/UserAccessController.php b/core/modules/user/lib/Drupal/user/UserAccessController.php
index e6f6ed6..fd46efa 100644
--- a/core/modules/user/lib/Drupal/user/UserAccessController.php
+++ b/core/modules/user/lib/Drupal/user/UserAccessController.php
@@ -25,6 +25,10 @@ protected function checkAccess(EntityInterface $entity, $operation, $langcode, A
         return $this->viewAccess($entity, $langcode, $account);
         break;
 
+      case 'create':
+        return user_access('administer users', $account);
+        break;
+
       case 'update':
         // Users can always edit their own account. Users with the 'administer
         // users' permission can edit any account except the anonymous account.
@@ -41,13 +45,6 @@ protected function checkAccess(EntityInterface $entity, $operation, $langcode, A
   }
 
   /**
-   * {@inheritdoc}
-   */
-  protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) {
-    return user_access('administer users', $account);
-  }
-
-  /**
    * Check view access.
    *
    * See EntityAccessControllerInterface::view() for parameters.
diff --git a/core/modules/user/lib/Drupal/user/UserBCDecorator.php b/core/modules/user/lib/Drupal/user/UserBCDecorator.php
index d705d56..eed508b 100644
--- a/core/modules/user/lib/Drupal/user/UserBCDecorator.php
+++ b/core/modules/user/lib/Drupal/user/UserBCDecorator.php
@@ -15,13 +15,6 @@
 class UserBCDecorator extends EntityBCDecorator implements UserInterface {
 
   /**
-   * The decorated user entity.
-   *
-   * @var \Drupal\user\UserInterface
-   */
-  protected $decorated;
-
-  /**
    * {@inheritdoc}
    */
   public function &__get($name) {
@@ -44,13 +37,6 @@ public function getRoles() {
   /**
    * {@inheritdoc}
    */
-  public function hasPermission($permission) {
-    return $this->decorated->hasPermission($permission);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
   public function getSecureSessionId() {
     return $this->decorated->getSecureSessionId();
   }
@@ -90,166 +76,4 @@ public function removeRole($rid) {
     $this->decorated->removeRole($rid);
   }
 
-  /**
-   * {@inheritdoc}
-   */
-  public function getPassword() {
-    return $this->decorated->getPassword();
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function setPassword($password) {
-    $this->decorated->setPassword($password);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getEmail() {
-    return $this->decorated->getEmail();
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function setEmail($mail) {
-    $this->decorated->setEmail($mail);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getDefaultTheme() {
-    return $this->decorated->getDefaultTheme();
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getSignature() {
-    return $this->decorated->getDefaultTheme();
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getSignatureFormat() {
-    return $this->decorated->getSignatureFormat();
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getCreatedTime() {
-    return $this->decorated->getCreatedTime();
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getLastAccessedTime() {
-    return $this->decorated->getLastAccessedTime();
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function setLastAccessTime($timestamp) {
-    $this->decorated->setLastAccessTime($timestamp);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getLastLoginTime() {
-    return $this->decorated->getLastLoginTime();
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function setLastLoginTime($timestamp) {
-    $this->decorated->setLastLoginTime($timestamp);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function isActive() {
-    $this->decorated->isActive();
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function isBlocked() {
-    return $this->decorated->isBlocked();
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function activate() {
-    return $this->decorated->activate();
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function block() {
-    return $this->decorated->block();
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getTimeZone() {
-    return $this->decorated->getTimeZone();
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getPreferredLangcode($default = NULL) {
-    return $this->decorated->getPreferredLangcode($default);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getPreferredAdminLangcode($default = NULL) {
-    return $this->decorated->getPreferredAdminLangcode($default);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getInitialEmail() {
-    return $this->decorated->getInitialEmail();
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function isAuthenticated() {
-    return $this->decorated->id() > 0;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function isAnonymous() {
-    return $this->decorated->id() == 0;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getUsername() {
-    return $this->decorated->getUsername();
-  }
-
-
 }
diff --git a/core/modules/user/lib/Drupal/user/UserInterface.php b/core/modules/user/lib/Drupal/user/UserInterface.php
index 832be39..4dc1481 100644
--- a/core/modules/user/lib/Drupal/user/UserInterface.php
+++ b/core/modules/user/lib/Drupal/user/UserInterface.php
@@ -50,163 +50,4 @@ public function addRole($rid);
    */
   public function removeRole($rid);
 
-  /**
-   * Checks whether a user has a certain permission.
-   *
-   * @param string $permission
-   *   The permission string to check.
-   *
-   * @return bool
-   *   TRUE if the user has the permission, FALSE otherwise.
-   */
-  public function hasPermission($permission);
-
-  /**
-   * Returns the hashed password.
-   *
-   * @return string
-   *   The hashed password.
-   */
-  public function getPassword();
-
-  /**
-   * Sets the user password.
-   *
-   * @param string $password
-   *   The new unhashed password.
-   */
-  public function setPassword($password);
-
-  /**
-   * Returns the e-mail address of the user.
-   *
-   * @return string
-   *   The e-mail address.
-   */
-  public function getEmail();
-
-  /**
-   * Sets the e-mail address of the user.
-   *
-   * @param string $mail
-   *   The new e-mail address of the user.
-   */
-  public function setEmail($mail);
-
-  /**
-   * Returns the default theme of the user.
-   *
-   * @return string
-   *   Name of the theme.
-   */
-  public function getDefaultTheme();
-
-  /**
-   * Returns the user signature.
-   *
-   * @todo: Convert this to a configurable field.
-   *
-   * @return string
-   *   The signature text.
-   */
-  public function getSignature();
-
-  /**
-   * Returns the signature format.
-   *
-   * @return string
-   *   Name of the filter format.
-   */
-  public function getSignatureFormat();
-
-  /**
-   * Returns the creation time of the user as a UNIX timestamp.
-   *
-   * @return int
-   *   Timestamp of the creation date.
-   */
-  public function getCreatedTime();
-
-  /**
-   * The timestamp when the user last accessed the site.
-   *
-   * A value of 0 means the user has never accessed the site.
-   *
-   * @return int
-   *   Timestamp of the last access.
-   */
-  public function getLastAccessedTime();
-
-  /**
-   * Sets the UNIX timestamp when the user last accessed the site..
-   *
-   * @param int $timestamp
-   *   Timestamp of the last access.
-   */
-  public function setLastAccessTime($timestamp);
-
-  /**
-   * Returns the UNIX timestamp when the user last logged in.
-   *
-   * @return int
-   *   Timestamp of the last login time.
-   */
-  public function getLastLoginTime();
-
-  /**
-   * Sets the UNIX timestamp when the user last logged in.
-   *
-   * @param int $timestamp
-   *   Timestamp of the last login time.
-   */
-  public function setLastLoginTime($timestamp);
-
-  /**
-   * Returns TRUE if the user is active.
-   *
-   * @return bool
-   *   TRUE if the user is active, false otherwise.
-   */
-  public function isActive();
-
-  /**
-   * Returns TRUE if the user is blocked.
-   *
-   * @return bool
-   *   TRUE if the user is blocked, false otherwise.
-   */
-  public function isBlocked();
-
-  /**
-   * Activates the user.
-   *
-   * @return \Drupal\user\UserInterface
-   *   The called user entity.
-   */
-  public function activate();
-
-  /**
-   * Blocks the user.
-   *
-   * @return \Drupal\user\UserInterface
-   *   The called user entity.
-   */
-  public function block();
-
-  /**
-   * Returns the timezone of the user.
-   *
-   * @return string
-   *   Name of the timezone.
-   */
-  public function getTimeZone();
-
-  /**
-   * Returns the e-mail that was used when the user was registered.
-   *
-   * @return string
-   *   Initial e-mail address of the user.
-   */
-  public function getInitialEmail();
-
 }
diff --git a/core/modules/user/tests/Drupal/user/Tests/Plugin/Core/Entity/UserTest.php b/core/modules/user/tests/Drupal/user/Tests/Plugin/Core/Entity/UserTest.php
deleted file mode 100644
index 0758f63..0000000
--- a/core/modules/user/tests/Drupal/user/Tests/Plugin/Core/Entity/UserTest.php
+++ /dev/null
@@ -1,46 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\user\Tests\Plugin\Core\Entity\UserTest.
- */
-
-namespace Drupal\user\Tests\Plugin\Core\Entity;
-
-use Drupal\Tests\Core\Session\UserSessionTest;
-use Drupal\user\Plugin\Core\Entity\User;
-
-/**
- * Tests the user object.
- *
- * @see \Drupal\user\Plugin\Core\Entity\User
- */
-class UserTest extends UserSessionTest {
-
-  public static function getInfo() {
-    return array(
-      'name' => 'User object',
-      'description' => 'Tests the user object.',
-      'group' => 'User',
-    );
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  protected function createUserSession(array $rids = array()) {
-    $user = $this->getMockBuilder('Drupal\user\Plugin\Core\Entity\User')
-      ->disableOriginalConstructor()
-      ->setMethods(array('getRoles', 'id'))
-      ->getMock();
-    $user->expects($this->any())
-      ->method('id')
-      // @todo Also test the uid = 1 handling.
-      ->will($this->returnValue(0));
-    $user->expects($this->any())
-      ->method('getRoles')
-      ->will($this->returnValue($rids));
-    return $user;
-  }
-
-}
diff --git a/core/modules/user/tests/Drupal/user/Tests/Views/Argument/RolesRidTest.php b/core/modules/user/tests/Drupal/user/Tests/Views/Argument/RolesRidTest.php
index c5cd817..3cee6d7 100644
--- a/core/modules/user/tests/Drupal/user/Tests/Views/Argument/RolesRidTest.php
+++ b/core/modules/user/tests/Drupal/user/Tests/Views/Argument/RolesRidTest.php
@@ -10,7 +10,6 @@
 use Drupal\Component\Utility\String;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
 use Drupal\Tests\UnitTestCase;
-use Drupal\user\Plugin\Core\Entity\Role;
 use Drupal\user\Plugin\views\argument\RolesRid;
 
 /**
@@ -48,24 +47,28 @@ public static function getInfo() {
    * @see \Drupal\user\Plugin\views\argument\RolesRid::title_query()
    */
   public function testTitleQuery() {
-    $role1 = new Role(array(
-      'id' => 'test_rid_1',
-      'label' => 'test rid 1'
-    ), 'user_role');
-    $role2 = new Role(array(
-      'id' => 'test_rid_2',
-      'label' => 'test <strong>rid 2</strong>',
-    ), 'user_role');
-
-    // Creates a stub entity storage controller;
-    $role_storage_controller = $this->getMockForAbstractClass('Drupal\Core\Entity\EntityStorageControllerInterface');
-    $role_storage_controller->expects($this->any())
-      ->method('loadMultiple')
-      ->will($this->returnValueMap(array(
-        array(array(), array()),
-        array(array('test_rid_1'), array('test_rid_1' => $role1)),
-        array(array('test_rid_1', 'test_rid_2'), array('test_rid_1' => $role1, 'test_rid_2' => $role2)),
-      )));
+    $config = array(
+      'user.role.test_rid_1' => array(
+        'id' => 'test_rid_1',
+        'label' => 'test rid 1'
+      ),
+      'user.role.test_rid_2' => array(
+        'id' => 'test_rid_2',
+        'label' => 'test <strong>rid 2</strong>',
+      ),
+    );
+    $config_factory = $this->getConfigFactoryStub($config);
+    $config_storage = $this->getConfigStorageStub($config);
+
+    $entity_query_factory = $this->getMockBuilder('Drupal\Core\Entity\Query\QueryFactory')
+      ->disableOriginalConstructor()
+      ->getMock();
+
+    // Creates a stub role storage controller and replace the attachLoad()
+    // method with an empty version, because attachLoad() calls
+    // module_implements().
+    $role_storage_controller = $this->getMock('Drupal\user\RoleStorageController', array('attachLoad'), array('user_role', static::$entityInfo, $config_factory, $config_storage, $entity_query_factory));
+
 
     $entity_manager = $this->getMockBuilder('Drupal\Core\Entity\EntityManager')
       ->disableOriginalConstructor()
@@ -89,7 +92,7 @@ public function testTitleQuery() {
     $container->set('plugin.manager.entity', $entity_manager);
     \Drupal::setContainer($container);
 
-    $roles_rid_argument = new RolesRid(array(), 'users_roles_rid', array(), $entity_manager);
+    $roles_rid_argument = new RolesRid($config, 'users_roles_rid', array(), $entity_manager);
 
     $roles_rid_argument->value = array();
     $titles = $roles_rid_argument->title_query();
diff --git a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_groupwise_user.yml b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_groupwise_user.yml
index b0a6665..b3b5b01 100644
--- a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_groupwise_user.yml
+++ b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_groupwise_user.yml
@@ -19,14 +19,12 @@ display:
           id: name
           table: users
           plugin_id: user_name
-          provider: user
         nid:
           field: nid
           id: nid
           relationship: uid_representative
           table: node
           plugin_id: node
-          provider: node
       filters:
         status:
           expose:
@@ -37,7 +35,6 @@ display:
           table: users
           value: '1'
           plugin_id: boolean
-          provider: views
       pager:
         options:
           items_per_page: '10'
@@ -60,7 +57,6 @@ display:
           subquery_view: ''
           table: users
           plugin_id: groupwise_max
-          provider: views
       row:
         type: fields
       sorts:
@@ -70,7 +66,6 @@ display:
           order: DESC
           table: users
           plugin_id: date
-          provider: views
       style:
         type: default
       title: test_groupwise_user
diff --git a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_plugin_argument_default_current_user.yml b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_plugin_argument_default_current_user.yml
index dede313..8af545e 100644
--- a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_plugin_argument_default_current_user.yml
+++ b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_plugin_argument_default_current_user.yml
@@ -16,7 +16,6 @@ display:
           must_not_be: '0'
           style_plugin: default_summary
           table: views
-          provider: views
       cache:
         type: none
       exposed_form:
@@ -37,7 +36,6 @@ display:
           id: title
           link_to_node: '0'
           table: node_field_data
-          provider: node
       pager:
         options:
           id: '0'
diff --git a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_user_bulk_form.yml b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_user_bulk_form.yml
index d6c7538..ca11a38 100644
--- a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_user_bulk_form.yml
+++ b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_user_bulk_form.yml
@@ -20,13 +20,11 @@ display:
           table: users
           field: user_bulk_form
           plugin_id: user_bulk_form
-          provider: user
         name:
           id: name
           table: users
           field: name
           plugin_id: user_name
-          provider: user
       sorts:
         uid:
           id: uid
@@ -34,7 +32,6 @@ display:
           field: uid
           order: ASC
           plugin_id: user
-          provider: views
       filters:
         status:
           id: status
@@ -43,7 +40,6 @@ display:
           operator: '='
           value: '1'
           plugin_id: boolean
-          provider: views
   page_1:
     display_plugin: page
     id: page_1
diff --git a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_user_data.yml b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_user_data.yml
index 725724d..fff9da8 100644
--- a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_user_data.yml
+++ b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_user_data.yml
@@ -45,7 +45,6 @@ display:
           link_to_user: '1'
           overwrite_anonymous: '0'
           plugin_id: string
-          provider: views
         data:
           id: data
           table: users
@@ -94,8 +93,8 @@ display:
           hide_empty: '0'
           empty_zero: '0'
           hide_alter_empty: '1'
-          data_module: views_test_config
-          data_name: test_value_name
+          module: views_test_config
+          name: test_value_name
           plugin_id: user_data
       filters:
         uid:
@@ -108,7 +107,6 @@ display:
             operator: '0'
           group: '1'
           plugin_id: numeric
-          provider: user
       sorts:
         created:
           id: created
@@ -116,7 +114,6 @@ display:
           field: created
           order: DESC
           plugin_id: date
-          provider: views
 label: test_user_data
 module: views
 id: test_user_data
diff --git a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_user_name.yml b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_user_name.yml
index 0d2985c..23de1a0 100644
--- a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_user_name.yml
+++ b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_user_name.yml
@@ -22,7 +22,6 @@ display:
           id: uid
           table: users
           field: uid
-          provider: user
       filters:
         uid:
           id: uid
@@ -37,7 +36,6 @@ display:
             remember_roles:
               authenticated: authenticated
               anonymous: 0
-          provider: user
     display_plugin: default
     display_title: Master
     id: default
diff --git a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_user_relationship.yml b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_user_relationship.yml
index ff0c37b..5a5f283 100644
--- a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_user_relationship.yml
+++ b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_user_relationship.yml
@@ -37,7 +37,6 @@ display:
           overwrite_anonymous: '0'
           table: users
           plugin_id: user_name
-          provider: user
         title:
           alter:
             absolute: '0'
@@ -56,7 +55,6 @@ display:
           link_to_node: '1'
           table: node_field_data
           plugin_id: node
-          provider: node
         uid:
           alter:
             absolute: '0'
@@ -81,7 +79,6 @@ display:
           link_to_user: '1'
           table: users
           plugin_id: user
-          provider: user
       pager:
         options:
           items_per_page: '10'
diff --git a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_user_uid_argument.yml b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_user_uid_argument.yml
index 66f162e..cdb3ca9 100644
--- a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_user_uid_argument.yml
+++ b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_user_uid_argument.yml
@@ -11,19 +11,17 @@ display:
           table: users
           field: uid
           plugin_id: user
-          provider: user
       arguments:
         uid:
           id: uid
           table: users
           field: uid
           title_enable: true
-          title: '%1'
+          title: %1
           plugin_id: user_uid
-          provider: user
     display_plugin: default
     display_title: Master
     id: default
     position: '0'
-label: null
+label:
 id: test_user_uid_argument
diff --git a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_view_argument_validate_user.yml b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_view_argument_validate_user.yml
index eb11808..9121abb 100644
--- a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_view_argument_validate_user.yml
+++ b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_view_argument_validate_user.yml
@@ -18,7 +18,6 @@ display:
           validate:
             type: user
           plugin_id: 'null'
-          provider: views
       cache:
         type: none
       exposed_form:
diff --git a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_views_handler_field_role.yml b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_views_handler_field_role.yml
index 3e333a9..df95c2d 100644
--- a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_views_handler_field_role.yml
+++ b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_views_handler_field_role.yml
@@ -81,7 +81,6 @@ display:
           anonymous_text: ''
           format_username: '1'
           plugin_id: user_name
-          provider: user
         rid:
           id: rid
           table: users_roles
@@ -133,7 +132,6 @@ display:
           type: separator
           separator: ''
           plugin_id: user_roles
-          provider: user
       filters:
         status:
           value: '1'
@@ -144,7 +142,6 @@ display:
             operator: '0'
           group: '1'
           plugin_id: boolean
-          provider: views
       sorts: {  }
       title: test_user_role
   page_1:
diff --git a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_views_handler_field_user_name.yml b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_views_handler_field_user_name.yml
index c68cde3..0274bea 100644
--- a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_views_handler_field_user_name.yml
+++ b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_views_handler_field_user_name.yml
@@ -31,7 +31,6 @@ display:
           overwrite_anonymous: '0'
           table: users
           plugin_id: user_name
-          provider: user
       pager:
         type: full
       query:
diff --git a/core/modules/user/user.admin.inc b/core/modules/user/user.admin.inc
index bb486ff..a745bfa 100644
--- a/core/modules/user/user.admin.inc
+++ b/core/modules/user/user.admin.inc
@@ -41,7 +41,7 @@ function user_admin_account() {
   foreach ($result as $account) {
     $account = user_load($account->uid);
     $users_roles = array();
-    $roles_result = db_query('SELECT rid FROM {users_roles} WHERE uid = :uid', array(':uid' => $account->id()));
+    $roles_result = db_query('SELECT rid FROM {users_roles} WHERE uid = :uid', array(':uid' => $account->uid));
     foreach ($roles_result as $user_role) {
       $users_roles[] = $roles[$user_role->rid];
     }
@@ -54,7 +54,7 @@ function user_admin_account() {
       '#theme' => 'item_list',
       '#items' => $users_roles,
     );
-    $options[$account->id()] = array(
+    $options[$account->uid] = array(
       'username' => drupal_render($username),
       'status' => $status[$account->status],
       'roles' => drupal_render($item_list),
@@ -64,22 +64,22 @@ function user_admin_account() {
     $links = array();
     $links['edit'] = array(
       'title' => t('Edit'),
-      'href' => 'user/' . $account->id() . '/edit',
+      'href' => 'user/' . $account->uid . '/edit',
       'query' => $destination,
     );
     if (module_invoke('content_translation', 'translate_access', $account)) {
       $links['translate'] = array(
         'title' => t('Translate'),
-        'href' => 'user/' . $account->id() . '/translations',
+        'href' => 'user/' . $account->uid . '/translations',
         'query' => $destination,
       );
     }
-    $options[$account->id()]['operations']['data'] = array(
+    $options[$account->uid]['operations']['data'] = array(
       '#type' => 'operations',
       '#links' => $links,
     );
 
-    $options[$account->id()]['title']['data']['#title'] = check_plain($account->name);
+    $options[$account->uid]['title']['data']['#title'] = check_plain($account->name);
 
   }
 
diff --git a/core/modules/user/user.api.php b/core/modules/user/user.api.php
index edb2d6f..2f337d9 100644
--- a/core/modules/user/user.api.php
+++ b/core/modules/user/user.api.php
@@ -65,7 +65,7 @@ function hook_user_load($users) {
  */
 function hook_user_predelete($account) {
   db_delete('mytable')
-    ->condition('uid', $account->id())
+    ->condition('uid', $account->uid)
     ->execute();
 }
 
@@ -121,7 +121,7 @@ function hook_user_cancel($edit, $account, $method) {
       module_load_include('inc', 'node', 'node.admin');
       $nodes = db_select('node_field_data', 'n')
         ->fields('n', array('nid'))
-        ->condition('uid', $account->id())
+        ->condition('uid', $account->uid)
         ->execute()
         ->fetchCol();
       node_mass_update($nodes, array('status' => 0), NULL, TRUE);
@@ -132,14 +132,14 @@ function hook_user_cancel($edit, $account, $method) {
       module_load_include('inc', 'node', 'node.admin');
       $nodes = db_select('node_field_data', 'n')
         ->fields('n', array('nid'))
-        ->condition('uid', $account->id())
+        ->condition('uid', $account->uid)
         ->execute()
         ->fetchCol();
       node_mass_update($nodes, array('uid' => 0), NULL, TRUE);
       // Anonymize old revisions.
       db_update('node_field_revision')
         ->fields(array('uid' => 0))
-        ->condition('uid', $account->id())
+        ->condition('uid', $account->uid)
         ->execute();
       break;
   }
@@ -200,8 +200,8 @@ function hook_user_cancel_methods_alter(&$methods) {
  */
 function hook_user_format_name_alter(&$name, $account) {
   // Display the user's uid instead of name.
-  if ($account->id()) {
-    $name = t('User !uid', array('!uid' => $account->id()));
+  if (isset($account->uid)) {
+    $name = t('User !uid', array('!uid' => $account->uid));
   }
 }
 
@@ -244,7 +244,7 @@ function hook_user_presave($account) {
 function hook_user_insert($account) {
   db_insert('user_changes')
     ->fields(array(
-      'uid' => $account->id(),
+      'uid' => $account->uid,
       'created' => time(),
     ))
     ->execute();
@@ -271,7 +271,7 @@ function hook_user_insert($account) {
 function hook_user_update($account) {
   db_insert('user_changes')
     ->fields(array(
-      'uid' => $account->id(),
+      'uid' => $account->uid,
       'changed' => time(),
     ))
     ->execute();
@@ -287,7 +287,7 @@ function hook_user_login($account) {
   $config = config('system.timezone');
   // If the user has a NULL time zone, notify them to set a time zone.
   if (!$account->timezone && $config->get('user.configurable') && $config->get('user.warn')) {
-    drupal_set_message(t('Configure your <a href="@user-edit">account time zone setting</a>.', array('@user-edit' => url("user/" . $account->id() . "/edit", array('query' => drupal_get_destination(), 'fragment' => 'edit-timezone')))));
+    drupal_set_message(t('Configure your <a href="@user-edit">account time zone setting</a>.', array('@user-edit' => url("user/$account->uid/edit", array('query' => drupal_get_destination(), 'fragment' => 'edit-timezone')))));
   }
 }
 
@@ -300,7 +300,7 @@ function hook_user_login($account) {
 function hook_user_logout($account) {
   db_insert('logouts')
     ->fields(array(
-      'uid' => $account->id(),
+      'uid' => $account->uid,
       'time' => time(),
     ))
     ->execute();
diff --git a/core/modules/user/user.install b/core/modules/user/user.install
index 871c18d..37dc770 100644
--- a/core/modules/user/user.install
+++ b/core/modules/user/user.install
@@ -640,7 +640,7 @@ function user_update_8011() {
         'uri' => $destination,
       ))
       ->fields(array(
-        'uid' => $user->id(),
+        'uid' => $user->uid,
         'status' => FILE_STATUS_PERMANENT,
         'filename' => drupal_basename($destination),
         'uuid' => $uuid->generate(),
@@ -800,7 +800,7 @@ function user_update_8012(&$sandbox) {
 
       // Update file usage from user to file module.
       // @see file_field_insert()
-      // Old: file_usage_add($picture, 'user', 'user', $entity->id();
+      // Old: file_usage_add($picture, 'user', 'user', $entity->uid);
       // New: file_usage_add(file_load($item['fid']), 'file', $entity_type, $id);
       db_update('file_usage')
         ->condition('fid', $fid)
diff --git a/core/modules/user/user.module b/core/modules/user/user.module
index 5127a4c..05a516a 100644
--- a/core/modules/user/user.module
+++ b/core/modules/user/user.module
@@ -159,7 +159,7 @@ function user_uri($user) {
  * @see user_format_name()
  */
 function user_label($entity_type, $entity) {
-  return $entity->getUsername();
+  return user_format_name($entity->getBCEntity());
 }
 
 /**
@@ -462,7 +462,30 @@ function user_access($string, AccountInterface $account = NULL) {
     $account = Drupal::request()->attributes->get('account') ?: $user;
   }
 
-  return $account->hasPermission($string);
+  // Make sure we are working with the BC decorator.
+  $account = $account instanceof User ? $account->getBCEntity() : $account;
+
+  // User #1 has all privileges:
+  if ($account->uid == 1) {
+    return TRUE;
+  }
+
+  // To reduce the number of SQL queries, we cache the user's permissions
+  // in a static variable.
+  // Use the advanced drupal_static() pattern, since this is called very often.
+  static $drupal_static_fast;
+  if (!isset($drupal_static_fast)) {
+    $drupal_static_fast['perm'] = &drupal_static(__FUNCTION__);
+  }
+  $perm = &$drupal_static_fast['perm'];
+  if (!isset($perm[$account->uid])) {
+    $perm[$account->uid] = array();
+    foreach (user_role_permissions($account->getRoles()) as $role_permissions) {
+      $perm[$account->uid] += array_fill_keys($role_permissions, TRUE);
+    }
+  }
+
+  return isset($perm[$account->uid][$string]);
 }
 
 /**
@@ -563,10 +586,10 @@ function user_search_execute($keys = NULL, $conditions = NULL) {
   foreach ($accounts as $account) {
     $result = array(
       'title' => user_format_name($account),
-      'link' => url('user/' . $account->id(), array('absolute' => TRUE)),
+      'link' => url('user/' . $account->uid, array('absolute' => TRUE)),
     );
     if (user_access('administer users')) {
-      $result['title'] .= ' (' . $account->getEmail() . ')';
+      $result['title'] .= ' (' . $account->mail . ')';
     }
     $results[] = $result;
   }
@@ -643,18 +666,25 @@ function user_preprocess_block(&$variables) {
 /**
  * Format a username.
  *
- * @param \Drupal\Core\Session\Interface $account
+ * By default, the passed-in object's 'name' property is used if it exists, or
+ * else, the site-defined value for the 'anonymous' variable. However, a module
+ * may override this by implementing
+ * hook_user_format_name_alter(&$name, $account).
+ *
+ * @see hook_user_format_name_alter()
+ *
+ * @param $account
  *   The account object for the user whose name is to be formatted.
  *
  * @return
  *   An unsanitized string with the username to display. The code receiving
  *   this result must ensure that check_plain() is called on it before it is
  *   printed to the page.
- *
- * @deprecated Use \Drupal\Core\Session\Interface::getUsername() instead.
  */
-function user_format_name(AccountInterface $account) {
-  return $account->getUsername();
+function user_format_name($account) {
+  $name = !empty($account->name) ? $account->name : config('user.settings')->get('anonymous');
+  drupal_alter('user_format_name', $name, $account);
+  return $name;
 }
 
 /**
@@ -677,7 +707,7 @@ function user_template_preprocess_default_variables_alter(&$variables) {
   unset($variables['user']->pass, $variables['user']->sid, $variables['user']->ssid);
 
   $variables['is_admin'] = user_access('access administration pages');
-  $variables['logged_in'] = $user->isAuthenticated();
+  $variables['logged_in'] = ($user->uid > 0);
 }
 
 /**
@@ -690,14 +720,20 @@ function user_template_preprocess_default_variables_alter(&$variables) {
  * @see template_process_username()
  */
 function template_preprocess_username(&$variables) {
-  $account = $variables['account'] ?: drupal_anonymous_user();
+  $account = $variables['account'];
+  if ($account instanceof User) {
+    $account = $account->getBCEntity();
+  }
 
   $variables['extra'] = '';
-  $variables['uid'] = $account->id();
-  if (empty($variables['uid'])) {
-    if (theme_get_setting('features.comment_user_verification')) {
-      $variables['extra'] = ' (' . t('not verified') . ')';
-    }
+  if (empty($account->uid)) {
+   $variables['uid'] = 0;
+   if (theme_get_setting('features.comment_user_verification')) {
+     $variables['extra'] = ' (' . t('not verified') . ')';
+   }
+  }
+  else {
+    $variables['uid'] = (int) $account->uid;
   }
 
   // Set the name to a formatted name that is safe for printing and
@@ -705,7 +741,7 @@ function template_preprocess_username(&$variables) {
   // unsanitized version, in case other preprocess functions want to implement
   // their own shortening logic or add markup. If they do so, they must ensure
   // that $variables['name'] is safe for printing.
-  $name = $variables['name_raw'] = $account->getUsername();
+  $name = $variables['name_raw'] = user_format_name($account);
   if (drupal_strlen($name) > 20) {
     $name = drupal_substr($name, 0, 15) . '...';
   }
@@ -774,7 +810,7 @@ function theme_username($variables) {
  */
 function user_is_anonymous() {
   // Menu administrators can see items for anonymous when administering.
-  return $GLOBALS['user']->isAnonymous() || !empty($GLOBALS['menu_admin']);
+  return !$GLOBALS['user']->uid || !empty($GLOBALS['menu_admin']);
 }
 
 /**
@@ -782,11 +818,9 @@ function user_is_anonymous() {
  *
  * @return bool
  *   TRUE if the user is logged in, FALSE if the user is anonymous.
- *
- * @deprecated Use \Drupal\Core\Session\UserSession::isAuthenticated().
  */
 function user_is_logged_in() {
-  return $GLOBALS['user']->isAuthenticated();
+  return (bool) $GLOBALS['user']->uid;
 }
 
 /**
@@ -1009,7 +1043,7 @@ function user_menu_breadcrumb_alter(&$active_trail, $item) {
 function user_menu_link_load($menu_links) {
   // Hide the "User account" link for anonymous users.
   foreach ($menu_links as $link) {
-    if ($link['link_path'] == 'user' && $link['module'] == 'system' && !$GLOBALS['user']->id()) {
+    if ($link['link_path'] == 'user' && $link['module'] == 'system' && !$GLOBALS['user']->uid) {
       $link['hidden'] = 1;
     }
   }
@@ -1055,7 +1089,7 @@ function user_uid_only_optional_to_arg($arg) {
  */
 function user_uid_optional_load($uid = NULL) {
   if (!isset($uid)) {
-    $uid = $GLOBALS['user']->id();
+    $uid = $GLOBALS['user']->uid;
   }
   return user_load($uid);
 }
@@ -1069,7 +1103,7 @@ function user_uid_optional_to_arg($arg) {
   // Give back the current user uid when called from eg. tracker, aka.
   // with an empty arg. Also use the current user uid when called from
   // the menu with a % for the current account link.
-  return empty($arg) || $arg == '%' ? $GLOBALS['user']->id() : $arg;
+  return empty($arg) || $arg == '%' ? $GLOBALS['user']->uid : $arg;
 }
 
 /**
@@ -1079,7 +1113,7 @@ function user_uid_optional_to_arg($arg) {
  * authenticated users are expected to see "My account".
  */
 function user_menu_title() {
-  if ($GLOBALS['user']->isAnonymous()) {
+  if (!user_is_logged_in()) {
     switch (current_path()) {
       case 'user' :
       case 'user/login' :
@@ -1100,8 +1134,30 @@ function user_menu_title() {
 /**
  * Menu item title callback - use the user name.
  */
-function user_page_title(UserInterface $account = NULL) {
-  return $account ? $account->getUsername() : '';
+function user_page_title($account) {
+  return is_object($account) ? user_format_name($account) : '';
+}
+
+/**
+ * Set up a series for validators which check for blocked users,
+ * then authenticate against local database, then return an error if
+ * authentication fails. Distributed authentication modules are welcome
+ * to use hook_form_alter() to change this series in order to
+ * authenticate against their user database instead of the local users
+ * table. If a distributed authentication module is successful, it
+ * should set $form_state['uid'] to a user ID.
+ *
+ * We use three validators instead of one since external authentication
+ * modules usually only need to alter the second validator.
+ *
+ * @see user_login_name_validate()
+ * @see user_login_authenticate_validate()
+ * @see user_login_final_validate()
+ * @return array
+ *   A simple list of validate functions.
+ */
+function user_login_default_validators() {
+  return array('user_login_name_validate', 'user_login_authenticate_validate', 'user_login_final_validate');
 }
 
 /**
@@ -1122,11 +1178,11 @@ function user_authenticate($name, $password) {
       $password_hasher = drupal_container()->get('password');
       if ($password_hasher->check($password, $account)) {
         // Successful authentication.
-        $uid = $account->id();
+        $uid = $account->uid;
 
         // Update user to new password scheme if needed.
         if ($password_hasher->userNeedsNewHash($account)) {
-          $account->setPassword($password);
+          $account->pass = $password;
           $account->save();
         }
       }
@@ -1144,21 +1200,21 @@ function user_authenticate($name, $password) {
  *
  * The global $user object is replaced with the passed in account.
  *
- * @param \Drupal\user\UserInterface $account
+ * @param \Drupal\Core\Session\AccountInterface $account
  *   The account to log in.
  *
  * @see hook_user_login()
  */
-function user_login_finalize(UserInterface $account) {
+function user_login_finalize(AccountInterface $account) {
   global $user;
   $user = $account;
-  watchdog('user', 'Session opened for %name.', array('%name' => $user->getUsername()));
+  watchdog('user', 'Session opened for %name.', array('%name' => $user->name));
   // Update the user table timestamp noting user has logged in.
   // This is also used to invalidate one-time login links.
-  $account->setLastLoginTime(REQUEST_TIME);
+  $user->login = REQUEST_TIME;
   db_update('users')
-    ->fields(array('login' => $user->getLastLoginTime()))
-    ->condition('uid', $user->id())
+    ->fields(array('login' => $user->login))
+    ->condition('uid', $user->uid)
     ->execute();
 
   // Regenerate the session ID to prevent against session fixation attacks.
@@ -1206,9 +1262,9 @@ function user_user_logout($account) {
  */
 function user_pass_reset_url($account, $options = array()) {
   $timestamp = REQUEST_TIME;
-  $langcode = isset($options['langcode']) ? $options['langcode'] : $account->getPreferredLangcode();
+  $langcode = isset($options['langcode']) ? $options['langcode'] : user_preferred_langcode($account);
   $url_options = array('absolute' => TRUE, 'language' => language_load($langcode));
-  return url("user/reset/" . $account->id() . "/$timestamp/" . user_pass_rehash($account->getPassword(), $timestamp, $account->getLastLoginTime()), $url_options);
+  return url("user/reset/$account->uid/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login), $url_options);
 }
 
 /**
@@ -1234,9 +1290,9 @@ function user_pass_reset_url($account, $options = array()) {
  */
 function user_cancel_url($account, $options = array()) {
   $timestamp = REQUEST_TIME;
-  $langcode = isset($options['langcode']) ? $options['langcode'] : $account->getPreferredLangcode();
+  $langcode = isset($options['langcode']) ? $options['langcode'] : user_preferred_langcode($account);
   $url_options = array('absolute' => TRUE, 'language' => language_load($langcode));
-  return url("user/" . $account->id() . "/cancel/confirm/$timestamp/" . user_pass_rehash($account->getPassword(), $timestamp, $account->login), $url_options);
+  return url("user/$account->uid/cancel/confirm/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login), $url_options);
 }
 
 /**
@@ -1315,7 +1371,7 @@ function user_cancel($edit, $uid, $method) {
   );
 
   // After cancelling account, ensure that user is logged out.
-  if ($account->id() == $user->id()) {
+  if ($account->uid == $user->uid) {
     // Batch API stores data in the session, so use the finished operation to
     // manipulate the current user's session id.
     $batch['finished'] = '_user_cancel_session_regenerate';
@@ -1358,7 +1414,7 @@ function _user_cancel($edit, $account, $method) {
       if (!empty($edit['user_cancel_notify'])) {
         _user_mail_notify('status_canceled', $account);
       }
-      $account->delete();
+      user_delete($account->uid);
       drupal_set_message(t('%name has been deleted.', array('%name' => $account->name)));
       watchdog('user', 'Deleted user: %name %email.', array('%name' => $account->name, '%email' => '<' . $account->mail . '>'), WATCHDOG_NOTICE);
       break;
@@ -1368,7 +1424,7 @@ function _user_cancel($edit, $account, $method) {
   // their session though, as we might have information in it, and we can't
   // regenerate it because batch API uses the session ID, we will regenerate it
   // in _user_cancel_session_regenerate().
-  if ($account->id() == $user->id()) {
+  if ($account->uid == $user->uid) {
     $user = drupal_anonymous_user();
   }
 
@@ -1724,6 +1780,8 @@ function user_role_grant_permissions($rid, array $permissions = array()) {
     $role->grantPermission($permission);
   }
   $role->save();
+  // Clear the user access cache.
+  drupal_static_reset('user_access');
 }
 
 /**
@@ -1744,11 +1802,13 @@ function user_role_revoke_permissions($rid, array $permissions = array()) {
     $role->revokePermission($permission);
   }
   $role->save();
+  // Clear the user access cache.
+  drupal_static_reset('user_access');
 }
 
 function user_multiple_cancel_confirm($form, &$form_state) {
   // Retrieve the accounts to be canceled from the temp store.
-  $accounts = Drupal::service('user.tempstore')->get('user_user_operations_cancel')->get($GLOBALS['user']->id());
+  $accounts = Drupal::service('user.tempstore')->get('user_user_operations_cancel')->get($GLOBALS['user']->uid);
   $form['accounts'] = array('#prefix' => '<ul>', '#suffix' => '</ul>', '#tree' => TRUE);
   foreach ($accounts as $account) {
     $uid = $account->id();
@@ -1816,7 +1876,7 @@ function user_multiple_cancel_confirm_submit($form, &$form_state) {
   global $user;
 
   // Clear out the accounts from the temp store.
-  Drupal::service('user.tempstore')->get('user_user_operations_cancel')->delete($user->id());
+  Drupal::service('user.tempstore')->get('user_user_operations_cancel')->delete($user->uid);
   if ($form_state['values']['confirm']) {
     foreach ($form_state['values']['accounts'] as $uid => $value) {
       // Prevent programmatic form submissions from cancelling user 1.
@@ -1824,12 +1884,12 @@ function user_multiple_cancel_confirm_submit($form, &$form_state) {
         continue;
       }
       // Prevent user administrators from deleting themselves without confirmation.
-      if ($uid == $user->id()) {
+      if ($uid == $user->uid) {
         $admin_form_state = $form_state;
         unset($admin_form_state['values']['user_cancel_confirm']);
         // The $user global is not a complete user entity, so load the full
         // entity.
-        $admin_form_state['values']['_account'] = user_load($user->id());
+        $admin_form_state['values']['_account'] = user_load($user->uid);
         user_cancel_confirm_form_submit(array(), $admin_form_state);
       }
       else {
@@ -1864,6 +1924,40 @@ function theme_user_signature($variables) {
 }
 
 /**
+ * Get the language object preferred by the user. This user preference can
+ * be set on the user account editing page, and is only available if there
+ * are more than one languages enabled on the site. If the user did not
+ * choose a preferred language, or is the anonymous user, the $default
+ * value, or if it is not set, the site default language will be returned.
+ *
+ * @param $account
+ *   User account to look up language for.
+ * @param $type
+ *   Optional string to define which preferred langcode should be used.
+ *   Default to 'preferred_langcode' property.
+ *   If set 'preferred_$type_langcode' is used.
+ * @param $default
+ *   Optional default language code to return if the account
+ *   has no valid language.
+ */
+function user_preferred_langcode($account, $type = NULL, $default = NULL) {
+  $language_list = language_list();
+  $account = $account->getBCEntity();
+  if (isset($type)) {
+    $preferred_langcode = $account->{'preferred_' . $type . '_langcode'};
+  }
+  else {
+    $preferred_langcode = $account->preferred_langcode;
+  }
+  if (!empty($preferred_langcode) && isset($language_list[$preferred_langcode])) {
+    return $language_list[$preferred_langcode]->id;
+  }
+  else {
+    return $default ? $default : language_default()->id;
+  }
+}
+
+/**
  * Conditionally create and send a notification email when a certain
  * operation happens on the given user account.
  *
@@ -1899,7 +1993,7 @@ function _user_mail_notify($op, $account, $langcode = NULL) {
   $notify = config('user.settings')->get('notify.' . $op);
   if ($notify || ($op != 'status_canceled' && $op != 'status_blocked')) {
     $params['account'] = $account;
-    $langcode = $langcode ? $langcode : $account->getPreferredLangcode();
+    $langcode = $langcode ? $langcode : user_preferred_langcode($account);
     // Get the custom site notification email to use as the from email address
     // if it has been set.
     $site_mail = config('system.site')->get('mail_notification');
@@ -2063,7 +2157,7 @@ function user_toolbar() {
   global $user;
 
   // Add logout & user account links or login link.
-  if ($user->isAuthenticated()) {
+  if ($user->uid) {
     $links = array(
       'account' => array(
         'title' => t('View profile'),
@@ -2075,7 +2169,7 @@ function user_toolbar() {
       ),
       'account_edit' => array(
         'title' => t('Edit profile'),
-        'href' => 'user/' . $user->id() . '/edit',
+        'href' => 'user/' . $user->uid . '/edit',
         'html' => TRUE,
         'attributes' => array(
           'title' => t('Edit user account'),
@@ -2100,12 +2194,12 @@ function user_toolbar() {
     '#type' => 'toolbar_item',
     'tab' => array(
       '#type' => 'link',
-      '#title' => $user->getUsername(),
+      '#title' => user_format_name($user),
       '#href' => 'user',
       '#options' => array(
         'attributes' => array(
           'title' => t('My account'),
-          'class' => array('toolbar-icon', 'toolbar-icon-user'),
+          'class' => array('icon', 'icon-user'),
         ),
       ),
     ),
diff --git a/core/modules/user/user.pages.inc b/core/modules/user/user.pages.inc
index 6077a27..f5f164f 100644
--- a/core/modules/user/user.pages.inc
+++ b/core/modules/user/user.pages.inc
@@ -19,10 +19,10 @@ function user_pass_reset($form, &$form_state, $uid, $timestamp, $hashed_pass, $a
 
   // When processing the one-time login link, we have to make sure that a user
   // isn't already logged in.
-  if ($user->isAuthenticated()) {
+  if ($user->uid) {
     // The existing user is already logged in.
-    if ($user->id() == $uid) {
-      drupal_set_message(t('You are logged in as %user. <a href="!user_edit">Change your password.</a>', array('%user' => $user->name, '!user_edit' => url("user/" . $user->id() . "/edit"))));
+    if ($user->uid == $uid) {
+      drupal_set_message(t('You are logged in as %user. <a href="!user_edit">Change your password.</a>', array('%user' => $user->name, '!user_edit' => url("user/$user->uid/edit"))));
     }
     // A different user is already logged in on the computer.
     else {
@@ -49,7 +49,7 @@ function user_pass_reset($form, &$form_state, $uid, $timestamp, $hashed_pass, $a
         drupal_set_message(t('You have tried to use a one-time login link that has expired. Please request a new one using the form below.'));
         return new RedirectResponse(url('user/password', array('absolute' => TRUE)));
       }
-      elseif ($account->isAuthenticated() && $timestamp >= $account->login && $timestamp <= $current && $hashed_pass == user_pass_rehash($account->pass, $timestamp, $account->login)) {
+      elseif ($account->uid && $timestamp >= $account->login && $timestamp <= $current && $hashed_pass == user_pass_rehash($account->pass, $timestamp, $account->login)) {
         // First stage is a confirmation form, then login
         if ($action == 'login') {
           // Set the new user.
@@ -60,8 +60,8 @@ function user_pass_reset($form, &$form_state, $uid, $timestamp, $hashed_pass, $a
           drupal_set_message(t('You have just used your one-time login link. It is no longer necessary to use this link to log in. Please change your password.'));
           // Let the user's password be changed without the current password check.
           $token = Crypt::randomStringHashed(55);
-          $_SESSION['pass_reset_' . $user->id()] = $token;
-          return new RedirectResponse(url('user/' . $user->id() . '/edit', array(
+          $_SESSION['pass_reset_' . $user->uid] = $token;
+          return new RedirectResponse(url('user/' . $user->uid . '/edit', array(
             'query' => array('pass-reset-token' => $token),
             'absolute' => TRUE,
           )));
@@ -129,7 +129,7 @@ function user_edit_cancel_submit($form, &$form_state) {
   }
   // Note: We redirect from user/uid/edit to user/uid/cancel to make the tabs disappear.
   $account = $form_state['controller']->getEntity();
-  $form_state['redirect'] = array("user/" . $account->id() . "/cancel", array('query' => $destination));
+  $form_state['redirect'] = array("user/" . $account->uid . "/cancel", array('query' => $destination));
 }
 
 /**
@@ -148,7 +148,7 @@ function user_cancel_confirm_form($form, &$form_state, $account) {
   $can_select_method = $admin_access || user_access('select account cancellation method');
   $form['user_cancel_method'] = array(
     '#type' => 'radios',
-    '#title' => ($account->id() == $user->id() ? t('When cancelling your account') : t('When cancelling the account')),
+    '#title' => ($account->uid == $user->uid ? t('When cancelling your account') : t('When cancelling the account')),
     '#access' => $can_select_method,
   );
   $form['user_cancel_method'] += user_cancel_methods();
@@ -156,7 +156,7 @@ function user_cancel_confirm_form($form, &$form_state, $account) {
   // Allow user administrators to skip the account cancellation confirmation
   // mail (by default), as long as they do not attempt to cancel their own
   // account.
-  $override_access = $admin_access && ($account->id() != $user->id());
+  $override_access = $admin_access && ($account->uid != $user->uid);
   $form['user_cancel_confirm'] = array(
     '#type' => 'checkbox',
     '#title' => t('Require e-mail confirmation to cancel account.'),
@@ -175,7 +175,7 @@ function user_cancel_confirm_form($form, &$form_state, $account) {
   );
 
   // Prepare confirmation form page title and description.
-  if ($account->id() == $user->id()) {
+  if ($account->uid == $user->uid) {
     $question = t('Are you sure you want to cancel your account?');
   }
   else {
@@ -193,10 +193,10 @@ function user_cancel_confirm_form($form, &$form_state, $account) {
   }
 
   // Always provide entity id in the same form key as in the entity edit form.
-  $form['uid'] = array('#type' => 'value', '#value' => $account->id());
+  $form['uid'] = array('#type' => 'value', '#value' => $account->uid);
   return confirm_form($form,
     $question,
-    'user/' . $account->id(),
+    'user/' . $account->uid,
     $description . ' ' . t('This action cannot be undone.'),
     t('Cancel account'), t('Cancel'));
 }
@@ -214,8 +214,8 @@ function user_cancel_confirm_form_submit($form, &$form_state) {
   // Cancel account immediately, if the current user has administrative
   // privileges, no confirmation mail shall be sent, and the user does not
   // attempt to cancel the own account.
-  if (user_access('administer users') && empty($form_state['values']['user_cancel_confirm']) && $account->id() != $user->id()) {
-    user_cancel($form_state['values'], $account->id(), $form_state['values']['user_cancel_method']);
+  if (user_access('administer users') && empty($form_state['values']['user_cancel_confirm']) && $account->uid != $user->uid) {
+    user_cancel($form_state['values'], $account->uid, $form_state['values']['user_cancel_method']);
 
     $form_state['redirect'] = 'admin/people';
   }
@@ -229,7 +229,7 @@ function user_cancel_confirm_form_submit($form, &$form_state) {
     drupal_set_message(t('A confirmation request to cancel your account has been sent to your e-mail address.'));
     watchdog('user', 'Sent account cancellation request to %name %email.', array('%name' => $account->name, '%email' => '<' . $account->mail . '>'), WATCHDOG_NOTICE);
 
-    $form_state['redirect'] = "user/" . $account->id();
+    $form_state['redirect'] = "user/$account->uid";
   }
 }
 
@@ -306,7 +306,7 @@ function user_cancel_confirm($account, $timestamp = 0, $hashed_pass = '') {
   $account_data = drupal_container()->get('user.data')->get('user', $account->id());
   if (isset($account_data['cancel_method']) && !empty($timestamp) && !empty($hashed_pass)) {
     // Validate expiration and hashed password/login.
-    if ($timestamp <= $current && $current - $timestamp < $timeout && $account->id() && $timestamp >= $account->login && $hashed_pass == user_pass_rehash($account->pass, $timestamp, $account->login)) {
+    if ($timestamp <= $current && $current - $timestamp < $timeout && $account->uid && $timestamp >= $account->login && $hashed_pass == user_pass_rehash($account->pass, $timestamp, $account->login)) {
       $edit = array(
         'user_cancel_notify' => isset($account_data['cancel_notify']) ? $account_data['cancel_notify'] : config('user.settings')->get('notify.status_canceled'),
       );
@@ -318,7 +318,7 @@ function user_cancel_confirm($account, $timestamp = 0, $hashed_pass = '') {
     }
     else {
       drupal_set_message(t('You have tried to use an account cancellation link that has expired. Please request a new one using the form below.'));
-      return new RedirectResponse(url("user/" . $account->id() . "/cancel", array('absolute' => TRUE)));
+      return new RedirectResponse(url("user/$account->uid/cancel", array('absolute' => TRUE)));
     }
   }
   throw new AccessDeniedHttpException();
diff --git a/core/modules/user/user.tokens.inc b/core/modules/user/user.tokens.inc
index 1f98006..185ad6e 100644
--- a/core/modules/user/user.tokens.inc
+++ b/core/modules/user/user.tokens.inc
@@ -83,7 +83,7 @@ function user_tokens($type, $tokens, array $data = array(), array $options = arr
         // Basic user account information.
         case 'uid':
           // In the case of hook user_presave uid is not set yet.
-          $replacements[$original] = $account->id() ?: t('not yet assigned');
+          $replacements[$original] = !empty($account->uid) ? $account->uid : t('not yet assigned');
           break;
 
         case 'name':
@@ -96,11 +96,11 @@ function user_tokens($type, $tokens, array $data = array(), array $options = arr
           break;
 
         case 'url':
-          $replacements[$original] = $account->id() ? url("user/" . $account->id(), $url_options) : t('not yet assigned');
+          $replacements[$original] = !empty($account->uid) ? url("user/$account->uid", $url_options) : t('not yet assigned');
           break;
 
         case 'edit-url':
-          $replacements[$original] = $account->id() ? url("user/" . $account->id() . "/edit", $url_options) : t('not yet assigned');
+          $replacements[$original] = !empty($account->uid) ? url("user/$account->uid/edit", $url_options) : t('not yet assigned');
           break;
 
         // These tokens are default variations on the chained tokens handled below.
@@ -125,7 +125,7 @@ function user_tokens($type, $tokens, array $data = array(), array $options = arr
   }
 
   if ($type == 'current-user') {
-    $account = user_load($GLOBALS['user']->id());
+    $account = user_load($GLOBALS['user']->uid);
     $replacements += $token_service->generate('user', $tokens, array('user' => $account), $options);
   }
 
diff --git a/core/modules/user/user.views.inc b/core/modules/user/user.views.inc
index 0a8b49b..f9b35ca 100644
--- a/core/modules/user/user.views.inc
+++ b/core/modules/user/user.views.inc
@@ -250,7 +250,7 @@ function user_views_data() {
   );
 
   $data['users']['status'] = array(
-    'title' => t('Status'),
+    'title' => t('Active status'),
     'help' => t('Whether a user is active or blocked.'),
     'field' => array(
       'id' => 'boolean',
diff --git a/core/modules/user/user.views_execution.inc b/core/modules/user/user.views_execution.inc
index 622cdbf..371d112 100644
--- a/core/modules/user/user.views_execution.inc
+++ b/core/modules/user/user.views_execution.inc
@@ -14,5 +14,5 @@
  */
 function user_views_query_substitutions(ViewExecutable $view) {
   global $user;
-  return array('***CURRENT_USER***' => $user->id());
+  return array('***CURRENT_USER***' => intval($user->uid));
 }
diff --git a/core/modules/views/config/schema/views.schema.yml b/core/modules/views/config/schema/views.schema.yml
index fe09a65..463eb63 100644
--- a/core/modules/views/config/schema/views.schema.yml
+++ b/core/modules/views/config/schema/views.schema.yml
@@ -7,6 +7,8 @@ views.view.*:
     status:
       type: boolean
       label: 'Status'
+    api_version:
+      label: 'API version'
     module:
       label: 'Module'
     name:
diff --git a/core/modules/views/config/schema/views.style.schema.yml b/core/modules/views/config/schema/views.style.schema.yml
index dc6edd0..15dae70 100644
--- a/core/modules/views/config/schema/views.style.schema.yml
+++ b/core/modules/views/config/schema/views.style.schema.yml
@@ -29,24 +29,15 @@ views.style.grid:
     columns:
       type:  integer
       label: 'Number of columns'
-    automatic_width:
-      type: boolean
-      label: 'Automatic width'
     alignment:
       type: string
       label: 'Alignment'
-    row_class_custom:
-      type: string
-      label: 'Custom row classes'
-    row_class_default:
+    fill_single_line:
       type: boolean
-      label: 'Default views row classes'
-    col_class_custom:
+      label: 'Fill up single line'
+    summary:
       type: string
-      label: 'Custom column classes'
-    col_class_default:
-      type: boolean
-      label: 'Default views column classes'
+      label: 'Table summary'
 
 views.style.table:
   type: views_style
@@ -119,22 +110,3 @@ views.style.default_summary:
     items_per_page:
       type: integer
       label: 'Items to display'
-
-views.style.rss:
-  type: mapping
-  label: 'RSS Feed'
-  mapping:
-    description:
-      type: label
-      label: 'RSS description'
-
-views.style.unformatted_summary:
-  type: mapping
-  label: 'Unformatted'
-  mapping:
-    inline:
-      type: boolean
-      label: 'Display items inline'
-    separator:
-      type: string
-      label: 'Separator'
diff --git a/core/modules/views/config/views.view.archive.yml b/core/modules/views/config/views.view.archive.yml
index fa9b7a3..cfd12cf 100644
--- a/core/modules/views/config/views.view.archive.yml
+++ b/core/modules/views/config/views.view.archive.yml
@@ -67,7 +67,6 @@ display:
           expose:
             label: ''
           granularity: second
-          provider: views
       arguments:
         created_year_month:
           id: created_year_month
@@ -87,7 +86,6 @@ display:
             items_per_page: '30'
           specify_validation: '1'
           plugin_id: date_year_month
-          provider: views
       filters:
         status:
           id: status
@@ -98,7 +96,6 @@ display:
           expose:
             operator: '0'
           plugin_id: boolean
-          provider: views
       style:
         type: default
         options:
@@ -156,7 +153,6 @@ display:
             items_per_page: '30'
           specify_validation: '1'
           plugin_id: date_year_month
-          provider: views
 label: Archive
 module: node
 id: archive
diff --git a/core/modules/views/config/views.view.backlinks.yml b/core/modules/views/config/views.view.backlinks.yml
index ec0bb3d..38c125b 100644
--- a/core/modules/views/config/views.view.backlinks.yml
+++ b/core/modules/views/config/views.view.backlinks.yml
@@ -65,7 +65,6 @@ display:
           group_type: group
           admin_label: ''
           tokenize: '0'
-          provider: views
       fields:
         title:
           id: title
@@ -117,7 +116,6 @@ display:
           hide_empty: '0'
           empty_zero: '0'
           hide_alter_empty: '1'
-          provider: node
       arguments:
         nid:
           id: nid
@@ -132,8 +130,6 @@ display:
           specify_validation: '1'
           validate:
             type: node
-          plugin_id: node_nid
-          provider: node
       filters:
         status:
           id: status
@@ -144,7 +140,6 @@ display:
           expose:
             operator: '0'
           plugin_id: boolean
-          provider: views
       style:
         type: html_list
         options:
@@ -212,8 +207,6 @@ display:
           specify_validation: '1'
           validate:
             type: node
-          plugin_type: node_nid
-          provider: node
       style:
         type: html_list
       row:
diff --git a/core/modules/views/config/views.view.comments_recent.yml b/core/modules/views/config/views.view.comments_recent.yml
index 378170d..9a3ce2b 100644
--- a/core/modules/views/config/views.view.comments_recent.yml
+++ b/core/modules/views/config/views.view.comments_recent.yml
@@ -51,7 +51,6 @@ display:
           group_type: group
           admin_label: Content
           required: '0'
-          provider: views
       fields:
         subject:
           id: subject
@@ -104,7 +103,6 @@ display:
           empty_zero: '0'
           hide_alter_empty: '1'
           link_to_node: '0'
-          provider: comment
         timestamp:
           id: timestamp
           table: comment
@@ -157,7 +155,6 @@ display:
           hide_alter_empty: '1'
           custom_date_format: ''
           timezone: ''
-          provider: views
       sorts:
         changed:
           id: changed
@@ -172,7 +169,6 @@ display:
           expose:
             label: ''
           granularity: second
-          provider: views
       filters:
         status_extra:
           id: status_extra
@@ -181,7 +177,6 @@ display:
           relationship: nid
           group: '0'
           plugin_id: node_status
-          provider: node
       style:
         type: html_list
         options:
@@ -270,7 +265,6 @@ display:
           hide_empty: '0'
           empty_zero: '0'
           hide_alter_empty: '1'
-          provider: node
         timestamp:
           id: timestamp
           table: comment
@@ -323,7 +317,6 @@ display:
           hide_alter_empty: '1'
           custom_date_format: ''
           timezone: ''
-          provider: views
         subject:
           id: subject
           table: comment
@@ -375,7 +368,6 @@ display:
           empty_zero: '0'
           hide_alter_empty: '1'
           link_to_node: '0'
-          provider: comment
         comment:
           id: comment
           table: field_data_comment_body
@@ -438,7 +430,6 @@ display:
           multi_type: separator
           separator: ', '
           field_api_classes: '0'
-          provider: field
       path: comments/recent
       style:
         type: html_list
diff --git a/core/modules/views/config/views.view.glossary.yml b/core/modules/views/config/views.view.glossary.yml
index e5d3118..23e095c 100644
--- a/core/modules/views/config/views.view.glossary.yml
+++ b/core/modules/views/config/views.view.glossary.yml
@@ -104,7 +104,6 @@ display:
           hide_empty: '0'
           empty_zero: '0'
           hide_alter_empty: '1'
-          provider: node
         name:
           id: name
           table: users
@@ -158,7 +157,6 @@ display:
           overwrite_anonymous: '0'
           anonymous_text: ''
           format_username: '1'
-          provider: user
         changed:
           id: changed
           table: node_field_data
@@ -211,7 +209,6 @@ display:
           hide_alter_empty: '1'
           custom_date_format: ''
           timezone: ''
-          provider: views
       arguments:
         title:
           id: title
@@ -246,7 +243,6 @@ display:
             fail: 'not found'
           validate_options: {  }
           break_phrase: '0'
-          provider: views
       relationships:
         uid:
           id: uid
@@ -257,7 +253,6 @@ display:
           group_type: group
           admin_label: author
           required: '0'
-          provider: views
       style:
         type: table
         options:
@@ -364,7 +359,6 @@ display:
             fail: 'not found'
           validate_options: {  }
           break_phrase: '0'
-          provider: views
       displays:
         default: default
         page_1: page_1
diff --git a/core/modules/views/config/views.view.taxonomy_term.yml b/core/modules/views/config/views.view.taxonomy_term.yml
index e09771c..7dda43d 100644
--- a/core/modules/views/config/views.view.taxonomy_term.yml
+++ b/core/modules/views/config/views.view.taxonomy_term.yml
@@ -65,7 +65,6 @@ display:
           exposed: '0'
           expose:
             label: ''
-          provider: views
         created:
           id: created
           table: node_field_data
@@ -79,7 +78,6 @@ display:
           expose:
             label: ''
           granularity: second
-          provider: views
       arguments:
         term_node_tid_depth:
           id: term_node_tid_depth
@@ -110,7 +108,6 @@ display:
           validate_options: {  }
           set_breadcrumb: '0'
           use_taxonomy_term_path: '0'
-          provider: taxonomy
         term_node_tid_depth_modifier:
           id: term_node_tid_depth_modifier
           table: node
@@ -137,7 +134,6 @@ display:
             type: none
             fail: 'not found'
           validate_options: {  }
-          provider: taxonomy
       filters:
         status_extra:
           id: status_extra
@@ -147,7 +143,6 @@ display:
           expose:
             operator: '0'
           plugin_id: node_status
-          provider: node
       style:
         type: default
         options:
diff --git a/core/modules/views/config/views.view.tracker.yml b/core/modules/views/config/views.view.tracker.yml
index 178421f..fa81fff 100644
--- a/core/modules/views/config/views.view.tracker.yml
+++ b/core/modules/views/config/views.view.tracker.yml
@@ -63,7 +63,6 @@ display:
           group_type: group
           admin_label: author
           required: '0'
-          provider: views
       fields:
         type:
           id: type
@@ -116,7 +115,6 @@ display:
           hide_alter_empty: '1'
           link_to_node: '0'
           machine_name: '0'
-          provider: node
         title:
           id: title
           table: node_field_data
@@ -167,7 +165,6 @@ display:
           empty_zero: '0'
           hide_alter_empty: '1'
           link_to_node: '1'
-          provider: node
         name:
           id: name
           table: users
@@ -221,7 +218,6 @@ display:
           overwrite_anonymous: '0'
           anonymous_text: ''
           format_username: '1'
-          provider: user
         comment_count:
           id: comment_count
           table: node_comment_statistics
@@ -280,7 +276,6 @@ display:
           format_plural_plural: '@count'
           prefix: ''
           suffix: ''
-          provider: views
         last_comment_timestamp:
           id: last_comment_timestamp
           table: node_comment_statistics
@@ -333,7 +328,6 @@ display:
           date_format: small
           custom_date_format: ''
           timezone: ''
-          provider: comment
         timestamp:
           id: timestamp
           table: history
@@ -385,7 +379,6 @@ display:
           hide_empty: '0'
           empty_zero: '0'
           hide_alter_empty: '1'
-          provider: history
         new_comments:
           id: new_comments
           table: node
@@ -445,7 +438,6 @@ display:
           format_plural_singular: '1'
           format_plural_plural: '@count'
           prefix: ''
-          provider: comment
       sorts:
         last_comment_timestamp:
           id: last_comment_timestamp
@@ -460,7 +452,6 @@ display:
           expose:
             label: ''
           granularity: second
-          provider: views
       arguments:
         uid_touch:
           id: uid_touch
@@ -488,7 +479,6 @@ display:
             type: none
             fail: 'not found'
           validate_options: {  }
-          provider: comment
       filters:
         status:
           id: status
@@ -499,7 +489,6 @@ display:
           expose:
             operator: '0'
           plugin_id: boolean
-          provider: views
       style:
         type: table
         options:
diff --git a/core/modules/views/css/views.exposed_form.css b/core/modules/views/css/views.exposed_form.css
deleted file mode 100644
index 273e598..0000000
--- a/core/modules/views/css/views.exposed_form.css
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
- * @file
- * Styling for Views exposed forms.
- */
-.views-exposed-form .form-item {
-  /* Display exposed form elements horizontally. */
-  float: left; /* LTR */
-  margin-right: .25em; /* LTR */
-}
-[dir="rtl"] .views-exposed-form .form-item {
-  float: right;
-  margin-left: .25em;
-}
-
-.views-exposed-form .form-actions {
-  clear: left; /* LTR */
-}
-[dir="rtl"] .views-exposed-form .form-actions {
-  clear: right;
-}
diff --git a/core/modules/views/css/views.module.css b/core/modules/views/css/views.module.css
index 707b712..7ca2f49 100644
--- a/core/modules/views/css/views.module.css
+++ b/core/modules/views/css/views.module.css
@@ -1,3 +1,13 @@
+.views-exposed-form .views-exposed-widget {
+  display: inline-block;
+}
+
+.views-exposed-form .form-item,
+.views-exposed-form .form-submit {
+  margin-top: 0;
+  margin-bottom: 0;
+}
+
 /* table style column align */
 .views-align-left {
   text-align: left;
@@ -12,13 +22,3 @@
 .view .progress-disabled {
   float: none;
 }
-
-/* Grid style column align. */
-.views-view-grid .views-col {
-  float: left;
-}
-.views-view-grid .views-row {
-  clear: both;
-  float: left;
-  width: 100%;
-}
diff --git a/core/modules/views/js/ajax_view.js b/core/modules/views/js/ajax_view.js
index 50d3750..1f37390 100644
--- a/core/modules/views/js/ajax_view.js
+++ b/core/modules/views/js/ajax_view.js
@@ -68,16 +68,6 @@ Drupal.views.ajaxView = function(settings) {
     // to a given element.
     .filter(jQuery.proxy(this.filterNestedViews, this))
     .once(jQuery.proxy(this.attachPagerAjax, this));
-
-  // Add a trigger to update this view specifically. In order to trigger a
-  // refresh use the following code.
-  //
-  // @code
-  // jQuery('.view-name').trigger('RefreshView');
-  // @endcode
-  var self_settings = this.element_settings;
-  self_settings.event = 'RefreshView';
-  this.refreshViewAjax = new Drupal.ajax(this.selector, this.$view, self_settings);
 };
 
 Drupal.views.ajaxView.prototype.attachExposedFormAjax = function() {
diff --git a/core/modules/views/lib/Drupal/views/ManyToOneHelper.php b/core/modules/views/lib/Drupal/views/ManyToOneHelper.php
index 08c8cd9..ccd3c3b 100644
--- a/core/modules/views/lib/Drupal/views/ManyToOneHelper.php
+++ b/core/modules/views/lib/Drupal/views/ManyToOneHelper.php
@@ -37,7 +37,7 @@ public function buildOptionsForm(&$form, &$form_state) {
     $form['reduce_duplicates'] = array(
       '#type' => 'checkbox',
       '#title' => t('Reduce duplicates'),
-      '#description' => t("This filter can cause items that have more than one of the selected options to appear as duplicate results. If this filter causes duplicate results to occur, this checkbox can reduce those duplicates; however, the more terms it has to search for, the less performant the query will be, so use this with caution. Shouldn't be set on single-value fields, as it may cause values to disappear from display, if used on an incompatible field."),
+      '#description' => t('This filter can cause items that have more than one of the selected options to appear as duplicate results. If this filter causes duplicate results to occur, this checkbox can reduce those duplicates; however, the more terms it has to search for, the less performant the query will be, so use this with caution. Shouldn\'t be set on single-value fields, as it may cause values to disappear from display, if used on an incompatible field.'),
       '#default_value' => !empty($this->handler->options['reduce_duplicates']),
       '#weight' => 4,
     );
diff --git a/core/modules/views/lib/Drupal/views/Plugin/Derivative/ViewsBlock.php b/core/modules/views/lib/Drupal/views/Plugin/Derivative/ViewsBlock.php
index d932e5f..1d243d5 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/Derivative/ViewsBlock.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/Derivative/ViewsBlock.php
@@ -7,16 +7,14 @@
 
 namespace Drupal\views\Plugin\Derivative;
 
-use Drupal\Core\Entity\EntityStorageControllerInterface;
-use Drupal\Core\Plugin\Discovery\ContainerDerivativeInterface;
-use Symfony\Component\DependencyInjection\ContainerInterface;
+use Drupal\Component\Plugin\Derivative\DerivativeInterface;
 
 /**
  * Provides block plugin definitions for all Views block displays.
  *
  * @see \Drupal\views\Plugin\block\block\ViewsBlock
  */
-class ViewsBlock implements ContainerDerivativeInterface {
+class ViewsBlock implements DerivativeInterface {
 
   /**
    * List of derivative definitions.
@@ -26,43 +24,6 @@ class ViewsBlock implements ContainerDerivativeInterface {
   protected $derivatives = array();
 
   /**
-   * The base plugin ID.
-   *
-   * @var string
-   */
-  protected $base_plugin_id;
-
-  /**
-   * The view storage controller.
-   *
-   * @var \Drupal\Core\Entity\EntityStorageControllerInterface
-   */
-  protected $viewStorageController;
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function create(ContainerInterface $container, $base_plugin_id) {
-    return new static(
-      $base_plugin_id,
-      $container->get('plugin.manager.entity')->getStorageController('view')
-    );
-  }
-
-  /**
-   * Constructs a ViewsBlock object.
-   *
-   * @param string $base_plugin_id
-   *   The base plugin ID.
-   * @param \Drupal\Core\Entity\EntityStorageControllerInterface $view_storage_controller
-   *   The entity storage controller to load views.
-   */
-  public function __construct($base_plugin_id, EntityStorageControllerInterface $view_storage_controller) {
-    $this->basePluginId = $base_plugin_id;
-    $this->viewStorageController = $view_storage_controller;
-  }
-
-  /**
    * Implements \Drupal\Component\Plugin\Derivative\DerivativeInterface::getDerivativeDefinition().
    */
   public function getDerivativeDefinition($derivative_id, array $base_plugin_definition) {
@@ -78,7 +39,7 @@ public function getDerivativeDefinition($derivative_id, array $base_plugin_defin
    */
   public function getDerivativeDefinitions(array $base_plugin_definition) {
     // Check all Views for block displays.
-    foreach ($this->viewStorageController->loadMultiple() as $view) {
+    foreach (views_get_all_views() as $view) {
       // Do not return results for disabled views.
       if (!$view->status()) {
         continue;
diff --git a/core/modules/views/lib/Drupal/views/Plugin/Discovery/ViewsHandlerDiscovery.php b/core/modules/views/lib/Drupal/views/Plugin/Discovery/ViewsHandlerDiscovery.php
index 460ef5a..51664cb 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/Discovery/ViewsHandlerDiscovery.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/Discovery/ViewsHandlerDiscovery.php
@@ -7,7 +7,7 @@
 
 namespace Drupal\views\Plugin\Discovery;
 
-use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
+use Drupal\Component\Plugin\Discovery\AnnotatedClassDiscovery;
 
 /**
  * Defines a discovery mechanism to find Views handlers in PSR-0 namespaces.
@@ -48,10 +48,7 @@ function __construct($type, \Traversable $root_namespaces) {
     foreach ($root_namespaces as $namespace => $dir) {
       $plugin_namespaces["$namespace\\Plugin\\views\\{$type}"] = array($dir);
     }
-
-    $this->pluginNamespaces = $plugin_namespaces;
-    $this->annotationNamespaces = $annotation_namespaces;
-    $this->pluginDefinitionAnnotationName = 'Drupal\Component\Annotation\PluginID';
+    parent::__construct($plugin_namespaces, $annotation_namespaces, 'Drupal\Component\Annotation\PluginID');
   }
 
   /**
diff --git a/core/modules/views/lib/Drupal/views/Plugin/entity_reference/selection/ViewsSelection.php b/core/modules/views/lib/Drupal/views/Plugin/entity_reference/selection/ViewsSelection.php
index e9db07e..c5df6d7 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/entity_reference/selection/ViewsSelection.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/entity_reference/selection/ViewsSelection.php
@@ -7,18 +7,19 @@
 
 namespace Drupal\views\Plugin\entity_reference\selection;
 
+use Drupal\Component\Annotation\Plugin;
 use Drupal\Core\Annotation\Translation;
 use Drupal\Core\Database\Query\SelectInterface;
 use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Entity\Field\FieldDefinitionInterface;
-use Drupal\entity_reference\Annotation\EntityReferenceSelection;
 use Drupal\entity_reference\Plugin\Type\Selection\SelectionInterface;
 
 /**
  * Plugin implementation of the 'selection' entity_reference.
  *
- * @EntityReferenceSelection(
+ * @Plugin(
  *   id = "views",
+ *   module = "views",
  *   label = @Translation("Views: Filter by an entity reference view"),
  *   group = "views",
  *   weight = 0
@@ -56,7 +57,7 @@ public function __construct(FieldDefinitionInterface $field_definition, EntityIn
   }
 
   /**
-   * {@inheritdoc}
+   * Implements \Drupal\entity_reference\Plugin\Type\Selection\SelectionInterface::settingsForm().
    */
   public static function settingsForm(&$field, &$instance) {
     $view_settings = empty($instance['settings']['handler_settings']['view']) ? array() : $instance['settings']['handler_settings']['view'];
@@ -154,7 +155,7 @@ protected function initializeView($match = NULL, $match_operator = 'CONTAINS', $
   }
 
   /**
-   * {@inheritdoc}
+   * Implements \Drupal\entity_reference\Plugin\Type\Selection\SelectionInterface::getReferenceableEntities().
    */
   public function getReferenceableEntities($match = NULL, $match_operator = 'CONTAINS', $limit = 0) {
     $handler_settings = $this->fieldDefinition->getFieldSetting('handler_settings');
@@ -177,7 +178,7 @@ public function getReferenceableEntities($match = NULL, $match_operator = 'CONTA
   }
 
   /**
-   * {@inheritdoc}
+   * Implements \Drupal\entity_reference\Plugin\Type\Selection\SelectionInterface::countReferenceableEntities().
    */
   public function countReferenceableEntities($match = NULL, $match_operator = 'CONTAINS') {
     $this->getReferenceableEntities($match, $match_operator);
@@ -185,7 +186,7 @@ public function countReferenceableEntities($match = NULL, $match_operator = 'CON
   }
 
   /**
-   * {@inheritdoc}
+   * Implements \Drupal\entity_reference\Plugin\Type\Selection\SelectionInterface::validateReferenceableEntities().
    */
   public function validateReferenceableEntities(array $ids) {
     $handler_settings = $this->fieldDefinition->getFieldSetting('handler_settings');
@@ -201,14 +202,14 @@ public function validateReferenceableEntities(array $ids) {
   }
 
   /**
-   * {@inheritdoc}
+   * Implements \Drupal\entity_reference\Plugin\Type\Selection\SelectionInterface::validateAutocompleteInput().
    */
   public function validateAutocompleteInput($input, &$element, &$form_state, $form, $strict = TRUE) {
     return NULL;
   }
 
   /**
-   * {@inheritdoc}
+   * Implements \Drupal\entity_reference\Plugin\Type\Selection\SelectionInterface::entityQueryAlter().
    */
   public function entityQueryAlter(SelectInterface $query) {}
 
@@ -240,5 +241,4 @@ public function settingsFormValidate($element, &$form_state, $form) {
     $value = array('view_name' => $view, 'display_name' => $display, 'arguments' => $arguments);
     form_set_value($element, $value, $form_state);
   }
-
 }
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/HandlerBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/HandlerBase.php
index 5569977..ac95d5b 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/HandlerBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/HandlerBase.php
@@ -280,34 +280,21 @@ public function buildOptionsForm(&$form, &$form_state) {
     // be moved to their fieldset during preRender.
     $form['#pre_render'][] = 'views_ui_pre_render_add_fieldset_markup';
 
-    parent::buildOptionsForm($form, $form_state);
-
-    $form['fieldsets'] = array(
-      '#type' => 'value',
-      '#value' => array('more', 'admin_label'),
-    );
-
     $form['admin_label'] = array(
-      '#type' => 'details',
-      '#title' => t('Administrative title'),
-      '#collapsed' => TRUE,
-      '#weight' => 150,
-    );
-    $form['admin_label']['admin_label'] = array(
       '#type' => 'textfield',
       '#title' => t('Administrative title'),
       '#description' => t('This title will be displayed on the views edit page instead of the default one. This might be useful if you have the same item twice.'),
       '#default_value' => $this->options['admin_label'],
-      '#parents' => array('options', 'admin_label'),
+      '#fieldset' => 'more',
     );
 
     // This form is long and messy enough that the "Administrative title" option
-    // belongs in "Administrative title" fieldset at the bottom of the form.
+    // belongs in "more options" details at the bottom of the form.
     $form['more'] = array(
       '#type' => 'details',
       '#title' => t('More'),
       '#collapsed' => TRUE,
-      '#weight' => 200,
+      '#weight' => 150,
     );
     // Allow to alter the default values brought into the form.
     // @todo Do we really want to keep this hook.
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/PluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/PluginBase.php
index 285f53a..5693a38 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/PluginBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/PluginBase.php
@@ -7,13 +7,11 @@
 
 namespace Drupal\views\Plugin\views;
 
-use Drupal\Component\Plugin\PluginBase as ComponentPluginBase;
-use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
+use Drupal\Core\Plugin\ContainerFactoryPluginBase;
 use Drupal\views\Plugin\views\display\DisplayPluginBase;
 use Drupal\views\ViewExecutable;
-use Symfony\Component\DependencyInjection\ContainerInterface;
 
-abstract class PluginBase extends ComponentPluginBase implements ContainerFactoryPluginInterface {
+abstract class PluginBase extends ContainerFactoryPluginBase {
 
   /**
    * Options for this plugin will be held here.
@@ -65,13 +63,6 @@ public function __construct(array $configuration, $plugin_id, array $plugin_defi
   }
 
   /**
-   * {@inheritdoc}
-   */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, array $plugin_definition) {
-    return new static($configuration, $plugin_id, $plugin_definition);
-  }
-
-  /**
    * Initialize the plugin.
    *
    * @param \Drupal\views\ViewExecutable $view
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/area/Entity.php b/core/modules/views/lib/Drupal/views/Plugin/views/area/Entity.php
index 2684476..72ccc54 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/area/Entity.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/area/Entity.php
@@ -91,7 +91,7 @@ protected function buildViewModeOptions() {
   /**
    * Overrides \Drupal\views\Plugin\views\area\AreaPluginBase::render().
    */
-  public function render($empty = FALSE) {
+  function render($empty = FALSE) {
     if (!$empty || !empty($this->options['empty'])) {
       $entity_id = $this->tokenizeValue($this->options['entity_id']);
       if ($entity = entity_load($this->entityType, $entity_id)) {
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/area/Result.php b/core/modules/views/lib/Drupal/views/Plugin/views/area/Result.php
index 8b1e218..e339081 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/area/Result.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/area/Result.php
@@ -58,7 +58,7 @@ public function buildOptionsForm(&$form, &$form_state) {
   /**
    * Implements \Drupal\views\Plugin\views\area\AreaPluginBase::render().
    */
-  public function render($empty = FALSE) {
+  function render($empty = FALSE) {
     // Must have options and does not work on summaries.
     if (!isset($this->options['content']) || $this->view->plugin_name == 'default_summary') {
       return array();
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/area/Text.php b/core/modules/views/lib/Drupal/views/Plugin/views/area/Text.php
index 645e10d..783f46a 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/area/Text.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/area/Text.php
@@ -52,7 +52,7 @@ public function submitOptionsForm(&$form, &$form_state) {
   /**
    * Implements \Drupal\views\Plugin\views\area\AreaPluginBase::render().
    */
-  public function render($empty = FALSE) {
+  function render($empty = FALSE) {
     $format = isset($this->options['format']) ? $this->options['format'] : filter_default_format();
     if (!$empty || !empty($this->options['empty'])) {
       return array(
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/area/TextCustom.php b/core/modules/views/lib/Drupal/views/Plugin/views/area/TextCustom.php
index 2b07806..2b1762b 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/area/TextCustom.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/area/TextCustom.php
@@ -43,7 +43,7 @@ public function buildOptionsForm(&$form, &$form_state) {
   /**
    * Implements \Drupal\views\Plugin\views\area\AreaPluginBase::render().
    */
-  public function render($empty = FALSE) {
+  function render($empty = FALSE) {
     if (!$empty || !empty($this->options['empty'])) {
       return array(
         '#markup' => $this->renderTextarea($this->options['content']),
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/area/View.php b/core/modules/views/lib/Drupal/views/Plugin/views/area/View.php
index 103df0a..26cce16 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/area/View.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/area/View.php
@@ -56,7 +56,7 @@ public function buildOptionsForm(&$form, &$form_state) {
   /**
    * Implements \Drupal\views\Plugin\views\area\AreaPluginBase::render().
    */
-  public function render($empty = FALSE) {
+  function render($empty = FALSE) {
     if (!empty($this->options['view_to_insert'])) {
       list($view_name, $display_id) = explode(':', $this->options['view_to_insert']);
 
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/cache/CachePluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/cache/CachePluginBase.php
index 5dab9c7..62ed735 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/cache/CachePluginBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/cache/CachePluginBase.php
@@ -286,7 +286,7 @@ public function generateResultsKey() {
       $key_data = array(
         'build_info' => $build_info,
         'roles' => $user->roles,
-        'super-user' => $user->id() == 1, // special caching for super user.
+        'super-user' => $user->uid == 1, // special caching for super user.
         'langcode' => language(Language::TYPE_INTERFACE)->id,
         'base_url' => $GLOBALS['base_url'],
       );
@@ -315,7 +315,7 @@ public function generateOutputKey() {
       $key_data = array(
         'result' => $this->view->result,
         'roles' => $user->roles,
-        'super-user' => $user->id() == 1, // special caching for super user.
+        'super-user' => $user->uid == 1, // special caching for super user.
         'theme' => $GLOBALS['theme'],
         'langcode' => language(Language::TYPE_INTERFACE)->id,
         'base_url' => $GLOBALS['base_url'],
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/exposed_form/ExposedFormPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/exposed_form/ExposedFormPluginBase.php
index bcab59d..625a2bf 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/exposed_form/ExposedFormPluginBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/exposed_form/ExposedFormPluginBase.php
@@ -218,7 +218,7 @@ public function exposedFormAlter(&$form, &$form_state) {
         $form['sort_order'] = array(
           '#type' => 'select',
           '#options' => $sort_order,
-          '#title' => t('Order', array(), array('context' => 'Sort order')),
+          '#title' => t('Order'),
           '#default_value' => $default_sort_order,
         );
       }
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/field/Boolean.php b/core/modules/views/lib/Drupal/views/Plugin/views/field/Boolean.php
index 6f586af..f70df25 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/field/Boolean.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/field/Boolean.php
@@ -100,7 +100,7 @@ public function buildOptionsForm(&$form, &$form_state) {
     parent::buildOptionsForm($form, $form_state);
   }
 
-  public function render($values) {
+  function render($values) {
     $value = $this->getValue($values);
     if (!empty($this->options['not'])) {
       $value = !$value;
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/field/Custom.php b/core/modules/views/lib/Drupal/views/Plugin/views/field/Custom.php
index b1ce7ae..38982ee 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/field/Custom.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/field/Custom.php
@@ -41,7 +41,7 @@ public function buildOptionsForm(&$form, &$form_state) {
     $form['#pre_render'][] = array($this, 'preRenderCustomForm');
   }
 
-  public function render($values) {
+  function render($values) {
     // Return the text, so the code never thinks the value is empty.
     return $this->options['alter']['text'];
   }
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/field/Date.php b/core/modules/views/lib/Drupal/views/Plugin/views/field/Date.php
index 654e27a..a19c50b 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/field/Date.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/field/Date.php
@@ -8,9 +8,6 @@
 namespace Drupal\views\Plugin\views\field;
 
 use Drupal\Component\Annotation\PluginID;
-use Drupal\Core\Entity\EntityStorageControllerInterface;
-use Symfony\Component\DependencyInjection\ContainerInterface;
-use Drupal\Core\Datetime\Date as DateService;
 
 /**
  * A handler to provide proper displays for dates.
@@ -21,54 +18,6 @@
  */
 class Date extends FieldPluginBase {
 
-  /**
-   * The date service.
-   *
-   * @var \Drupal\Core\Datetime\Date
-   */
-  protected $dateService;
-
-  /**
-   * The date format storage.
-   *
-   * @var \Drupal\Core\Entity\EntityStorageControllerInterface
-   */
-  protected $dateFormatStorage;
-
-  /**
-   * Constructs a new Date object.
-   *
-   * @param array $configuration
-   *   A configuration array containing information about the plugin instance.
-   * @param string $plugin_id
-   *   The plugin ID for the plugin instance.
-   * @param array $plugin_definition
-   *   The plugin implementation definition.
-   * @param \Drupal\Core\Datetime\Date $date_service
-   *   The date service.
-   * @param \Drupal\Core\Entity\EntityStorageControllerInterface $date_format_storage
-   *   The date format storage.
-   */
-  public function __construct(array $configuration, $plugin_id, array $plugin_definition, DateService $date_service, EntityStorageControllerInterface $date_format_storage) {
-    parent::__construct($configuration, $plugin_id, $plugin_definition);
-
-    $this->dateService = $date_service;
-    $this->dateFormatStorage = $date_format_storage;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, array $plugin_definition) {
-    return new static(
-      $configuration,
-      $plugin_id,
-      $plugin_definition,
-      $container->get('date'),
-      $container->get('plugin.manager.entity')->getStorageController('date_format')
-    );
-  }
-
   protected function defineOptions() {
     $options = parent::defineOptions();
 
@@ -82,8 +31,9 @@ protected function defineOptions() {
   public function buildOptionsForm(&$form, &$form_state) {
 
     $date_formats = array();
-    foreach ($this->dateFormatStorage->loadMultiple() as $machine_name => $value) {
-      $date_formats[$machine_name] = t('@name format: @date', array('@name' => $value->label(), '@date' => $this->dateService->format(REQUEST_TIME, $machine_name)));
+    $date_types = system_get_date_formats();
+    foreach ($date_types as $machine_name => $value) {
+      $date_formats[$machine_name] = t('@name format: @date', array('@name' => $value['name'], '@date' => format_date(REQUEST_TIME, $machine_name)));
     }
 
     $form['date_format'] = array(
@@ -129,7 +79,7 @@ public function buildOptionsForm(&$form, &$form_state) {
     parent::buildOptionsForm($form, $form_state);
   }
 
-  public function render($values) {
+  function render($values) {
     $value = $this->getValue($values);
     $format = $this->options['date_format'];
     if (in_array($format, array('custom', 'raw time ago', 'time ago', 'raw time hence', 'time hence', 'raw time span', 'time span', 'raw time span', 'inverse time span', 'time span'))) {
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/field/FieldPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/field/FieldPluginBase.php
index 19d2d2b..fda023a 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/field/FieldPluginBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/field/FieldPluginBase.php
@@ -859,10 +859,11 @@ public function buildOptionsForm(&$form, &$form_state) {
       $this->documentSelfTokens($options[t('Fields')]);
 
       // Default text.
-      $output = '<p>' . t('You must add some additional fields to this display before using this field. These fields may be marked as <em>Exclude from display</em> if you prefer. Note that due to rendering order, you cannot use fields that come after this field; if you need a field not listed here, rearrange your fields.') . '</p>';
+      $output = t('<p>You must add some additional fields to this display before using this field. These fields may be marked as <em>Exclude from display</em> if you prefer. Note that due to rendering order, you cannot use fields that come after this field; if you need a field not listed here, rearrange your fields.</p>');
       // We have some options, so make a list.
       if (!empty($options)) {
-        $output = '<p>' . t("The following tokens are available for this field. Note that due to rendering order, you cannot use fields that come after this field; if you need a field not listed here, rearrange your fields. If you would like to have the characters '[' and ']' use the html entity codes '%5B' or '%5D' or they will get replaced with empty space.") . '</p>';
+        $output = t('<p>The following tokens are available for this field. Note that due to rendering order, you cannot use fields that come after this field; if you need a field not listed here, rearrange your fields.
+If you would like to have the characters \'[\' and \']\' use the html entity codes \'%5B\' or  \'%5D\' or they will get replaced with empty space.</p>');
         foreach (array_keys($options) as $type) {
           if (!empty($options[$type])) {
             $items = array();
@@ -1097,7 +1098,7 @@ public function preRender(&$values) { }
    * @param $values
    *   The values retrieved from the database.
    */
-  public function render($values) {
+  function render($values) {
     $value = $this->getValue($values);
     return $this->sanitizeValue($value);
   }
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/field/FileSize.php b/core/modules/views/lib/Drupal/views/Plugin/views/field/FileSize.php
index bcf2e71..98e1991 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/field/FileSize.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/field/FileSize.php
@@ -38,7 +38,7 @@ public function buildOptionsForm(&$form, &$form_state) {
     );
   }
 
-  public function render($values) {
+  function render($values) {
     $value = $this->getValue($values);
     if ($value) {
       switch ($this->options['file_size_display']) {
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/field/MachineName.php b/core/modules/views/lib/Drupal/views/Plugin/views/field/MachineName.php
index f90b1a9..6632da4 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/field/MachineName.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/field/MachineName.php
@@ -66,7 +66,7 @@ public function preRender(&$values) {
     $this->getValueOptions();
   }
 
-  public function render($values) {
+  function render($values) {
     $value = $values->{$this->field_alias};
     if (!empty($this->options['machine_name']) || !isset($this->value_options[$value])) {
       $result = check_plain($value);
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/field/Markup.php b/core/modules/views/lib/Drupal/views/Plugin/views/field/Markup.php
index 24c98c1..6e19dfd 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/field/Markup.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/field/Markup.php
@@ -40,7 +40,7 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o
     }
   }
 
-  public function render($values) {
+  function render($values) {
     $value = $this->getValue($values);
     if (is_array($this->format)) {
       $format = $this->getValue($values, 'format');
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/field/Numeric.php b/core/modules/views/lib/Drupal/views/Plugin/views/field/Numeric.php
index 0ab6c6f..8687a2c 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/field/Numeric.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/field/Numeric.php
@@ -124,7 +124,7 @@ public function buildOptionsForm(&$form, &$form_state) {
     parent::buildOptionsForm($form, $form_state);
   }
 
-  public function render($values) {
+  function render($values) {
     $value = $this->getValue($values);
     if (!empty($this->options['set_precision'])) {
       $value = number_format($value, $this->options['precision'], $this->options['decimal'], $this->options['separator']);
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/field/Serialized.php b/core/modules/views/lib/Drupal/views/Plugin/views/field/Serialized.php
index 2aa8639..d1a9060 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/field/Serialized.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/field/Serialized.php
@@ -59,7 +59,7 @@ public function validateOptionsForm(&$form, &$form_state) {
     }
   }
 
-  public function render($values) {
+  function render($values) {
     $value = $values->{$this->field_alias};
 
     if ($this->options['format'] == 'unserialized') {
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/field/TimeInterval.php b/core/modules/views/lib/Drupal/views/Plugin/views/field/TimeInterval.php
index a42de6f..e8c514c 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/field/TimeInterval.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/field/TimeInterval.php
@@ -37,7 +37,7 @@ public function buildOptionsForm(&$form, &$form_state) {
     );
   }
 
-  public function render($values) {
+  function render($values) {
     $value = $values->{$this->field_alias};
     return format_interval($value, isset($this->options['granularity']) ? $this->options['granularity'] : 2);
   }
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/field/Url.php b/core/modules/views/lib/Drupal/views/Plugin/views/field/Url.php
index 9b72709..4399d59 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/field/Url.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/field/Url.php
@@ -38,7 +38,7 @@ public function buildOptionsForm(&$form, &$form_state) {
     parent::buildOptionsForm($form, $form_state);
   }
 
-  public function render($values) {
+  function render($values) {
     $value = $this->getValue($values);
     if (!empty($this->options['display_as_link'])) {
       return l($this->sanitizeValue($value), $value, array('html' => TRUE));
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/field/Xss.php b/core/modules/views/lib/Drupal/views/Plugin/views/field/Xss.php
index 9f1aa5e..572e709 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/field/Xss.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/field/Xss.php
@@ -19,7 +19,7 @@
  */
 class Xss extends FieldPluginBase {
 
-  public function render($values) {
+  function render($values) {
     $value = $this->getValue($values);
     return $this->sanitizeValue($value, 'xss');
   }
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/filter/FilterPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/filter/FilterPluginBase.php
index 60ba107..ec65d2c 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/filter/FilterPluginBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/filter/FilterPluginBase.php
@@ -550,6 +550,7 @@ public function buildExposeForm(&$form, &$form_state) {
             ':input[name="options[expose][use_operator]"]' => array('checked' => TRUE),
           ),
         ),
+        '#fieldset' => 'more',
       );
     }
     else {
@@ -594,6 +595,7 @@ public function buildExposeForm(&$form, &$form_state) {
       '#title' => t('Filter identifier'),
       '#size' => 40,
       '#description' => t('This will appear in the URL after the ? to identify this filter. Cannot be blank.'),
+      '#fieldset' => 'more',
     );
   }
 
@@ -852,6 +854,7 @@ protected function buildExposedFiltersGroupForm(&$form, &$form_state) {
       '#title' => t('Filter identifier'),
       '#size' => 40,
       '#description' => t('This will appear in the URL after the ? to identify this filter. Cannot be blank.'),
+      '#fieldset' => 'more',
     );
     $form['group_info']['label'] = array(
       '#type' => 'textfield',
@@ -906,6 +909,7 @@ protected function buildExposedFiltersGroupForm(&$form, &$form_state) {
       '#title' => t('Filter identifier'),
       '#size' => 40,
       '#description' => t('This will appear in the URL after the ? to identify this filter. Cannot be blank.'),
+      '#fieldset' => 'more',
     );
     $form['group_info']['label'] = array(
       '#type' => 'textfield',
@@ -1229,7 +1233,7 @@ public function convertExposedInput(&$input, $selected_group_id = NULL) {
         $input[$this->options['expose']['operator']] = $this->options['group_info']['group_items'][$selected_group]['operator'];
 
         // Value can be optional, For example for 'empty' and 'not empty' filters.
-        if (isset($this->options['group_info']['group_items'][$selected_group]['value']) && $this->options['group_info']['group_items'][$selected_group]['value'] != '') {
+        if (!empty($this->options['group_info']['group_items'][$selected_group]['value'])) {
           $input[$this->options['expose']['identifier']] = $this->options['group_info']['group_items'][$selected_group]['value'];
         }
         $this->options['expose']['use_operator'] = TRUE;
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/join/JoinPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/join/JoinPluginBase.php
index 0294e6a..a91e5fe 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/join/JoinPluginBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/join/JoinPluginBase.php
@@ -6,8 +6,7 @@
  */
 
 namespace Drupal\views\Plugin\views\join;
-
-use Drupal\Component\Plugin\PluginBase;
+use Drupal\Core\Plugin\ContainerFactoryPluginBase;
 
 /**
  * @defgroup views_join_handlers Views join handlers
@@ -50,7 +49,7 @@
  *
  * Extensions of this class can be used to create more interesting joins.
  */
-class JoinPluginBase extends PluginBase {
+class JoinPluginBase extends ContainerFactoryPluginBase {
 
   /**
    * The table to join (right table).
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/pager/Full.php b/core/modules/views/lib/Drupal/views/Plugin/views/pager/Full.php
index a7c41db..7c317b6 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/pager/Full.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/pager/Full.php
@@ -80,7 +80,7 @@ public function summaryTitle() {
   /**
    * Overrides \Drupal\views\Plugin\views\pager\PagerPluginBase::render().
    */
-  public function render($input) {
+  function render($input) {
     $pager_theme = $this->view->buildThemeFunctions('pager');
     // The 0, 1, 3, 4 indexes are correct. See the template_preprocess_pager()
     // documentation.
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/pager/Mini.php b/core/modules/views/lib/Drupal/views/Plugin/views/pager/Mini.php
index 70acf99..39db31e 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/pager/Mini.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/pager/Mini.php
@@ -57,7 +57,7 @@ public function query() {
 
     // Don't query for the next page if we have a pager that has a limited
     // amount of pages.
-    if ($this->getItemsPerPage() > 0 && (empty($this->options['total_pages']) || ($this->getCurrentPage() < $this->options['total_pages']))) {
+    if (empty($this->options['total_pages']) || ($this->getCurrentPage() < $this->options['total_pages'])) {
       // Increase the items in the query in order to be able to find out whether
       // there is another page.
       $limit = $this->view->query->getLimit();
@@ -79,7 +79,7 @@ public function useCountQuery() {
   public function postExecute(&$result) {
     // In query() one more item might have been retrieved than necessary. If so,
     // the next link needs to be displayed and the item removed.
-    if ($this->getItemsPerPage() > 0 && count($result) > $this->getItemsPerPage()) {
+    if (count($result) > $this->getItemsPerPage()) {
       array_pop($result);
       // Make sure the pager shows the next link by setting the total items to
       // the biggest possible number but prevent failing calculations like
@@ -89,13 +89,13 @@ public function postExecute(&$result) {
     else {
       $total = $this->getCurrentPage() * $this->getItemsPerPage() + count($result);
     }
-    $this->total_items = $total;
+    pager_default_initialize($total, $this->getItemsPerPage(), $this->options['id']);
   }
 
   /**
    * Overrides \Drupal\views\Plugin\views\pager\PagerPluginBase::render().
    */
-  public function render($input) {
+  function render($input) {
     // The 1, 3 indexes are correct, see template_preprocess_pager().
     $tags = array(
       1 => $this->options['tags']['previous'],
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/pager/PagerPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/pager/PagerPluginBase.php
index 30c0b9d..9994cf5 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/pager/PagerPluginBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/pager/PagerPluginBase.php
@@ -183,12 +183,13 @@ public function executeCountQuery(&$count_query) {
       $this->total_items -= $this->options['offset'];
     }
 
+    $this->updatePageInfo();
     return $this->total_items;
   }
 
   /**
    * If there are pagers that need global values set, this method can
-   * be used to set them. It will be called after the query is run.
+   * be used to set them. It will be called when the count query is run.
    */
   public function updatePageInfo() {
 
@@ -226,7 +227,7 @@ public function preRender(&$result) { }
    *   Any extra GET parameters that should be retained, such as exposed
    *   input.
    */
-  public function render($input) { }
+  function render($input) { }
 
   /**
    * Determine if there are more records available.
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/query/Sql.php b/core/modules/views/lib/Drupal/views/Plugin/views/query/Sql.php
index 8162b2c..2ba6eb6 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/query/Sql.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/query/Sql.php
@@ -1431,8 +1431,9 @@ function execute(ViewExecutable $view) {
         }
 
         $view->pager->postExecute($view->result);
-        $view->pager->updatePageInfo();
-        $view->total_rows = $view->pager->getTotalItems();
+        if ($view->pager->useCountQuery() || !empty($view->get_total_rows)) {
+          $view->total_rows = $view->pager->getTotalItems();
+        }
 
         // Load all entities contained in the results.
         $this->loadEntities($view->result);
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/row/EntityRow.php b/core/modules/views/lib/Drupal/views/Plugin/views/row/EntityRow.php
index 88654d0..10ae792 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/row/EntityRow.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/row/EntityRow.php
@@ -164,7 +164,7 @@ public function preRender($result) {
   /**
    * Overrides Drupal\views\Plugin\views\row\RowPluginBase::render().
    */
-  public function render($row) {
+  function render($row) {
     $entity_id = $row->{$this->field_alias};
     return $this->build[$entity_id];
   }
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/row/RowPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/row/RowPluginBase.php
index a7ce04b..4a22155 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/row/RowPluginBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/row/RowPluginBase.php
@@ -147,7 +147,7 @@ public function preRender($result) { }
    * @return string
    *   The rendered output of a single row, used by the style plugin.
    */
-  public function render($row) {
+  function render($row) {
     return array(
       '#theme' => $this->themeFunctions(),
       '#view' => $this->view,
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/row/RssFields.php b/core/modules/views/lib/Drupal/views/Plugin/views/row/RssFields.php
index d051c54..887ea5c 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/row/RssFields.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/row/RssFields.php
@@ -126,7 +126,7 @@ public function validate() {
     return $errors;
   }
 
-  public function render($row) {
+  function render($row) {
     static $row_index;
     if (!isset($row_index)) {
       $row_index = 0;
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/style/DefaultSummary.php b/core/modules/views/lib/Drupal/views/Plugin/views/style/DefaultSummary.php
index 05d5c2a..3d28046 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/style/DefaultSummary.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/style/DefaultSummary.php
@@ -77,7 +77,7 @@ public function buildOptionsForm(&$form, &$form_state) {
     );
   }
 
-  public function render() {
+  function render() {
     $rows = array();
     foreach ($this->view->result as $row) {
       // @todo: Include separator as an option.
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/style/Grid.php b/core/modules/views/lib/Drupal/views/Plugin/views/style/Grid.php
index fb4c05d..0631661 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/style/Grid.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/style/Grid.php
@@ -33,22 +33,28 @@ class Grid extends StylePluginBase {
   protected $usesRowPlugin = TRUE;
 
   /**
-   * {@inheritdoc}
+   * Does the style plugin support custom css class for the rows.
+   *
+   * @var bool
+   */
+  protected $usesRowClass = TRUE;
+
+  /**
+   * Set default options
    */
   protected function defineOptions() {
     $options = parent::defineOptions();
+
     $options['columns'] = array('default' => '4');
-    $options['automatic_width'] = array('default' => TRUE);
     $options['alignment'] = array('default' => 'horizontal');
-    $options['col_class_custom'] = array('default' => '');
-    $options['col_class_default'] = array('default' => TRUE);
-    $options['row_class_custom'] = array('default' => '');
-    $options['row_class_default'] = array('default' => TRUE);
+    $options['fill_single_line'] = array('default' => TRUE, 'bool' => TRUE);
+    $options['summary'] = array('default' => '');
+
     return $options;
   }
 
   /**
-   * {@inheritdoc}
+   * Render the given style.
    */
   public function buildOptionsForm(&$form, &$form_state) {
     parent::buildOptionsForm($form, $form_state);
@@ -57,13 +63,7 @@ public function buildOptionsForm(&$form, &$form_state) {
       '#title' => t('Number of columns'),
       '#default_value' => $this->options['columns'],
       '#required' => TRUE,
-      '#min' => 1,
-    );
-    $form['automatic_width'] = array(
-      '#type' => 'checkbox',
-      '#title' => t('Automatic width'),
-      '#description' => t('The width of each column will be calculated automatically based on the number of columns provided. If additional classes are entered or a theme injects classes based on a grid system, disabling this option may prove beneficial.'),
-      '#default_value' => $this->options['automatic_width'],
+      '#min' => 0,
     );
     $form['alignment'] = array(
       '#type' => 'radios',
@@ -72,36 +72,20 @@ public function buildOptionsForm(&$form, &$form_state) {
       '#default_value' => $this->options['alignment'],
       '#description' => t('Horizontal alignment will place items starting in the upper left and moving right. Vertical alignment will place items starting in the upper left and moving down.'),
     );
-    $form['col_class_default'] = array(
-      '#title' => t('Default column classes'),
-      '#description' => t('Add the default views column classes like views-col, col-1 and clearfix to the output. You can use this to quickly reduce the amount of markup the view provides by default, at the cost of making it more difficult to apply CSS.'),
-      '#type' => 'checkbox',
-      '#default_value' => $this->options['col_class_default'],
-    );
-    $form['col_class_custom'] = array(
-      '#title' => t('Custom column class'),
-      '#description' => t('Additional classes to provide on each column. Separated by a space.'),
-      '#type' => 'textfield',
-      '#default_value' => $this->options['col_class_custom'],
-    );
-    if ($this->usesFields()) {
-      $form['col_class_custom']['#description'] .= ' ' . t('You may use field tokens from as per the "Replacement patterns" used in "Rewrite the output of this field" for all fields.');
-    }
-    $form['row_class_default'] = array(
-      '#title' => t('Default row classes'),
-      '#description' => t('Adds the default views row classes like views-row, row-1 and clearfix to the output. You can use this to quickly reduce the amount of markup the view provides by default, at the cost of making it more difficult to apply CSS.'),
+
+    $form['fill_single_line'] = array(
       '#type' => 'checkbox',
-      '#default_value' => $this->options['row_class_default'],
+      '#title' => t('Fill up single line'),
+      '#description' => t('If you disable this option, a grid with only one row will have the same number of table cells (<TD>) as items. Disabling it can cause problems with your CSS.'),
+      '#default_value' => !empty($this->options['fill_single_line']),
     );
-    $form['row_class_custom'] = array(
-      '#title' => t('Custom row class'),
-      '#description' => t('Additional classes to provide on each row. Separated by a space.'),
+
+    $form['summary'] = array(
       '#type' => 'textfield',
-      '#default_value' => $this->options['row_class_custom'],
+      '#title' => t('Table summary'),
+      '#description' => t('This value will be displayed as table-summary attribute in the html. Set this for better accessiblity of your site.'),
+      '#default_value' => $this->options['summary'],
     );
-    if ($this->usesFields()) {
-      $form['row_class_custom']['#description'] .= ' ' . t('You may use field tokens from as per the "Replacement patterns" used in "Rewrite the output of this field" for all fields.');
-    }
   }
 
 }
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/style/Mapping.php b/core/modules/views/lib/Drupal/views/Plugin/views/style/Mapping.php
index 101d32f..3914fd8 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/style/Mapping.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/style/Mapping.php
@@ -131,7 +131,7 @@ public function buildOptionsForm(&$form, &$form_state) {
    *
    * Provides the mapping definition as an available variable.
    */
-  public function render() {
+  function render() {
     return array(
       '#theme' => $this->themeFunctions(),
       '#view' => $this->view,
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/style/Rss.php b/core/modules/views/lib/Drupal/views/Plugin/views/style/Rss.php
index 3bea5bb..1db0c6f 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/style/Rss.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/style/Rss.php
@@ -111,7 +111,7 @@ public function getDescription() {
     return $description;
   }
 
-  public function render() {
+  function render() {
     if (empty($this->view->rowPlugin)) {
       debug('Drupal\views\Plugin\views\style\Rss: Missing row plugin');
       return;
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/style/StylePluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/style/StylePluginBase.php
index 8165c87..e271d8e 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/style/StylePluginBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/style/StylePluginBase.php
@@ -425,7 +425,7 @@ protected function renderRowGroup(array $rows = array()) {
   /**
    * Render the display in this style.
    */
-  public function render() {
+  function render() {
     if ($this->usesRowPlugin() && empty($this->view->rowPlugin)) {
       debug('Drupal\views\Plugin\views\style\StylePluginBase: Missing row plugin');
       return;
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/wizard/WizardPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/wizard/WizardPluginBase.php
index a84eb92..cd56c28 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/wizard/WizardPluginBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/wizard/WizardPluginBase.php
@@ -763,28 +763,21 @@ protected function defaultDisplayOptions() {
     // choose the first field with a field handler.
     $data = Views::viewsData()->get($this->base_table);
     if (isset($data['table']['base']['defaults']['field'])) {
-      $default_field = $data['table']['base']['defaults']['field'];
+      $field = $data['table']['base']['defaults']['field'];
     }
     else {
-      foreach ($data as $default_field => $field_data) {
+      foreach ($data as $field => $field_data) {
         if (isset($field_data['field']['id'])) {
           break;
         }
       }
     }
-    $display_options['fields'][$default_field] = array(
+    $display_options['fields'][$field] = array(
       'table' => $this->base_table,
-      'field' => $default_field,
-      'id' => $default_field,
+      'field' => $field,
+      'id' => $field,
     );
 
-    // Load the plugin ID and module.
-    $base_field = $data['table']['base']['field'];
-    $display_options['fields'][$base_field]['plugin_id'] = $data[$base_field]['field']['id'];
-    if ($definition = Views::pluginManager('field')->getDefinition($display_options['fields'][$base_field]['plugin_id'])) {
-      $display_options['fields'][$base_field]['provider'] = isset($definition['provider']) ? $definition['provider'] : 'views';
-    }
-
     return $display_options;
   }
 
diff --git a/core/modules/views/lib/Drupal/views/Tests/BasicTest.php b/core/modules/views/lib/Drupal/views/Tests/BasicTest.php
index aef6a50..d66d304 100644
--- a/core/modules/views/lib/Drupal/views/Tests/BasicTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/BasicTest.php
@@ -38,7 +38,7 @@ public function testSimpleResultSet() {
     $this->executeView($view);
 
     // Verify the result.
-    $this->assertEqual(5, count($view->result), 'The number of returned rows match.');
+    $this->assertEqual(5, count($view->result), t('The number of returned rows match.'));
     $this->assertIdenticalResultset($view, $this->dataSet(), array(
       'views_test_data_name' => 'name',
       'views_test_data_age' => 'age',
@@ -97,7 +97,7 @@ public function testSimpleFiltering() {
     );
 
     // Verify the result.
-    $this->assertEqual(3, count($view->result), 'The number of returned rows match.');
+    $this->assertEqual(3, count($view->result), t('The number of returned rows match.'));
     $this->assertIdenticalResultSet($view, $dataset, array(
       'views_test_data_name' => 'name',
       'views_test_data_age' => 'age',
@@ -123,7 +123,7 @@ public function testSimpleArgument() {
     );
 
     // Verify the result.
-    $this->assertEqual(1, count($view->result), 'The number of returned rows match.');
+    $this->assertEqual(1, count($view->result), t('The number of returned rows match.'));
     $this->assertIdenticalResultSet($view, $dataset, array(
       'views_test_data_name' => 'name',
       'views_test_data_age' => 'age',
@@ -136,7 +136,7 @@ public function testSimpleArgument() {
     // Build the expected result.
     $dataset = $this->dataSet();
 
-    $this->assertEqual(5, count($view->result), 'The number of returned rows match.');
+    $this->assertEqual(5, count($view->result), t('The number of returned rows match.'));
     $this->assertIdenticalResultSet($view, $dataset, array(
       'views_test_data_name' => 'name',
       'views_test_data_age' => 'age',
diff --git a/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php b/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php
index 730b123..1fa8689 100644
--- a/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php
@@ -100,7 +100,7 @@ protected function setUp() {
       search_index($node->nid, 'node', $node->body[Language::LANGCODE_NOT_SPECIFIED][0]['value'], Language::LANGCODE_NOT_SPECIFIED);
 
       $comment = array(
-        'uid' => $user->id(),
+        'uid' => $user->uid,
         'nid' => $node->nid,
         'node_type' => 'node_type_' . $node->bundle(),
       );
diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/FilterBooleanOperatorTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/FilterBooleanOperatorTest.php
index 77841f3..d354f0f 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Handler/FilterBooleanOperatorTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Handler/FilterBooleanOperatorTest.php
@@ -98,84 +98,5 @@ public function testFilterBooleanOperator() {
     $this->assertIdenticalResultset($view, $expected_result, $this->column_map);
   }
 
-  /**
-   * Tests the boolean filter with grouped exposed form enabled.
-   */
-  public function testFilterGroupedExposed() {
-    $filters = $this->getGroupedExposedFilters();
-    $view = views_get_view('test_view');
-
-    $view->setExposedInput(array('status' => 1));
-    $view->setDisplay();
-    $view->displayHandlers->get('default')->overrideOption('filters', $filters);
-
-    $this->executeView($view);
-
-    $expected_result = array(
-      array('id' => 1),
-      array('id' => 3),
-      array('id' => 5),
-    );
-
-    $this->assertEqual(3, count($view->result));
-    $this->assertIdenticalResultset($view, $expected_result, $this->column_map);
-    $view->destroy();
-
-    $view->setExposedInput(array('status' => 2));
-    $view->setDisplay();
-    $view->displayHandlers->get('default')->overrideOption('filters', $filters);
-
-    $this->executeView($view);
-
-    $expected_result = array(
-      array('id' => 2),
-      array('id' => 4),
-    );
-
-    $this->assertEqual(2, count($view->result));
-    $this->assertIdenticalResultset($view, $expected_result, $this->column_map);
-  }
-
-  /**
-   * Provides grouped exposed filter configuration.
-   *
-   * @return array
-   */
-  protected function getGroupedExposedFilters() {
-    $filters = array(
-      'status' => array(
-        'id' => 'status',
-        'table' => 'views_test_data',
-        'field' => 'status',
-        'relationship' => 'none',
-        'exposed' => TRUE,
-        'expose' => array(
-          'operator' => 'status_op',
-          'label' => 'status',
-          'identifier' => 'status',
-        ),
-        'is_grouped' => TRUE,
-        'group_info' => array(
-          'label' => 'status',
-          'identifier' => 'status',
-          'default_group' => 'All',
-          'group_items' => array(
-            1 => array(
-              'title' => 'Active',
-              'operator' => '=',
-              'value' => '1',
-            ),
-            2 => array(
-              'title' => 'Blocked',
-              'operator' => '=',
-              'value' => '0',
-            ),
-          ),
-        ),
-      ),
-    );
-    return $filters;
-  }
-
 }
 
diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/SortDateTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/SortDateTest.php
index 813701e..d6d9462 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Handler/SortDateTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Handler/SortDateTest.php
@@ -7,7 +7,6 @@
 
 namespace Drupal\views\Tests\Handler;
 
-use Drupal\Component\Utility\String;
 use Drupal\views\Tests\ViewUnitTestBase;
 
 /**
@@ -200,10 +199,10 @@ public function testDateOrdering() {
         $this->executeView($view);
 
         // Verify the result.
-        $this->assertEqual(count($this->dataSet()), count($view->result), 'The number of returned rows match.');
+        $this->assertEqual(count($this->dataSet()), count($view->result), t('The number of returned rows match.'));
         $this->assertIdenticalResultset($view, $this->expectedResultSet($granularity, $reverse), array(
           'views_test_data_name' => 'name',
-        ), String::format('Result is returned correctly when ordering by granularity @granularity, @reverse.', array('@granularity' => $granularity, '@reverse' => $reverse ? 'reverse' : 'forward')));
+        ), t('Result is returned correctly when ordering by granularity @granularity, @reverse.', array('@granularity' => $granularity, '@reverse' => $reverse ? t('reverse') : t('forward'))));
         $view->destroy();
         unset($view);
       }
diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/SortRandomTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/SortRandomTest.php
index c7745b5..2fabc21 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Handler/SortRandomTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Handler/SortRandomTest.php
@@ -76,7 +76,7 @@ public function testRandomOrdering() {
     $this->executeView($view);
 
     // Verify the result.
-    $this->assertEqual(count($this->dataSet()), count($view->result), 'The number of returned rows match.');
+    $this->assertEqual(count($this->dataSet()), count($view->result), t('The number of returned rows match.'));
     $this->assertIdenticalResultset($view, $this->dataSet(), array(
       'views_test_data_name' => 'name',
       'views_test_data_age' => 'age',
@@ -85,7 +85,7 @@ public function testRandomOrdering() {
     // Execute a random view, we expect the result set to be different.
     $view_random = $this->getBasicRandomView();
     $this->executeView($view_random);
-    $this->assertEqual(count($this->dataSet()), count($view_random->result), 'The number of returned rows match.');
+    $this->assertEqual(count($this->dataSet()), count($view_random->result), t('The number of returned rows match.'));
     $this->assertNotIdenticalResultset($view_random, $view->result, array(
       'views_test_data_name' => 'views_test_data_name',
       'views_test_data_age' => 'views_test_data_name',
@@ -94,7 +94,7 @@ public function testRandomOrdering() {
     // Execute a second random view, we expect the result set to be different again.
     $view_random_2 = $this->getBasicRandomView();
     $this->executeView($view_random_2);
-    $this->assertEqual(count($this->dataSet()), count($view_random_2->result), 'The number of returned rows match.');
+    $this->assertEqual(count($this->dataSet()), count($view_random_2->result), t('The number of returned rows match.'));
     $this->assertNotIdenticalResultset($view_random, $view->result, array(
       'views_test_data_name' => 'views_test_data_name',
       'views_test_data_age' => 'views_test_data_name',
diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/SortTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/SortTest.php
index b7012ae..35c62db 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Handler/SortTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Handler/SortTest.php
@@ -51,7 +51,7 @@ public function testNumericOrdering() {
     $this->executeView($view);
 
     // Verify the result.
-    $this->assertEqual(count($this->dataSet()), count($view->result), 'The number of returned rows match.');
+    $this->assertEqual(count($this->dataSet()), count($view->result), t('The number of returned rows match.'));
     $this->assertIdenticalResultset($view, $this->orderResultSet($this->dataSet(), 'age'), array(
       'views_test_data_name' => 'name',
       'views_test_data_age' => 'age',
@@ -75,7 +75,7 @@ public function testNumericOrdering() {
     $this->executeView($view);
 
     // Verify the result.
-    $this->assertEqual(count($this->dataSet()), count($view->result), 'The number of returned rows match.');
+    $this->assertEqual(count($this->dataSet()), count($view->result), t('The number of returned rows match.'));
     $this->assertIdenticalResultset($view, $this->orderResultSet($this->dataSet(), 'age', TRUE), array(
       'views_test_data_name' => 'name',
       'views_test_data_age' => 'age',
@@ -104,7 +104,7 @@ public function testStringOrdering() {
     $this->executeView($view);
 
     // Verify the result.
-    $this->assertEqual(count($this->dataSet()), count($view->result), 'The number of returned rows match.');
+    $this->assertEqual(count($this->dataSet()), count($view->result), t('The number of returned rows match.'));
     $this->assertIdenticalResultset($view, $this->orderResultSet($this->dataSet(), 'name'), array(
       'views_test_data_name' => 'name',
       'views_test_data_age' => 'age',
@@ -128,7 +128,7 @@ public function testStringOrdering() {
     $this->executeView($view);
 
     // Verify the result.
-    $this->assertEqual(count($this->dataSet()), count($view->result), 'The number of returned rows match.');
+    $this->assertEqual(count($this->dataSet()), count($view->result), t('The number of returned rows match.'));
     $this->assertIdenticalResultset($view, $this->orderResultSet($this->dataSet(), 'name', TRUE), array(
       'views_test_data_name' => 'name',
       'views_test_data_age' => 'age',
diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/AccessTest.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/AccessTest.php
index fa80f07..d5c4375 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Plugin/AccessTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/AccessTest.php
@@ -59,7 +59,7 @@ function testAccessNone() {
     $view = views_get_view('test_access_none');
     $view->setDisplay();
 
-    $this->assertTrue($view->display_handler->access($this->admin_user), 'Admin-Account should be able to access the view everytime');
+    $this->assertTrue($view->display_handler->access($this->admin_user), t('Admin-Account should be able to access the view everytime'));
     $this->assertTrue($view->display_handler->access($this->web_user));
     $this->assertTrue($view->display_handler->access($this->normal_user));
   }
diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/CacheTest.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/CacheTest.php
index 4dc8a56..f1da997 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Plugin/CacheTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/CacheTest.php
@@ -56,7 +56,7 @@ function testTimeCaching() {
 
     $this->executeView($view);
     // Verify the result.
-    $this->assertEqual(5, count($view->result), 'The number of returned rows match.');
+    $this->assertEqual(5, count($view->result), t('The number of returned rows match.'));
 
     // Add another man to the beatles.
     $record = array(
@@ -79,7 +79,7 @@ function testTimeCaching() {
 
     $this->executeView($view);
     // Verify the result.
-    $this->assertEqual(5, count($view->result), 'The number of returned rows match.');
+    $this->assertEqual(5, count($view->result), t('The number of returned rows match.'));
   }
 
   /**
@@ -98,7 +98,7 @@ function testNoneCaching() {
 
     $this->executeView($view);
     // Verify the result.
-    $this->assertEqual(5, count($view->result), 'The number of returned rows match.');
+    $this->assertEqual(5, count($view->result), t('The number of returned rows match.'));
 
     // Add another man to the beatles.
     $record = array(
@@ -119,7 +119,7 @@ function testNoneCaching() {
 
     $this->executeView($view);
     // Verify the result.
-    $this->assertEqual(6, count($view->result), 'The number of returned rows match.');
+    $this->assertEqual(6, count($view->result), t('The number of returned rows match.'));
   }
 
   /**
diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/MiniPagerTest.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/MiniPagerTest.php
index d76bf85..b2accae 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Plugin/MiniPagerTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/MiniPagerTest.php
@@ -91,13 +91,6 @@ public function testMiniPagerRender() {
     $this->assertText('â€¹â€¹');
     $this->assertText($this->nodes[19]->label());
 
-    $this->drupalGet('test_mini_pager_all');
-    $this->assertNoText('â€¹â€¹ test', 'The previous link does not appear on the page.');
-    $this->assertText('Page 1', 'The current page info shows the only page.');
-    $this->assertNoText('test â€ºâ€º', 'The next link does not appear on the page.');
-    $result = $this->xpath('//div[contains(@class, "views-row")]');
-    $this->assertEqual(count($result), count($this->nodes), 'All rows appear on the page.');
-
     // Remove all items beside 1, so there should be no links shown.
     for ($i = 0; $i < 19; $i++) {
       $this->nodes[$i]->delete();
@@ -112,7 +105,7 @@ public function testMiniPagerRender() {
     $view = views_get_view('test_mini_pager');
     $this->executeView($view);
     $this->assertIdentical($view->get_total_rows, NULL, 'The query was not forced to calculate the total number of results.');
-    $this->assertIdentical($view->total_rows, 1, 'The pager calculated the total number of rows.');
+    $this->assertIdentical($view->total_rows, NULL, 'The query did not return the total number of rows.');
   }
 
 }
diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/PagerTest.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/PagerTest.php
index 75436c4..cbc8279 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Plugin/PagerTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/PagerTest.php
@@ -260,7 +260,7 @@ public function testRenderNullPager() {
     $view->pager = NULL;
     $output = $view->render();
     $output = drupal_render($output);
-    $this->assertEqual(preg_match('/<ul class="pager">/', $output), 0, 'The pager is not rendered.');
+    $this->assertEqual(preg_match('/<ul class="pager">/', $output), 0, t('The pager is not rendered.'));
   }
 
   /**
diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/StyleGridTest.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/StyleGridTest.php
deleted file mode 100644
index da2b95c..0000000
--- a/core/modules/views/lib/Drupal/views/Tests/Plugin/StyleGridTest.php
+++ /dev/null
@@ -1,107 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\views\Tests\Plugin\StyleGridTest.
- */
-
-namespace Drupal\views\Tests\Plugin;
-
-use Drupal\views\ViewExecutable;
-use Symfony\Component\HttpFoundation\Request;
-
-/**
- * Tests the grid style plugin.
- *
- * @see \Drupal\views\Plugin\views\style\Grid
- */
-class StyleGridTest extends PluginTestBase {
-
-  /**
-   * Views used by this test.
-   *
-   * @var array
-   */
-  public static $testViews = array('test_grid');
-
-  /**
-   * Keeps track of which alignments have been tested.
-   */
-  protected $alignmentsTested = array();
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function getInfo() {
-    return array(
-      'name' => 'Style: Grid',
-      'description' => 'Tests the grid style plugin.',
-      'group' => 'Views Plugins',
-    );
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  protected function setUp() {
-    parent::setUp();
-    $this->enableViewsTestModule();
-  }
-
-  /**
-   * Tests the grid style.
-   */
-  public function testGrid() {
-    $view = views_get_view('test_grid');
-    foreach (array('horizontal', 'vertical') as $alignment) {
-      $this->assertGrid($view, $alignment, 5);
-      $this->assertGrid($view, $alignment, 4);
-      $this->assertGrid($view, $alignment, 3);
-      $this->assertGrid($view, $alignment, 2);
-      $this->assertGrid($view, $alignment, 1);
-    }
-  }
-
-  /**
-   * Generates a grid and asserts that it is displaying correctly.
-   *
-   * @param \Drupal\views\ViewExecutable $view
-   *   The executable to prepare.
-   * @param string $alignment
-   *   The alignment of the grid to test.
-   * @param int $columns
-   *   The number of columns in the grid to test.
-   */
-  protected function assertGrid(ViewExecutable $view, $alignment, $columns) {
-    $view->setDisplay('default');
-    $view->initStyle();
-    $view->initHandlers();
-    $view->initQuery();
-    $view->style_plugin->options['alignment'] = $alignment;
-    $view->style_plugin->options['columns'] = $columns;
-    $this->executeView($view);
-    $output = $view->preview();
-    $output = drupal_render($output);
-    $this->drupalSetContent($output, 'internal://test-grid');
-    if (!in_array($alignment, $this->alignmentsTested)) {
-      $result = $this->xpath('//div[contains(@class, "views-view-grid") and contains(@class, :alignment) and contains(@class, :columns)]', array(':alignment' => $alignment, ':columns' => 'cols-' . $columns));
-      $this->assertTrue(count($result), ucfirst($alignment) . " grid markup detected.");
-      $this->alignmentsTested[] = $alignment;
-    }
-    $width = '0';
-    switch ($columns) {
-      case 5: $width = '20'; break;
-      case 4: $width = '25'; break;
-      case 3: $width = '33.3333'; break;
-      case 2: $width = '50'; break;
-      case 1: $width = '100'; break;
-    }
-    // Ensure last column exists.
-    $result = $this->xpath('//div[contains(@class, "views-col") and contains(@class, :columns) and starts-with(@style, :width)]', array(':columns' => 'col-' . $columns, ':width' => 'width: ' . $width));
-    $this->assertTrue(count($result), ucfirst($alignment) . " $columns column grid: last column exists and automatic width calculated correctly.");
-    // Ensure no extra columns were generated.
-    $result = $this->xpath('//div[contains(@class, "views-col") and contains(@class, :columns)]', array(':columns' => 'col-' . ($columns + 1)));
-    $this->assertFalse(count($result), ucfirst($alignment) . " $columns column grid: no extraneous columns exist.");
-  }
-
-}
diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/StyleTest.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/StyleTest.php
index d033a06..25a10f3 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Plugin/StyleTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/StyleTest.php
@@ -196,7 +196,7 @@ function _testGrouping($stripped = FALSE) {
     // The newer api passes the value of the grouping as well.
     $sets_new_rendered = $view->style_plugin->renderGrouping($view->result, $view->style_plugin->options['grouping'], TRUE);
 
-    $this->assertEqual($sets_new_rendered, $expected, 'The style plugins should proper group the results with grouping by the rendered output.');
+    $this->assertEqual($sets_new_rendered, $expected, t('The style plugins should proper group the results with grouping by the rendered output.'));
 
     // Don't test stripped case, because the actual value is not stripped.
     if (!$stripped) {
@@ -214,7 +214,7 @@ function _testGrouping($stripped = FALSE) {
       unset($expected['Job: Drummer']);
       unset($expected['Drummer']['rows']['Age: 28']);
 
-      $this->assertEqual($sets_new_value, $expected, 'The style plugins should proper group the results with grouping by the value.');
+      $this->assertEqual($sets_new_value, $expected, t('The style plugins should proper group the results with grouping by the value.'));
     }
   }
 
diff --git a/core/modules/views/lib/Drupal/views/Tests/ViewExecutableTest.php b/core/modules/views/lib/Drupal/views/Tests/ViewExecutableTest.php
index a712218..ee36370 100644
--- a/core/modules/views/lib/Drupal/views/Tests/ViewExecutableTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/ViewExecutableTest.php
@@ -17,8 +17,6 @@
 use Drupal\views\Plugin\views\style\Grid;
 use Drupal\views\Plugin\views\row\Fields;
 use Drupal\views\Plugin\views\query\Sql;
-use Drupal\views\Plugin\views\pager\PagerPluginBase;
-use Drupal\views\Plugin\views\query\QueryPluginBase;
 
 /**
  * Tests the ViewExecutable class.
@@ -143,29 +141,6 @@ public function testInitMethods() {
     $this->assertTrue($view->query instanceof Sql, 'Make sure a reference to the query is set');
     $this->assertEqual(spl_object_hash($view->query->view), $view_hash);
     $this->assertEqual(spl_object_hash($view->query->displayHandler), $display_hash);
-
-    $view->destroy();
-
-    // Test the plugin  get methods.
-    $display_plugin = $view->getDisplay();
-    $this->assertTrue($display_plugin instanceof DefaultDisplay, 'An instance of DefaultDisplay was returned.');
-    $this->assertTrue($view->display_handler instanceof DefaultDisplay, 'The display_handler property has been set.');
-    $this->assertIdentical($display_plugin, $view->getDisplay(), 'The same display plugin instance was returned.');
-
-    $style_plugin = $view->getStyle();
-    $this->assertTrue($style_plugin instanceof DefaultStyle, 'An instance of DefaultStyle was returned.');
-    $this->assertTrue($view->style_plugin instanceof DefaultStyle, 'The style_plugin property has been set.');
-    $this->assertIdentical($style_plugin, $view->getStyle(), 'The same style plugin instance was returned.');
-
-    $pager_plugin = $view->getPager();
-    $this->assertTrue($pager_plugin instanceof PagerPluginBase, 'An instance of PagerPluginBase was returned.');
-    $this->assertTrue($view->pager instanceof PagerPluginBase, 'The pager property has been set.');
-    $this->assertIdentical($pager_plugin, $view->getPager(), 'The same pager plugin instance was returned.');
-
-    $query_plugin = $view->getQuery();
-    $this->assertTrue($query_plugin instanceof QueryPluginBase, 'An instance of QueryPluginBase was returned.');
-    $this->assertTrue($view->query instanceof QueryPluginBase, 'The query property has been set.');
-    $this->assertIdentical($query_plugin, $view->getQuery(), 'The same query plugin instance was returned.');
   }
 
   /**
diff --git a/core/modules/views/lib/Drupal/views/Tests/ViewStorageTest.php b/core/modules/views/lib/Drupal/views/Tests/ViewStorageTest.php
index 1cfd62a..e11cc86 100644
--- a/core/modules/views/lib/Drupal/views/Tests/ViewStorageTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/ViewStorageTest.php
@@ -286,7 +286,6 @@ protected function displayMethodTests() {
       'table' => 'views_test_data',
       'field' => 'id',
       'plugin_id' => 'numeric',
-      'provider' => 'views',
     );
     $this->assertEqual($item1, $expected_item);
 
@@ -302,7 +301,6 @@ protected function displayMethodTests() {
       'table' => 'views_test_data',
       'field' => 'name',
       'plugin_id' => 'standard',
-      'provider' => 'views',
     ) + $options;
     $this->assertEqual($item2, $expected_item);
 
diff --git a/core/modules/views/lib/Drupal/views/Tests/Wizard/BasicTest.php b/core/modules/views/lib/Drupal/views/Tests/Wizard/BasicTest.php
index 122337b..b663298 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Wizard/BasicTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Wizard/BasicTest.php
@@ -135,7 +135,7 @@ function testViewsWizardAndListing() {
     $this->assertNoText($node2->label());
 
     // Make sure the listing page doesn't show disabled default views.
-    $this->assertNoText('tracker', 'Default tracker view does not show on the listing page.');
+    $this->assertNoText('tracker', t('Default tracker view does not show on the listing page.'));
   }
 
   /**
diff --git a/core/modules/views/lib/Drupal/views/Tests/Wizard/ItemsPerPageTest.php b/core/modules/views/lib/Drupal/views/Tests/Wizard/ItemsPerPageTest.php
index e6808c7..f51de22 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Wizard/ItemsPerPageTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Wizard/ItemsPerPageTest.php
@@ -72,7 +72,7 @@ function testItemsPerPage() {
     $pos4 = strpos($content, $node4->label());
     $pos3 = strpos($content, $node3->label());
     $pos2 = strpos($content, $node2->label());
-    $this->assertTrue($pos5 < $pos4 && $pos4 < $pos3 && $pos3 < $pos2, 'The nodes appear in the expected order in the page display.');
+    $this->assertTrue($pos5 < $pos4 && $pos4 < $pos3 && $pos3 < $pos2, t('The nodes appear in the expected order in the page display.'));
 
     // Confirm that the block is listed in the block administration UI.
     $this->drupalGet('admin/structure/block/list/block_plugin_ui:' . config('system.theme')->get('default') . '/add');
@@ -93,7 +93,7 @@ function testItemsPerPage() {
     $pos5 = strpos($content, $node5->label());
     $pos4 = strpos($content, $node4->label());
     $pos3 = strpos($content, $node3->label());
-    $this->assertTrue($pos5 < $pos4 && $pos4 < $pos3, 'The nodes appear in the expected order in the block display.');
+    $this->assertTrue($pos5 < $pos4 && $pos4 < $pos3, t('The nodes appear in the expected order in the block display.'));
   }
 
 }
diff --git a/core/modules/views/lib/Drupal/views/Tests/Wizard/SortingTest.php b/core/modules/views/lib/Drupal/views/Tests/Wizard/SortingTest.php
index 20839b5..f7c9712 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Wizard/SortingTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Wizard/SortingTest.php
@@ -53,7 +53,7 @@ function testSorting() {
     $pos1 = strpos($content, $node1->label());
     $pos2 = strpos($content, $node2->label());
     $pos3 = strpos($content, $node3->label());
-    $this->assertTrue($pos1 < $pos2 && $pos2 < $pos3, 'The nodes appear in the expected order in a view that sorts by oldest first.');
+    $this->assertTrue($pos1 < $pos2 && $pos2 < $pos3, t('The nodes appear in the expected order in a view that sorts by oldest first.'));
 
     // Create a view that sorts newest first.
     $view2 = array();
@@ -78,7 +78,7 @@ function testSorting() {
     $pos3 = strpos($content, $node3->label());
     $pos2 = strpos($content, $node2->label());
     $pos1 = strpos($content, $node1->label());
-    $this->assertTrue($pos3 < $pos2 && $pos2 < $pos1, 'The nodes appear in the expected order in a view that sorts by newest first.');
+    $this->assertTrue($pos3 < $pos2 && $pos2 < $pos1, t('The nodes appear in the expected order in a view that sorts by newest first.'));
   }
 
 }
diff --git a/core/modules/views/lib/Drupal/views/ViewAccessController.php b/core/modules/views/lib/Drupal/views/ViewAccessController.php
index 80ad8a9..a4aaae6 100644
--- a/core/modules/views/lib/Drupal/views/ViewAccessController.php
+++ b/core/modules/views/lib/Drupal/views/ViewAccessController.php
@@ -24,11 +24,4 @@ public function access(EntityInterface $entity, $operation, $langcode = Language
     return $operation == 'view' || user_access('administer views', $account);
   }
 
-  /**
-   * {@inheritdoc}
-   */
-  protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) {
-    return user_access('administer views', $account);
-  }
-
 }
diff --git a/core/modules/views/lib/Drupal/views/ViewExecutable.php b/core/modules/views/lib/Drupal/views/ViewExecutable.php
index 80ddc1c..84af7bb 100644
--- a/core/modules/views/lib/Drupal/views/ViewExecutable.php
+++ b/core/modules/views/lib/Drupal/views/ViewExecutable.php
@@ -8,10 +8,9 @@
 namespace Drupal\views;
 
 use Drupal;
-use Drupal\views\Plugin\views\query\QueryPluginBase;
+use Symfony\Component\HttpFoundation\Response;
 use Drupal\views\ViewStorageInterface;
 use Drupal\Component\Utility\Tags;
-use Symfony\Component\HttpFoundation\Response;
 
 /**
  * @defgroup views_objects Objects that represent a View or part of a view
@@ -637,19 +636,6 @@ public function chooseDisplay($displays) {
   }
 
   /**
-   * Gets the current display plugin.
-   *
-   * @return \Drupal\views\Plugin\views\display\DisplayPluginBase
-   */
-  public function getDisplay() {
-    if (!isset($this->display_handler)) {
-      $this->initDisplay();
-    }
-
-    return $this->display_handler;
-  }
-
-  /**
    * Sets the current display.
    *
    * @param string $display_id
@@ -702,19 +688,6 @@ public function setDisplay($display_id = NULL) {
   }
 
   /**
-   * Gets the current style plugin.
-   *
-   * @return \Drupal\views\Plugin\views\style\StylePluginBase
-   */
-  public function getStyle() {
-    if (!isset($this->style_plugin)) {
-      $this->initStyle();
-    }
-
-    return $this->style_plugin;
-  }
-
-  /**
    * Find and initialize the style plugin.
    *
    * Note that arguments may have changed which style plugin we use, so
@@ -748,19 +721,6 @@ public function initHandlers() {
   }
 
   /**
-   * Get the current pager plugin.
-   *
-   * @return \Drupal\views\Plugin\views\pager\PagerPluginBase
-   */
-  public function getPager() {
-    if (!isset($this->pager)) {
-      $this->initPager();
-    }
-
-    return $this->pager;
-  }
-
-  /**
    * Initialize the pager
    *
    * Like style initialization, pager initialization is held until late
@@ -975,19 +935,6 @@ protected function _buildArguments() {
   }
 
   /**
-   * Gets the current query plugin.
-   *
-   * @return \Drupal\views\Plugin\views\query\QueryPluginBase
-   */
-  public function getQuery() {
-    if (!isset($this->query)) {
-      $this->initQuery();
-    }
-
-    return $this->query;
-  }
-
-  /**
    * Do some common building initialization.
    */
   public function initQuery() {
@@ -1961,9 +1908,6 @@ public function addItem($display_id, $type, $table, $field, $options = array(),
     $data = Views::viewsData()->get($table);
     if (isset($data[$field][$handler_type]['id'])) {
       $fields[$id]['plugin_id'] = $data[$field][$handler_type]['id'];
-      if ($definition = Views::pluginManager($handler_type)->getDefinition($fields[$id]['plugin_id'])) {
-        $fields[$id]['provider'] = isset($definition['provider']) ? $definition['provider'] : 'views';
-      }
     }
 
     $this->displayHandlers->get($display_id)->setOption($types[$type]['plural'], $fields);
diff --git a/core/modules/views/lib/Drupal/views/Views.php b/core/modules/views/lib/Drupal/views/Views.php
index e7127c7..80cf166 100644
--- a/core/modules/views/lib/Drupal/views/Views.php
+++ b/core/modules/views/lib/Drupal/views/Views.php
@@ -75,20 +75,4 @@ public static function handlerManager($type) {
     return Drupal::service('plugin.manager.views.' . $type);
   }
 
-  /**
-   * Loads a view from configuration and returns its executable object.
-   *
-   * @param string $id
-   *   The view ID to load.
-   *
-   * @return \Drupal\views\ViewExecutable
-   *   A view executable instance, from the loaded entity.
-   */
-  public static function getView($id) {
-    $view = Drupal::service('plugin.manager.entity')->getStorageController('view')->load($id);
-    if ($view) {
-      return static::executableFactory()->get($view);
-    }
-  }
-
 }
diff --git a/core/modules/views/lib/Drupal/views/ViewsAccessCheck.php b/core/modules/views/lib/Drupal/views/ViewsAccessCheck.php
index 8d6c962..b5242bf 100644
--- a/core/modules/views/lib/Drupal/views/ViewsAccessCheck.php
+++ b/core/modules/views/lib/Drupal/views/ViewsAccessCheck.php
@@ -7,7 +7,7 @@
 
 namespace Drupal\views;
 
-use Drupal\Core\Access\StaticAccessCheckInterface;
+use Drupal\Core\Access\AccessCheckInterface;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\Routing\Route;
 
@@ -16,13 +16,13 @@
  *
  * @todo We could leverage the permission one as well?
  */
-class ViewsAccessCheck implements StaticAccessCheckInterface {
+class ViewsAccessCheck implements AccessCheckInterface {
 
   /**
-   * {@inheritdoc}
+   * Implements AccessCheckInterface::applies().
    */
-  public function appliesTo() {
-    return array('views_id');
+  public function applies(Route $route) {
+    return array_key_exists('view_id', $route->getDefaults());
   }
 
   /**
diff --git a/core/modules/views/templates/views-exposed-form.html.twig b/core/modules/views/templates/views-exposed-form.html.twig
index 5a34f2f..d4986e6 100644
--- a/core/modules/views/templates/views-exposed-form.html.twig
+++ b/core/modules/views/templates/views-exposed-form.html.twig
@@ -4,7 +4,21 @@
  * Default theme implementation of a views exposed form.
  *
  * Available variables:
+ * - widgets: A list of exposed form widgets. Each widget contains:
+ *   - label: The sanitized label of the widget.
+ *   - id: The ID of the widget, if available.
+ *   - operator: The select element for the operator widget.
+ *   - description: The sanitized description of the widget.
+ *   - widget: The widget itself.
+ *   - index: the widget's row index.
  * - form: A render element representing the form.
+ *   - sort_by: An optional select element to sort the view by fields.
+ *   - sort_order: An optional select element with ascending or
+ *     descending order options.
+ *   - items_per_page: An optional select element for the available items per
+ *     page.
+ *   - offset: An optional textfield to define the offset of the view.
+ *   - reset_button: An optional button to reset the exposed filter applied.
  *
  * @see template_preprocess_views_exposed_form()
  *
@@ -18,6 +32,55 @@
   #}
 {{ q }}
 {% endif %}
-<div class="views-exposed-form clearfix">
-  {{ form }}
+<div class="views-exposed-form">
+  <div class="views-exposed-widgets clearfix">
+    {% for index, widget in widgets %}
+      <div id="{{ widget.id }}-wrapper" class="views-exposed-widget views-widget-{{ index }}">
+          {% if widget.label %}
+          <label for="{{ widget.id }}">
+            {{ widget.label }}
+          </label>
+        {% endif %}
+        {% if widget.operator %}
+          <div class="views-operator">
+            {{ widget.operator }}
+          </div>
+        {% endif %}
+        <div class="views-widget">
+          {{ widget.widget }}
+        </div>
+        {% if widget.description %}
+          <div class="description">
+            {{ widget.description }}
+          </div>
+        {% endif %}
+      </div>
+    {% endfor %}
+    {% if form.sort_by %}
+      <div class="views-exposed-widget views-widget-sort-by">
+        {{ form.sort_by }}
+      </div>
+      <div class="views-exposed-widget views-widget-sort-order">
+        {{ form.sort_order }}
+      </div>
+    {% endif %}
+    {% if form.items_per_page %}
+      <div class="views-exposed-widget views-widget-per-page">
+        {{ form.items_per_page }}
+      </div>
+    {% endif %}
+    {% if form.offset %}
+      <div class="views-exposed-widget views-widget-offset">
+        {{ form.offset }}
+      </div>
+    {% endif %}
+    <div class="views-exposed-widget views-submit-button">
+      {{ form }}
+    </div>
+    {% if form.reset_button %}
+      <div class="views-exposed-widget views-reset-button">
+        {{ form.reset_button }}
+      </div>
+    {% endif %}
+  </div>
 </div>
diff --git a/core/modules/views/templates/views-view-grid.html.twig b/core/modules/views/templates/views-view-grid.html.twig
index a5a813c..8b63792 100644
--- a/core/modules/views/templates/views-view-grid.html.twig
+++ b/core/modules/views/templates/views-view-grid.html.twig
@@ -4,18 +4,13 @@
  * Default theme implementation for views to display rows in a grid.
  *
  * Available variables:
- * - attributes: HTML attributes for the wrapping element.
+ * - attributes: HTML attributes for the table element.
  * - title: The title of this group of rows.
- * - view: The view object.
- * - rows: The rendered view results.
- * - options: The view plugin style options.
- * - items: A list of grid items. Each item contains a list of rows or columns.
- *   The order in what comes first (row or column) depends on which alignment
- *   type is chosen (horizontal or vertical).
- *   - attributes: HTML attributes for each row or column.
- *   - content: A list of columns or rows. Each row or column contains:
- *     - attributes: HTML attributes for each row or column.
- *     - content: The row or column contents.
+ * - rows: A list of rows. Each row contains a list of columns.
+ * - row_classes: HTML classes for each row including the row number and first
+ *   or last.
+ * - column_classes: HTML classes for each column including the row number and
+ *   first or last.
  *
  * @see template_preprocess_views_view_grid()
  *
@@ -25,26 +20,16 @@
 {% if title %}
   <h3>{{ title }}</h3>
 {% endif %}
-<div{{ attributes }}>
-{% if options.alignment == 'horizontal' %}
-  {% for row in items %}
-  <div{{ row.attributes }}>
-    {% for column in row.content %}
-    <div{{ column.attributes }}>
-      {{ column.content }}
-    </div>
+<table{{ attributes }}>
+  <tbody>
+    {% for row_number, columns in rows %}
+      <tr{{ row_classes[row_number] }}>
+        {% for column_number, item in columns %}
+          <td{{ column_classes[row_number][column_number] }}>
+            {{ item }}
+          </td>
+        {% endfor %}
+      </tr>
     {% endfor %}
-  </div>
-  {% endfor %}
-{% else %}
-  {% for column in items %}
-  <div{{ column.attributes }}>
-    {% for row in column.content %}
-      <div{{ row.attributes }}>
-        {{ row.content }}
-      </div>
-    {% endfor %}
-    </div>
-  {% endfor %}
-{% endif %}
-</div>
+  </tbody>
+</table>
diff --git a/core/modules/views/tests/Drupal/views/Tests/ViewsTest.php b/core/modules/views/tests/Drupal/views/Tests/ViewsTest.php
deleted file mode 100644
index 91c2226..0000000
--- a/core/modules/views/tests/Drupal/views/Tests/ViewsTest.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\views\Tests\ViewsTest.
- */
-
-namespace Drupal\views\Tests;
-
-use Drupal\Tests\UnitTestCase;
-use Drupal\views\Views;
-use Drupal\views\Plugin\Core\Entity\View;
-use Drupal\views\ViewExecutableFactory;
-use Drupal;
-use Drupal\Core\DependencyInjection\ContainerBuilder;
-
-class ViewsTest extends UnitTestCase {
-
-  public static function getInfo() {
-    return array(
-      'name' => 'Views test',
-      'description' => 'Tests the Drupal\views\Views class.',
-      'group' => 'Views',
-    );
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  protected function setUp() {
-    parent::setUp();
-
-    $container = new ContainerBuilder();
-    $container->set('views.executable', new ViewExecutableFactory());
-
-    $this->view = new View(array('id' => 'test_view'), 'view');
-
-    $view_storage_controller = $this->getMockBuilder('Drupal\views\ViewStorageController')
-      ->disableOriginalConstructor()
-      ->getMock();
-    $view_storage_controller->expects($this->once())
-      ->method('load')
-      ->with('test_view')
-      ->will($this->returnValue($this->view));
-
-    $entity_manager = $this->getMockBuilder('Drupal\Core\Entity\EntityManager')
-      ->disableOriginalConstructor()
-      ->getMock();
-    $entity_manager->expects($this->once())
-      ->method('getStorageController')
-      ->with('view')
-      ->will($this->returnValue($view_storage_controller));
-    $container->set('plugin.manager.entity', $entity_manager);
-
-    Drupal::setContainer($container);
-  }
-
-  /**
-   * Tests the getView() method.
-   */
-  public function testGetView() {
-    $executable = Views::getView('test_view');
-    $this->assertInstanceOf('Drupal\views\ViewExecutable', $executable);
-    $this->assertEquals($this->view->id(), $executable->storage->id());
-    $this->assertEquals(spl_object_hash($this->view), spl_object_hash($executable->storage));
-  }
-
-}
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_aggregate_count.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_aggregate_count.yml
index 5f7c897..686a550 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_aggregate_count.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_aggregate_count.yml
@@ -17,7 +17,6 @@ display:
             format: default_summary
           table: entity_test
           plugin_id: string
-          provider: views
       cache:
         type: none
       exposed_form:
@@ -39,7 +38,6 @@ display:
           link_to_node: '0'
           table: entity_test
           plugin_id: numeric
-          provider: views
       group_by: '1'
       pager:
         type: some
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_alias.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_alias.yml
index 4baf989..7b31454 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_alias.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_alias.yml
@@ -32,7 +32,6 @@ display:
           overwrite_anonymous: '0'
           table: users
           plugin_id: user_name
-          provider: user
       filters:
         uid_raw:
           admin_label: ''
@@ -73,7 +72,6 @@ display:
             min: ''
             value: '1'
           plugin_id: numeric
-          provider: views
       pager:
         type: full
       query:
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_area_title.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_area_title.yml
index 6da4540..de78efe 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_area_title.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_area_title.yml
@@ -17,7 +17,6 @@ display:
           relationship: none
           table: views_test_data
           plugin_id: numeric
-          provider: views_test_data
       pager:
         options:
           offset: '0'
@@ -31,7 +30,6 @@ display:
           relationship: none
           table: views_test_data
           plugin_id: numeric
-          provider: views_test_data
       empty:
         title:
           field: title
@@ -39,7 +37,6 @@ display:
           table: views
           plugin_id: title
           title: test_title_empty
-          provider: views
     display_plugin: default
     display_title: Master
     id: default
@@ -56,9 +53,8 @@ display:
           table: views
           plugin_id: title
           title: test_title_header
-          provider: views
     display_plugin: page
-    display_title: 'Page 1'
+    display_title: Page 1
     id: page_1
     position: '1'
 label: ''
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_argument_date.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_argument_date.yml
index 726961e..5298384 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_argument_date.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_argument_date.yml
@@ -16,7 +16,6 @@ display:
           id: date_fulldate
           table: views_test_data
           plugin_id: date_fulldate
-          provider: views_test_data
       fields:
         id:
           field: id
@@ -24,7 +23,6 @@ display:
           relationship: none
           table: views_test_data
           plugin_id: numeric
-          provider: views_test_data
       pager:
         options:
           offset: '0'
@@ -38,7 +36,6 @@ display:
           relationship: none
           table: views_test_data
           plugin_id: numeric
-          provider: views_test_data
     display_plugin: default
     display_title: Master
     id: default
@@ -53,7 +50,6 @@ display:
           id: date_day
           table: views_test_data
           plugin_id: date_day
-          provider: views_test_data
     display_plugin: embed
     id: embed_1
   embed_2:
@@ -66,7 +62,6 @@ display:
           id: date_month
           table: views_test_data
           plugin_id: date_month
-          provider: views_test_data
     display_plugin: embed
     id: embed_2
   embed_3:
@@ -79,7 +74,6 @@ display:
           id: date_week
           table: views_test_data
           plugin_id: date_week
-          provider: views_test_data
     display_plugin: embed
     id: embed_3
   embed_4:
@@ -92,7 +86,6 @@ display:
           id: date_year
           table: views_test_data
           plugin_id: date_year
-          provider: views_test_data
     display_plugin: embed
     id: embed_4
   embed_5:
@@ -105,7 +98,6 @@ display:
           id: date_year_month
           table: views_test_data
           plugin_id: date_year_month
-          provider: views_test_data
     display_plugin: embed
     id: embed_5
 label: ''
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_argument_default_current_user.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_argument_default_current_user.yml
index 96b1974..1b8dff5 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_argument_default_current_user.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_argument_default_current_user.yml
@@ -14,7 +14,6 @@ display:
           id: uid
           table: node_field_data
           plugin_id: numeric
-          provider: views
       cache:
         type: none
       exposed_form:
@@ -36,7 +35,6 @@ display:
           link_to_node: '0'
           table: node_field_data
           plugin_id: node
-          provider: node
       pager:
         options:
           id: '0'
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_argument_default_fixed.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_argument_default_fixed.yml
index d71ac66..f8a2500 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_argument_default_fixed.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_argument_default_fixed.yml
@@ -17,7 +17,6 @@ display:
           style_plugin: default_summary
           table: views
           plugin_id: 'null'
-          provider: views
       cache:
         type: none
       exposed_form:
@@ -39,7 +38,6 @@ display:
           link_to_node: '0'
           table: node_field_data
           plugin_id: node
-          provider: node
       pager:
         options:
           id: '0'
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_attachment_ui.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_attachment_ui.yml
index 11ddd6c..61e4a7c 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_attachment_ui.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_attachment_ui.yml
@@ -25,7 +25,6 @@ display:
           table: views_test_data
           field: id
           plugin_id: numeric
-          provider: views_test_data
     display_plugin: default
     display_title: Master
     id: default
@@ -46,7 +45,7 @@ display:
     display_plugin: feed
     id: feed_1
     display_title: Feed
-    position: '3'
+    position: ''
     display_options:
       pager:
         type: some
@@ -64,5 +63,6 @@ display:
             guid_field: id
             guid_field_is_permalink: '0'
       path: test_attachment_ui_feed
+    position: '3'
 id: test_attachment_ui
 tag: ''
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_cache.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_cache.yml
index 7d10bc4..58fbd6e 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_cache.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_cache.yml
@@ -15,19 +15,16 @@ display:
           table: views_test_data
           field: id
           relationship: none
-          provider: views_test_data
         name:
           id: name
           table: views_test_data
           field: name
           relationship: none
-          provider: views_test_data
         age:
           id: age
           table: views_test_data
           field: age
           relationship: none
-          provider: views_test_data
       defaults:
         fields: '0'
         sorts: '0'
@@ -38,7 +35,6 @@ display:
           table: views_test_data
           field: id
           relationship: none
-          provider: views_test_data
 label: ''
 id: test_cache
 tag: ''
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_click_sort.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_click_sort.yml
index 2dfc632..f387260 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_click_sort.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_click_sort.yml
@@ -11,19 +11,16 @@ display:
           table: views_test_data
           field: id
           plugin_id: numeric
-          provider: views_test_data
         name:
           id: name
           table: views_test_data
           field: name
           plugin_id: string
-          provider: views_test_data
         created:
           id: created
           table: views_test_data
           field: created
           plugin_id: date
-          provider: views_test_data
       display_options:
         access:
           type: none
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_destroy.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_destroy.yml
index a8fec7a..772d5f1 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_destroy.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_destroy.yml
@@ -37,7 +37,6 @@ display:
           style_plugin: default_summary
           table: node_field_data
           plugin_id: date_day
-          provider: views
         created_fulldate:
           default_argument_type: fixed
           field: created_fulldate
@@ -45,7 +44,6 @@ display:
           style_plugin: default_summary
           table: node_field_data
           plugin_id: date_fulldate
-          provider: views
         created_month:
           default_argument_type: fixed
           field: created_month
@@ -53,7 +51,6 @@ display:
           style_plugin: default_summary
           table: node_field_data
           plugin_id: date_month
-          provider: views
       cache:
         type: none
       empty:
@@ -63,14 +60,12 @@ display:
           id: area
           table: views
           plugin_id: text
-          provider: views
         area_1:
           empty: '0'
           field: area
           id: area_1
           table: views
           plugin_id: text
-          provider: views
       exposed_form:
         type: basic
       fields:
@@ -79,38 +74,32 @@ display:
           id: created
           table: node_field_data
           plugin_id: date
-          provider: views
         nid:
           field: nid
           id: nid
           table: node
           plugin_id: node
-          provider: node
         path:
           field: path
           id: path
           table: node
           plugin_id: node_path
-          provider: node
       filters:
         nid:
           field: nid
           id: nid
           table: node
           plugin_id: numeric
-          provider: views
         status:
           field: status
           id: status
           table: node_field_data
           plugin_id: boolean
-          provider: views
         title:
           field: title
           id: title
           table: node_field_data
           plugin_id: string
-          provider: views
       footer:
         area:
           empty: '0'
@@ -118,14 +107,12 @@ display:
           id: area
           table: views
           plugin_id: text
-          provider: views
         area_1:
           empty: '0'
           field: area
           id: area_1
           table: views
           plugin_id: text
-          provider: views
       header:
         area:
           empty: '0'
@@ -133,14 +120,12 @@ display:
           id: area
           table: views
           plugin_id: text
-          provider: views
         area_1:
           empty: '0'
           field: area
           id: area_1
           table: views
           plugin_id: text
-          provider: views
       pager:
         type: full
       query:
@@ -151,34 +136,29 @@ display:
           id: cid
           table: node
           plugin_id: standard
-          provider: views
         pid:
           field: pid
           id: pid
           table: comment
           relationship: cid
           plugin_id: standard
-          provider: views
         uid:
           field: uid
           id: uid
           table: comment
           relationship: cid
           plugin_id: standard
-          provider: views
       sorts:
         last_comment_name:
           field: last_comment_name
           id: last_comment_name
           table: node_comment_statistics
           plugin_id: comment_ncs_last_comment_name
-          provider: comment
         last_comment_timestamp:
           field: last_comment_timestamp
           id: last_comment_timestamp
           table: node_comment_statistics
           plugin_id: date
-          provider: views
       style:
         type: default
       row:
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display.yml
index a223987..d5fff8a 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display.yml
@@ -46,7 +46,6 @@ display:
           id: title
           table: node_field_data
           plugin_id: node
-          provider: node
       filters:
         status:
           field: status
@@ -55,7 +54,6 @@ display:
           table: node_field_data
           value: '1'
           plugin_id: boolean
-          provider: views
       pager:
         options:
           items_per_page: '10'
@@ -74,7 +72,6 @@ display:
           order: DESC
           table: node_field_data
           plugin_id: date
-          provider: views
       style_plugin: default
       title: 'Test Display'
     display_plugin: default
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display_attachment.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display_attachment.yml
index 7026ac1..15e113d 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display_attachment.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display_attachment.yml
@@ -44,7 +44,6 @@ display:
           hide_empty: '0'
           empty_zero: '0'
           link_to_node: '1'
-          provider: views_test_data
       title: test_display_attachment
   page_1:
     display_plugin: page
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display_defaults.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display_defaults.yml
index 11b33fa..e2f5288 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display_defaults.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display_defaults.yml
@@ -36,14 +36,12 @@ display:
           id: name
           table: views_test_data
           field: name
-          provider: views_test_data
       sorts:
         created:
           id: created
           table: views_test_data
           field: created
           order: DESC
-          provider: views_test_data
 label: ''
 module: views
 id: test_display_defaults
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display_invalid.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display_invalid.yml
index db6ed33..5c0c76d 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display_invalid.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display_invalid.yml
@@ -1,3 +1,4 @@
+api_version: '3.0'
 base_table: node
 core: '8'
 description: ''
@@ -13,7 +14,6 @@ display:
           table: node
           field: nid
           plugin_id: numeric
-          provider: node
     display_plugin: default
     display_title: Master
     id: default
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display_more.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display_more.yml
index 82d616d..479d7a4 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display_more.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display_more.yml
@@ -17,7 +17,6 @@ display:
           relationship: none
           table: views_test_data
           plugin_id: numeric
-          provider: views_test_data
       pager:
         options:
           offset: '0'
@@ -31,7 +30,6 @@ display:
           relationship: none
           table: views_test_data
           plugin_id: numeric
-          provider: views_test_data
       use_more: '1'
       use_more_always: '1'
       use_more_text: 'custom more text'
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_dropbutton.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_dropbutton.yml
index 98d0d72..536a3be 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_dropbutton.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_dropbutton.yml
@@ -77,7 +77,6 @@ display:
           empty_zero: '0'
           hide_alter_empty: '1'
           link_to_node: '0'
-          provider: node
         title:
           id: title
           table: node_field_data
@@ -96,7 +95,6 @@ display:
           hide_empty: '0'
           empty_zero: '0'
           link_to_node: '1'
-          provider: node
         nothing:
           id: nothing
           table: views
@@ -146,7 +144,6 @@ display:
           hide_empty: '0'
           empty_zero: '0'
           hide_alter_empty: '0'
-          provider: views
         dropbutton:
           id: dropbutton
           table: views
@@ -201,7 +198,6 @@ display:
             nothing: nothing
             nid: '0'
           destination: '1'
-          provider: views
       filters:
         status:
           value: '1'
@@ -212,7 +208,6 @@ display:
           expose:
             operator: '0'
           group: '1'
-          provider: views
       sorts:
         created:
           id: created
@@ -220,7 +215,6 @@ display:
           field: created
           order: DESC
           plugin_id: date
-          provider: views
       title: test_dropbutton
   page_1:
     display_plugin: page
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_entity_area.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_entity_area.yml
index bb30663..4828f60 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_entity_area.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_entity_area.yml
@@ -18,16 +18,14 @@ display:
           entity_id: 1
           view_mode: full
           plugin_id: entity
-          provider: views
       footer:
         entity_entity_test_render:
           field: entity_entity_test_render
           id: entity_entity_test_render
           table: views
-          entity_id: '!1'
+          entity_id: !1
           view_mode: full
           plugin_id: entity
-          provider: views
       fields:
         id:
           field: id
@@ -35,14 +33,12 @@ display:
           relationship: none
           table: views_test_data
           plugin_id: numeric
-          provider: views_test_data
       arguments:
         id:
           id: id
           table: views_test_data
           field: id
           plugin_id: numeric
-          provider: views_test_data
       pager:
         options:
           offset: '0'
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_entity_type_filter.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_entity_type_filter.yml
index 9babc1c..e624204 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_entity_type_filter.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_entity_type_filter.yml
@@ -15,7 +15,6 @@ display:
           table: node
           field: nid
           relationship: none
-          provider: node
         type:
           id: type
           table: node_field_data
@@ -64,7 +63,6 @@ display:
           hide_empty: '0'
           empty_zero: '0'
           hide_alter_empty: '1'
-          provider: node
       defaults:
         fields: '0'
         filters: '0'
@@ -78,7 +76,6 @@ display:
             all: all
             test_bundle: test_bundle
             test_bundle_2: test_bundle_2
-          provider: views
 label: ''
 id: test_entity_type_filter
 tag: ''
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_example_area.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_example_area.yml
index 2b94cc1..bad397b 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_example_area.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_example_area.yml
@@ -15,21 +15,18 @@ display:
           id: test_example
           table: views
           plugin_id: test_example
-          provider: views_test_data
       footer:
         test_example:
           field: test_example
           id: test_example
           table: views
           plugin_id: test_example
-          provider: views_test_data
       empty:
         test_example:
           field: test_example
           id: test_example
           table: views
           plugin_id: test_example
-          provider: views_test_data
     display_plugin: default
     display_title: Master
     id: default
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_exposed_admin_ui.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_exposed_admin_ui.yml
index 910d770..51591b2 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_exposed_admin_ui.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_exposed_admin_ui.yml
@@ -23,7 +23,6 @@ display:
           id: type
           table: node_field_data
           plugin_id: node_type
-          provider: views
         body_value:
           id: body_value
           table: field_data_body
@@ -64,7 +63,6 @@ display:
                 operator: empty
                 value: ''
           plugin_id: string
-          provider: views
       pager:
         type: full
       sorts:
@@ -73,7 +71,6 @@ display:
           id: created
           table: node_field_data
           plugin_id: date
-          provider: views
       style:
         type: default
       row:
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_feed_display.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_feed_display.yml
index 1c82fa3..e4ac83b 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_feed_display.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_feed_display.yml
@@ -30,7 +30,6 @@ display:
           link_to_node: '1'
           table: node_field_data
           plugin_id: node
-          provider: node
       filters:
         status:
           expose:
@@ -41,7 +40,6 @@ display:
           table: node_field_data
           value: '1'
           plugin_id: boolean
-          provider: views
       pager:
         options:
           items_per_page: '10'
@@ -61,7 +59,6 @@ display:
           order: DESC
           table: node_field_data
           plugin_id: date
-          provider: views
       style:
         type: default
       title: test_feed_display
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_field_classes.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_field_classes.yml
index 4f0a5e2..b917482 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_field_classes.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_field_classes.yml
@@ -15,7 +15,6 @@ display:
           table: views_test_data
           field: id
           plugin_id: numeric
-          provider: views_test_data
       style:
         type: html_list
     display_plugin: default
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_field_get_entity.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_field_get_entity.yml
index 50c033c..0600e95 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_field_get_entity.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_field_get_entity.yml
@@ -17,21 +17,18 @@ display:
           id: cid
           table: comment
           plugin_id: comment
-          provider: comment
         nid:
           field: nid
           id: nid
           table: node
           relationship: nid
           plugin_id: node
-          provider: node
         uid:
           field: uid
           id: uid
           table: users
           relationship: uid
           plugin_id: user
-          provider: user
       filter_groups:
         groups: {  }
         operator: AND
@@ -47,7 +44,6 @@ display:
           required: '1'
           table: comment
           plugin_id: standard
-          provider: views
         uid:
           admin_label: ''
           field: uid
@@ -58,7 +54,6 @@ display:
           required: '0'
           table: node_field_data
           plugin_id: standard
-          provider: views
       sorts: {  }
       style:
         type: default
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_field_output.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_field_output.yml
index 74f7e59..bde1591 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_field_output.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_field_output.yml
@@ -15,7 +15,6 @@ display:
           table: views_test_data
           field: name
           plugin_id: string
-          provider: views_test_data
       style:
         type: html_list
     display_plugin: default
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_field_tokens.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_field_tokens.yml
index 5bb6c56..9478d11 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_field_tokens.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_field_tokens.yml
@@ -21,25 +21,21 @@ display:
           table: views_test_data
           field: name
           plugin_id: string
-          provider: views_test_data
         name_1:
           id: name_1
           table: views_test_data
           field: name
           plugin_id: string
-          provider: views_test_data
         name_2:
           id: name_2
           table: views_test_data
           field: name
           plugin_id: string
-          provider: views_test_data
         job:
           id: job
           table: views_test_data
           field: job
           plugin_id: string
-          provider: views_test_data
       style:
         type: default
       row:
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_field_type.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_field_type.yml
index 6113c52..d3b4a0a 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_field_type.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_field_type.yml
@@ -11,7 +11,6 @@ display:
           id: type
           table: node_field_data
           plugin_id: node_type
-          provider: node
     display_plugin: default
     display_title: Master
     id: default
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_filter.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_filter.yml
index cfd3c6f..8ff1901 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_filter.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_filter.yml
@@ -20,14 +20,12 @@ display:
           label: ''
           table: views_test_data
           plugin_id: string
-          provider: views_test_data
       filters:
         type:
           field: name
           id: test_filter
           table: views_test_data
           plugin_id: string
-          provider: views_test_data
       query:
         type: views_query
       use_more_always: '0'
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_filter_date_between.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_filter_date_between.yml
index 384dd7e..313a052 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_filter_date_between.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_filter_date_between.yml
@@ -17,14 +17,12 @@ display:
           id: nid
           table: node
           plugin_id: node
-          provider: node
       filters:
         created:
           field: created
           id: created
           table: node_field_data
           plugin_id: date
-          provider: views
       pager:
         type: full
       query:
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_filter_group_override.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_filter_group_override.yml
index 99356cd..cd290d9 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_filter_group_override.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_filter_group_override.yml
@@ -21,7 +21,6 @@ display:
           label: ''
           table: node_field_data
           plugin_id: node
-          provider: node
       filters:
         status:
           expose:
@@ -32,7 +31,6 @@ display:
           table: node_field_data
           value: '1'
           plugin_id: boolean
-          provider: views
       pager:
         type: full
       query:
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_filter_groups.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_filter_groups.yml
index 0975e42..cd9466f 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_filter_groups.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_filter_groups.yml
@@ -21,7 +21,6 @@ display:
           label: ''
           table: node_field_data
           plugin_id: node
-          provider: node
       filter_groups:
         groups:
           1: AND
@@ -35,7 +34,6 @@ display:
           value:
             value: '1'
           plugin_id: numeric
-          provider: views
         nid_1:
           field: nid
           group: '2'
@@ -44,7 +42,6 @@ display:
           value:
             value: '2'
           plugin_id: numeric
-          provider: views
         status:
           expose:
             operator: '0'
@@ -54,7 +51,6 @@ display:
           table: node_field_data
           value: '1'
           plugin_id: boolean
-          provider: views
       pager:
         options:
           items_per_page: '10'
@@ -68,7 +64,6 @@ display:
           order: DESC
           table: node_field_data
           plugin_id: date
-          provider: views
       title: test_filter_groups
       style:
         type: default
@@ -96,7 +91,6 @@ display:
           value:
             value: '1'
           plugin_id: numeric
-          provider: views
         nid_1:
           field: nid
           group: '2'
@@ -105,7 +99,6 @@ display:
           value:
             value: '2'
           plugin_id: numeric
-          provider: views
         status:
           expose:
             operator: '0'
@@ -115,7 +108,6 @@ display:
           table: node_field_data
           value: '1'
           plugin_id: boolean
-          provider: views
       path: test-filter-groups
     display_plugin: page
     display_title: Page
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_filter_in_operator_ui.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_filter_in_operator_ui.yml
index f10f25c..abe6884 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_filter_in_operator_ui.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_filter_in_operator_ui.yml
@@ -24,7 +24,6 @@ display:
           id: type
           table: node_field_data
           plugin_id: string
-          provider: views
       pager:
         type: full
       style:
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_get_attach_displays.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_get_attach_displays.yml
index 94c777c..6fbccaf 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_get_attach_displays.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_get_attach_displays.yml
@@ -50,7 +50,6 @@ display:
           hide_empty: '0'
           empty_zero: '0'
           link_to_node: '1'
-          provider: node
       filters:
         status:
           value: '1'
@@ -61,7 +60,6 @@ display:
           expose:
             operator: '0'
           group: '1'
-          provider: views
       sorts:
         created:
           id: created
@@ -69,7 +67,6 @@ display:
           field: created
           order: DESC
           plugin_id: date
-          provider: views
       title: test_get_attach_displays
   page_1:
     display_plugin: page
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_glossary.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_glossary.yml
index 41875e8..f8783ce 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_glossary.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_glossary.yml
@@ -21,7 +21,6 @@ display:
             items_per_page: '25'
           table: node_field_data
           plugin_id: string
-          provider: views
       cache:
         type: none
       exposed_form:
@@ -33,7 +32,6 @@ display:
           label: ''
           table: node_field_data
           plugin_id: node
-          provider: node
       pager:
         type: full
       query:
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_grid.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_grid.yml
deleted file mode 100644
index c2a8915..0000000
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_grid.yml
+++ /dev/null
@@ -1,71 +0,0 @@
-base_table: views_test_data
-core: '8'
-description: ''
-status: '1'
-display:
-  default:
-    display_options:
-      defaults:
-        fields: '0'
-        pager: '0'
-        pager_options: '0'
-        sorts: '0'
-      fields:
-        age:
-          field: age
-          id: age
-          relationship: none
-          table: views_test_data
-          plugin_id: numeric
-        id:
-          field: id
-          id: id
-          relationship: none
-          table: views_test_data
-          plugin_id: numeric
-        name:
-          field: name
-          id: name
-          relationship: none
-          table: views_test_data
-          plugin_id: string
-      pager:
-        options:
-          offset: '0'
-        type: none
-      pager_options: {  }
-      sorts:
-        id:
-          field: id
-          id: id
-          order: ASC
-          relationship: none
-          table: views_test_data
-          plugin_id: numeric
-      style:
-        type: grid
-        options:
-          grouping: {  }
-          columns: '4'
-          automatic_width: '1'
-          alignment: horizontal
-          col_class_default: '1'
-          col_class_custom: ''
-          row_class_default: '1'
-          row_class_custom: ''
-      row:
-        type: fields
-    display_plugin: default
-    display_title: Master
-    id: default
-    position: '0'
-  page_1:
-    display_options:
-      path: test-grid
-    display_plugin: page
-    display_title: 'Page display'
-    id: page_1
-    position: '1'
-label: ''
-id: test_grid
-tag: ''
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_group_by_count.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_group_by_count.yml
index 4bf96e3..f16877c 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_group_by_count.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_group_by_count.yml
@@ -28,7 +28,6 @@ display:
           id: id
           table: entity_test
           plugin_id: numeric
-          provider: views
         name:
           alter:
             alter_text: '0'
@@ -44,7 +43,6 @@ display:
           id: name
           table: entity_test
           plugin_id: standard
-          provider: views
       group_by: '1'
       pager:
         type: some
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_group_by_in_filters.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_group_by_in_filters.yml
index 46cdd57..671b656 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_group_by_in_filters.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_group_by_in_filters.yml
@@ -27,7 +27,6 @@ display:
           id: name
           table: entity_test
           plugin_id: standard
-          provider: views
       filters:
         id:
           field: id
@@ -38,7 +37,6 @@ display:
           value:
             value: '3'
           plugin_id: numeric
-          provider: views
       group_by: '1'
       pager:
         type: some
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_handler_relationships.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_handler_relationships.yml
index 71d1e17..bf45d7d 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_handler_relationships.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_handler_relationships.yml
@@ -11,21 +11,18 @@ display:
           table: node_field_data
           field: title
           plugin_id: node
-          provider: node
       relationships:
         cid:
           id: cid
           table: node
           field: cid
           plugin_id: standard
-          provider: views
         nid:
           id: nid
           table: comment
           field: nid
           relationship: cid
           plugin_id: standard
-          provider: views
     display_plugin: default
     display_title: Master
     id: default
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_handler_test_access.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_handler_test_access.yml
index 2a1a649..11f590a 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_handler_test_access.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_handler_test_access.yml
@@ -9,52 +9,44 @@ display:
           table: views_test_data
           field: access_callback
           plugin_id: numeric
-          provider: views_test_data
         access_callback_arguments:
           id: access_callback_arguments
           table: views_test_data
           field: access_callback_arguments
           plugin_id: numeric
-          provider: views_test_data
       filters:
         access_callback:
           id: access_callback
           table: views_test_data
           field: access_callback
           plugin_id: numeric
-          provider: views_test_data
         access_callback_arguments:
           id: access_callback_arguments
           table: views_test_data
           field: access_callback_arguments
           plugin_id: numeric
-          provider: views_test_data
       arguments:
         access_callback:
           id: access_callback
           table: views_test_data
           field: access_callback
           plugin_id: numeric
-          provider: views_test_data
         access_callback_arguments:
           id: access_callback_arguments
           table: views_test_data
           field: access_callback_arguments
           plugin_id: numeric
-          provider: views_test_data
       sorts:
         access_callback:
           id: access_callback
           table: views_test_data
           field: access_callback
           plugin_id: standard
-          provider: views_test_data
         access_callback_arguments:
           id: access_callback_arguments
           table: views_test_data
           field: access_callback_arguments
           plugin_id: standard
-          provider: views_test_data
     display_plugin: default
     display_title: Master
     id: default
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_history.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_history.yml
index f2791fc..aca6f52 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_history.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_history.yml
@@ -43,7 +43,6 @@ display:
           hide_empty: '0'
           empty_zero: '0'
           link_to_node: '1'
-          provider: node
         timestamp:
           id: timestamp
           table: history
@@ -95,7 +94,6 @@ display:
           hide_alter_empty: '1'
           link_to_node: '0'
           comments: '0'
-          provider: history
       filters:
         status:
           value: '1'
@@ -106,7 +104,6 @@ display:
           expose:
             operator: '0'
           group: '1'
-          provider: views
       sorts:
         created:
           id: created
@@ -114,7 +111,6 @@ display:
           field: created
           plugin_id: date
           order: DESC
-          provider: views
   page_1:
     display_plugin: page
     id: page_1
@@ -168,7 +164,6 @@ display:
             default_group: All
             default_group_multiple: {  }
             group_items: {  }
-          provider: views
         timestamp:
           id: timestamp
           table: history
@@ -204,7 +199,6 @@ display:
             default_group: All
             default_group_multiple: {  }
             group_items: {  }
-          provider: history
       defaults:
         filters: '0'
         filter_groups: '0'
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_mini_pager.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_mini_pager.yml
index 484055c..9483274 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_mini_pager.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_mini_pager.yml
@@ -4,6 +4,7 @@ description: ''
 tag: ''
 label: test_mini_pager
 core: 8.x
+api_version: '3.0'
 display:
   default:
     display_plugin: default
@@ -27,8 +28,8 @@ display:
           id: '0'
           total_pages: ''
           tags:
-            previous: 'â€¹â€¹ test'
-            next: 'â€ºâ€º test'
+            previous: â€¹â€¹ test
+            next: â€ºâ€º test
           expose:
             items_per_page: '0'
             items_per_page_label: 'Items per page'
@@ -64,7 +65,6 @@ display:
           empty_zero: '0'
           link_to_node: '1'
           plugin_id: node
-          provider: views
       filters: {  }
       sorts:
         nid:
@@ -73,7 +73,6 @@ display:
           field: nid
           plugin_id: standard
           order: ASC
-          provider: views
       title: test_mini_pager
       filter_groups:
         operator: AND
@@ -98,19 +97,6 @@ display:
         type: mini
         options:
           items_per_page: '1'
-  page_3:
-    display_plugin: page
-    id: page_3
-    display_title: Page
-    position: ''
-    display_options:
-      path: test_mini_pager_all
-      defaults:
-        pager: '0'
-      pager:
-        type: mini
-        options:
-          items_per_page: '0'
 base_field: nid
 status: '1'
 module: views
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_page_display.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_page_display.yml
index d090123..a293826 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_page_display.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_page_display.yml
@@ -17,7 +17,6 @@ display:
           relationship: none
           table: views_test_data
           plugin_id: numeric
-          provider: views_test_data
     display_plugin: default
     display_title: Master
     id: default
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_page_display_arguments.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_page_display_arguments.yml
index 16402ec..51d8635 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_page_display_arguments.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_page_display_arguments.yml
@@ -17,7 +17,6 @@ display:
           field: id
           table: views_test_data
           plugin_id: numeric
-          provider: views_test_data
     display_plugin: default
     display_title: Master
     id: default
@@ -40,7 +39,6 @@ display:
           relationship: none
           table: views_test_data
           plugin_id: numeric
-          provider: views_test_data
       path: test_route_with_argument
     display_plugin: page
     display_title: Page
@@ -57,7 +55,6 @@ display:
           relationship: none
           table: views_test_data
           plugin_id: numeric
-          provider: views_test_data
       path: test_route_with_suffix/%/suffix
     display_plugin: page
     display_title: Page
@@ -74,14 +71,12 @@ display:
           relationship: none
           table: views_test_data
           plugin_id: numeric
-          provider: views_test_data
         id_2:
           field: id
           id: id_2
           relationship: none
           table: views_test_data
           plugin_id: numeric
-          provider: views_test_data
       path: test_route_with_suffix_and_argument/%/suffix
     display_plugin: page
     display_title: Page
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_page_display_menu.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_page_display_menu.yml
index 687e1c2..7cdfd9e 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_page_display_menu.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_page_display_menu.yml
@@ -17,7 +17,6 @@ display:
           table: views_test_data
           field: id
           plugin_id: numeric
-          provider: views_test_data
     display_plugin: default
     display_title: Master
     id: default
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_page_display_route.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_page_display_route.yml
index a827e87..4db7fa3 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_page_display_route.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_page_display_route.yml
@@ -17,7 +17,6 @@ display:
           table: views_test_data
           field: id
           plugin_id: numeric
-          provider: views_test_data
     display_plugin: default
     display_title: Master
     id: default
@@ -40,7 +39,6 @@ display:
           relationship: none
           table: views_test_data
           plugin_id: numeric
-          provider: views_test_data
       path: test_route_with_argument
     display_plugin: page
     display_title: Page
@@ -57,7 +55,6 @@ display:
           relationship: none
           table: views_test_data
           plugin_id: numeric
-          provider: views_test_data
       path: test_route_with_argument/%/suffix
     display_plugin: page
     display_title: Page
@@ -74,14 +71,12 @@ display:
           relationship: none
           table: views_test_data
           plugin_id: numeric
-          provider: views_test_data
         id_2:
           field: id
           id: id_2
           relationship: none
           table: views_test_data
           plugin_id: numeric
-          provider: views_test_data
       path: test_route_with_argument/%/suffix
     display_plugin: page
     display_title: Page
@@ -98,14 +93,12 @@ display:
           relationship: none
           table: views_test_data
           plugin_id: numeric
-          provider: views_test_data
         id_2:
           field: id
           id: id_2
           relationship: none
           table: views_test_data
           plugin_id: numeric
-          provider: views_test_data
       path: test_route_with_argument
     display_plugin: page
     display_title: Page
@@ -122,14 +115,12 @@ display:
           relationship: none
           table: views_test_data
           plugin_id: numeric
-          provider: views_test_data
         id_2:
           field: id
           id: id_2
           relationship: none
           table: views_test_data
           plugin_id: numeric
-          provider: views_test_data
       path: test_route_with_argument/%/%
     display_plugin: page
     display_title: Page
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_page_view.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_page_view.yml
index 39608d6..6792507 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_page_view.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_page_view.yml
@@ -17,14 +17,13 @@ display:
           relationship: none
           table: views_test_data
           plugin_id: numeric
-          provider: views_test_data
     display_plugin: default
     display_title: Master
     id: default
     position: '0'
   page_1:
     display_plugin: page
-    display_title: 'Test page view'
+    display_title: Test page view
     id: page_1
 label: ''
 id: test_page_view
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_preview.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_preview.yml
index 920ed7d..e8b81f8 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_preview.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_preview.yml
@@ -38,7 +38,6 @@ display:
           label: Name
           exclude: '0'
           plugin_id: standard
-          provider: views_test_data
       filters:
         id:
           id: id
@@ -56,7 +55,7 @@ display:
           exposed: '1'
           expose:
             operator_id: id_op
-            label: ID
+            label: 'ID'
             description: ''
             use_operator: '0'
             operator: id_op
@@ -66,7 +65,6 @@ display:
             multiple: '0'
           is_grouped: '0'
           plugin_id: numeric
-          provider: views_test_data
       sorts: {  }
       filter_groups:
         operator: AND
@@ -84,7 +82,6 @@ display:
           title_enable: '0'
           title: ''
           plugin_id: numeric
-          provider: views_test_data
       header:
         area_text_custom:
           id: area_text_custom
@@ -97,7 +94,6 @@ display:
           content: 'Test header text'
           tokenize: '0'
           plugin_id: text_custom
-          provider: views
       footer:
         area_text_custom:
           id: area_text_custom
@@ -110,7 +106,6 @@ display:
           content: 'Test footer text'
           tokenize: '0'
           plugin_id: text_custom
-          provider: views
       empty:
         area_text_custom:
           id: area_text_custom
@@ -123,7 +118,6 @@ display:
           content: 'Test empty text'
           tokenize: '0'
           plugin_id: text_custom
-          provider: views
 label: test_preview
 module: views
 id: test_preview
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_redirect_view.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_redirect_view.yml
index 12e38fa..f86f3b2 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_redirect_view.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_redirect_view.yml
@@ -50,7 +50,6 @@ display:
           empty_zero: '0'
           link_to_node: '1'
           plugin_id: node
-          provider: node
       filters:
         status:
           value: '1'
@@ -61,7 +60,6 @@ display:
             operator: '0'
           group: '1'
           plugin_id: boolean
-          provider: views
       sorts:
         created:
           id: created
@@ -69,7 +67,6 @@ display:
           field: created
           order: DESC
           plugin_id: date
-          provider: views
       title: test_redirect_view
   page_1:
     display_plugin: page
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_reset_button.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_reset_button.yml
index 76c6618..140a80d 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_reset_button.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_reset_button.yml
@@ -25,7 +25,6 @@ display:
           id: type
           table: node_field_data
           plugin_id: node_type
-          provider: views
       pager:
         type: full
       query:
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_simple_argument.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_simple_argument.yml
index 1d4f884..16cec76 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_simple_argument.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_simple_argument.yml
@@ -17,19 +17,16 @@ display:
           id: age
           relationship: none
           table: views_test_data
-          provider: views_test_data
         id:
           field: id
           id: id
           relationship: none
           table: views_test_data
-          provider: views_test_data
         name:
           field: name
           id: name
           relationship: none
           table: views_test_data
-          provider: views_test_data
       pager:
         options:
           offset: '0'
@@ -42,7 +39,6 @@ display:
           order: ASC
           relationship: none
           table: views_test_data
-          provider: views_test_data
       arguments:
         age:
           default_action: ignore
@@ -80,7 +76,6 @@ display:
           validate_argument_transform: '0'
           validate_user_restrict_roles: '0'
           validate_argument_php: ''
-          provider: views_test_data
     display_plugin: default
     display_title: Master
     id: default
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_style_mapping.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_style_mapping.yml
index 9cac36f..42d333a 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_style_mapping.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_style_mapping.yml
@@ -17,21 +17,18 @@ display:
           relationship: none
           table: views_test_data
           plugin_id: numeric
-          provider: views_test_data
         job:
           field: job
           id: job
           relationship: none
           table: views_test_data
           plugin_id: string
-          provider: views_test_data
         name:
           field: name
           id: name
           relationship: none
           table: views_test_data
           plugin_id: string
-          provider: views_test_data
       pager:
         options:
           offset: '0'
@@ -45,7 +42,6 @@ display:
           relationship: none
           table: views_test_data
           plugin_id: numeric
-          provider: views_test_data
       style:
         type: mapping_test
         options:
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_table.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_table.yml
index 8957262..991fbdf 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_table.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_table.yml
@@ -17,21 +17,18 @@ display:
           relationship: none
           table: views_test_data
           plugin_id: numeric
-          provider: views_test_data
         id:
           field: id
           id: id
           relationship: none
           table: views_test_data
           plugin_id: numeric
-          provider: views_test_data
         name:
           field: name
           id: name
           relationship: none
           table: views_test_data
           plugin_id: string
-          provider: views_test_data
       pager:
         options:
           offset: '0'
@@ -45,7 +42,6 @@ display:
           relationship: none
           table: views_test_data
           plugin_id: numeric
-          provider: views_test_data
       style:
         type: table
         options:
@@ -55,7 +51,7 @@ display:
           row_class_special: '1'
           override: '1'
           sticky: '0'
-          summary: summary-text
+          summary: ''
           columns:
             age: age
             id: id
@@ -82,9 +78,10 @@ display:
               separator: ''
               empty_column: '0'
               responsive: ''
-          default: id
+          default: 'id'
           empty_table: '1'
           caption: caption-text
+          summary: summary-text
           description: description-text
       row:
         type: fields
@@ -101,14 +98,13 @@ display:
           content: 'custom text'
           tokenize: '0'
           plugin_id: text_custom
-          provider: views
     display_plugin: default
     display_title: Master
     id: default
     position: '0'
   page_1:
     display_options:
-      path: test-table
+      path: 'test-table'
     display_plugin: page
     display_title: 'Page display'
     id: page_1
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_tokens.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_tokens.yml
index 2867aa9..e405487 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_tokens.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_tokens.yml
@@ -20,21 +20,18 @@ display:
           relationship: none
           table: views_test_data
           plugin_id: numeric
-          provider: views_test_data
         id:
           field: id
           id: id
           relationship: none
           table: views_test_data
           plugin_id: numeric
-          provider: views_test_data
         name:
           field: name
           id: name
           relationship: none
           table: views_test_data
           plugin_id: string
-          provider: views_test_data
       pager:
         type: full
         options:
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view.yml
index 1f47740..e660006 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view.yml
@@ -17,21 +17,18 @@ display:
           relationship: none
           table: views_test_data
           plugin_id: numeric
-          provider: views_test_data
         id:
           field: id
           id: id
           relationship: none
           table: views_test_data
           plugin_id: numeric
-          provider: views_test_data
         name:
           field: name
           id: name
           relationship: none
           table: views_test_data
           plugin_id: string
-          provider: views_test_data
       pager:
         options:
           offset: '0'
@@ -45,7 +42,6 @@ display:
           relationship: none
           table: views_test_data
           plugin_id: numeric
-          provider: views_test_data
     display_plugin: default
     display_title: Master
     id: default
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_argument_validate_numeric.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_argument_validate_numeric.yml
index 2cb8d4f..192746d 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_argument_validate_numeric.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_argument_validate_numeric.yml
@@ -18,7 +18,6 @@ display:
           validate:
             type: numeric
           plugin_id: 'null'
-          provider: views
       cache:
         type: none
       exposed_form:
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_argument_validate_php.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_argument_validate_php.yml
index de1e187..11dd632 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_argument_validate_php.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_argument_validate_php.yml
@@ -18,7 +18,6 @@ display:
           validate:
             type: php
           plugin_id: 'null'
-          provider: views
       cache:
         type: none
       exposed_form:
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_empty.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_empty.yml
index 9504a9f..7c83a7d 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_empty.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_empty.yml
@@ -17,7 +17,6 @@ display:
           relationship: none
           table: views_test_data
           plugin_id: numeric
-          provider: views_test_data
       pager:
         options:
           offset: '0'
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_handler_weight.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_handler_weight.yml
index e7b0d0a..acbe18e 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_handler_weight.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_handler_weight.yml
@@ -17,21 +17,18 @@ display:
           relationship: none
           table: views_test_data
           plugin_id: numeric
-          provider: views_test_data
         age:
           field: age
           id: age
           relationship: none
           table: views_test_data
           plugin_id: numeric
-          provider: views_test_data
         name:
           field: name
           id: name
           relationship: none
           table: views_test_data
           plugin_id: string
-          provider: views_test_data
       pager:
         options:
           offset: '0'
@@ -45,7 +42,6 @@ display:
           relationship: none
           table: views_test_data
           plugin_id: numeric
-          provider: views_test_data
         age:
           field: age
           id: standard
@@ -53,20 +49,17 @@ display:
           relationship: none
           table: views_test_data
           plugin_id: numeric
-          provider: views_test_data
       filters:
         name:
           field: name
           id: string
           table: views_test_data
           plugin_id: string
-          provider: views_test_data
         age:
           field: age
           id: numeric
           table: views_test_data
           plugin_id: numeric
-          provider: views_test_data
     display_plugin: default
     display_title: Master
     id: default
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_pager_full_zero_items_per_page.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_pager_full_zero_items_per_page.yml
index f563ed8..968c40e 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_pager_full_zero_items_per_page.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_pager_full_zero_items_per_page.yml
@@ -28,7 +28,6 @@ display:
           link_to_node: '0'
           table: node_field_data
           plugin_id: node
-          provider: node
       pager:
         options:
           id: '0'
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_render.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_render.yml
index 320d835..452ec07 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_render.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_render.yml
@@ -17,21 +17,18 @@ display:
           relationship: none
           table: views_test_data
           plugin_id: numeric
-          provider: views_test_data
         id:
           field: id
           id: id
           relationship: none
           table: views_test_data
           plugin_id: numeric
-          provider: views_test_data
         name:
           field: name
           id: name
           relationship: none
           table: views_test_data
           plugin_id: string
-          provider: views_test_data
       pager:
         options:
           offset: '0'
@@ -45,7 +42,6 @@ display:
           relationship: none
           table: views_test_data
           plugin_id: standard
-          provider: views_test_data
       style:
         type: table
     display_plugin: default
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_storage.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_storage.yml
index 7a431c8..9d6a180 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_storage.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_storage.yml
@@ -18,7 +18,6 @@ display:
           relationship: none
           table: views_test_data
           plugin_id: numeric
-          provider: views_test_data
       sorts:
         id:
           field: id
@@ -27,7 +26,6 @@ display:
           relationship: none
           table: views_test_data
           plugin_id: standard
-          provider: views_test_data
     display_plugin: default
     display_title: Master
     id: default
@@ -53,4 +51,4 @@ display:
         options: {  }
 label: 'Storage Test View'
 id: test_view_storage
-tag: test
+tag: 'test'
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_views_groupby_save.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_views_groupby_save.yml
index e17bdf4..4b9b853 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_views_groupby_save.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_views_groupby_save.yml
@@ -1,4 +1,5 @@
 base_table: views_test_data
+base_table: id
 core: '8'
 description: ''
 status: '1'
@@ -23,7 +24,6 @@ display:
           table: views_test_data
           id: id
           plugin_id: id
-          provider: views_test_data
     display_plugin: default
     display_title: Master
     id: default
diff --git a/core/modules/views/tests/modules/views_test_data/lib/Drupal/views_test_data/Plugin/views/field/FieldTest.php b/core/modules/views/tests/modules/views_test_data/lib/Drupal/views_test_data/Plugin/views/field/FieldTest.php
index fcee561..9108376 100644
--- a/core/modules/views/tests/modules/views_test_data/lib/Drupal/views_test_data/Plugin/views/field/FieldTest.php
+++ b/core/modules/views/tests/modules/views_test_data/lib/Drupal/views_test_data/Plugin/views/field/FieldTest.php
@@ -52,7 +52,7 @@ protected function addSelfTokens(&$tokens, $item) {
   /**
    * Overrides Drupal\views\Plugin\views\field\FieldPluginBase::render().
    */
-  public function render($values) {
+  function render($values) {
     return $this->sanitizeValue($this->getTestValue());
   }
 
diff --git a/core/modules/views/views.module b/core/modules/views/views.module
index 7e164f2..85aecf9 100644
--- a/core/modules/views/views.module
+++ b/core/modules/views/views.module
@@ -236,26 +236,26 @@ function views_plugin_list() {
  * we haven't got a chance to load that file before Drupal builds the
  * node portion of the theme registry.
  */
-function views_preprocess_node(&$variables) {
+function views_preprocess_node(&$vars) {
   Drupal::moduleHandler()->loadInclude('node', 'views.inc');
   // The 'view' attribute of the node is added in views_preprocess_node()
-  if (!empty($variables['node']->view) && $variables['node']->view->storage->id()) {
-    $variables['view'] = $variables['node']->view;
-    $variables['theme_hook_suggestions'][] = 'node__view__' . $variables['node']->view->storage->id();
-    if (!empty($variables['node']->view->current_display)) {
-      $variables['theme_hook_suggestions'][] = 'node__view__' . $variables['node']->view->storage->id() . '__' . $variables['node']->view->current_display;
+  if (!empty($vars['node']->view) && $vars['node']->view->storage->id()) {
+    $vars['view'] = $vars['node']->view;
+    $vars['theme_hook_suggestions'][] = 'node__view__' . $vars['node']->view->storage->id();
+    if (!empty($vars['node']->view->current_display)) {
+      $vars['theme_hook_suggestions'][] = 'node__view__' . $vars['node']->view->storage->id() . '__' . $vars['node']->view->current_display;
 
       // If a node is being rendered in a view, and the view does not have a path,
       // prevent drupal from accidentally setting the $page variable:
-      if ($variables['page'] && $variables['view_mode'] == 'full' && !$variables['view']->display_handler->hasPath()) {
-        $variables['page'] = FALSE;
+      if ($vars['page'] && $vars['view_mode'] == 'full' && !$vars['view']->display_handler->hasPath()) {
+        $vars['page'] = FALSE;
       }
     }
   }
 
   // Allow to alter comments and links based on the settings in the row plugin.
-  if (!empty($variables['view']->rowPlugin) && $variables['view']->rowPlugin->getPluginId() == 'entity:node') {
-    node_row_node_view_preprocess_node($variables);
+  if (!empty($vars['view']->rowPlugin) && $vars['view']->rowPlugin->getPluginId() == 'entity:node') {
+    node_row_node_view_preprocess_node($vars);
   }
 }
 
@@ -263,13 +263,13 @@ function views_preprocess_node(&$variables) {
  * A theme preprocess function to automatically allow view-based node
  * templates if called from a view.
  */
-function views_preprocess_comment(&$variables) {
+function views_preprocess_comment(&$vars) {
   // The 'view' attribute of the node is added in template_preprocess_views_view_row_comment()
-  if (!empty($variables['comment']->view) && $variables['comment']->view->storage->id()) {
-    $variables['view'] = &$variables['comment']->view;
-    $variables['theme_hook_suggestions'][] = 'comment__view__' . $variables['comment']->view->storage->id();
-    if (!empty($variables['node']->view->current_display)) {
-      $variables['theme_hook_suggestions'][] = 'comment__view__' . $variables['comment']->view->storage->id() . '__' . $variables['comment']->view->current_display;
+  if (!empty($vars['comment']->view) && $vars['comment']->view->storage->id()) {
+    $vars['view'] = &$vars['comment']->view;
+    $vars['theme_hook_suggestions'][] = 'comment__view__' . $vars['comment']->view->storage->id();
+    if (!empty($vars['node']->view->current_display)) {
+      $vars['theme_hook_suggestions'][] = 'comment__view__' . $vars['comment']->view->storage->id() . '__' . $vars['comment']->view->current_display;
     }
   }
 }
@@ -830,13 +830,6 @@ function views_library_info() {
       array('system', 'drupal'),
     ),
   );
-  $libraries['views.exposed-form'] = array(
-    'title' => 'Views exposed form',
-    'version' => VERSION,
-    'css' => array(
-      "$path/css/views.exposed_form.css",
-    ),
-  );
 
   return $libraries;
 }
@@ -1112,12 +1105,12 @@ function views_disable_view(View $view) {
  *
  * @return Drupal\views\ViewExecutable
  *   A reference to the $view object.
- *
- * @deprecated as of Drupal 8.0. Use \Drupal\views\Views::getView().
- *
  */
 function views_get_view($name) {
-  return Views::getView($name);
+  $view = entity_load('view', $name);
+  if ($view) {
+    return $view->get('executable');
+  }
 }
 
 /**
@@ -1358,8 +1351,7 @@ function views_exposed_form($form, &$form_state) {
     }
   }
 
-  $form['actions'] = array('#type' => 'actions');
-  $form['actions']['submit'] = array(
+  $form['submit'] = array(
     // Prevent from showing up in $_GET.
     '#name' => '',
     '#type' => 'submit',
diff --git a/core/modules/views/views.theme.inc b/core/modules/views/views.theme.inc
index f88413d..444633b 100644
--- a/core/modules/views/views.theme.inc
+++ b/core/modules/views/views.theme.inc
@@ -15,71 +15,71 @@
  *
  * Default template: views-view.html.twig.
  *
- * @param array $variables
+ * @param array $vars
  *   An associative array containing:
  *   - view: The ViewExecutable object.
  */
-function template_preprocess_views_view(&$variables) {
+function template_preprocess_views_view(&$vars) {
   global $base_path;
 
-  $view = $variables['view'];
+  $view = $vars['view'];
 
-  $variables['rows'] = (!empty($view->result) || $view->style_plugin->evenEmpty()) ? $view->style_plugin->render($view->result) : array();
+  $vars['rows'] = (!empty($view->result) || $view->style_plugin->evenEmpty()) ? $view->style_plugin->render($view->result) : array();
   // Force a render array so CSS/JS can be added.
-  if (!is_array($variables['rows'])) {
-    $variables['rows'] = array('#markup' => $variables['rows']);
+  if (!is_array($vars['rows'])) {
+    $vars['rows'] = array('#markup' => $vars['rows']);
   }
 
-  $variables['css_name'] = drupal_clean_css_identifier($view->storage->id());
-  $variables['id'] = $view->storage->id();
-  $variables['display_id'] = $view->current_display;
+  $vars['css_name'] = drupal_clean_css_identifier($view->storage->id());
+  $vars['id'] = $view->storage->id();
+  $vars['display_id'] = $view->current_display;
 
   // Basic classes.
-  $variables['css_class'] = '';
+  $vars['css_class'] = '';
 
-  $variables['attributes']['class'] = array();
-  $variables['attributes']['class'][] = 'view';
-  $variables['attributes']['class'][] = 'view-' . drupal_clean_css_identifier($variables['id']);
-  $variables['attributes']['class'][] = 'view-id-' . $variables['id'];
-  $variables['attributes']['class'][] = 'view-display-id-' . $variables['display_id'];
+  $vars['attributes']['class'] = array();
+  $vars['attributes']['class'][] = 'view';
+  $vars['attributes']['class'][] = 'view-' . drupal_clean_css_identifier($vars['id']);
+  $vars['attributes']['class'][] = 'view-id-' . $vars['id'];
+  $vars['attributes']['class'][] = 'view-display-id-' . $vars['display_id'];
 
   $css_class = $view->display_handler->getOption('css_class');
   if (!empty($css_class)) {
-    $variables['css_class'] = preg_replace('/[^a-zA-Z0-9- ]/', '-', $css_class);
-    $variables['attributes']['class'][] = $variables['css_class'];
+    $vars['css_class'] = preg_replace('/[^a-zA-Z0-9- ]/', '-', $css_class);
+    $vars['attributes']['class'][] = $vars['css_class'];
   }
 
   $empty = empty($view->result);
-  $variables['header'] = $view->display_handler->renderArea('header', $empty);
-  $variables['footer'] = $view->display_handler->renderArea('footer', $empty);
-  $variables['empty'] = $empty ? $view->display_handler->renderArea('empty', $empty) : FALSE;
+  $vars['header'] = $view->display_handler->renderArea('header', $empty);
+  $vars['footer'] = $view->display_handler->renderArea('footer', $empty);
+  $vars['empty'] = $empty ? $view->display_handler->renderArea('empty', $empty) : FALSE;
 
-  $variables['exposed']    = !empty($view->exposed_widgets) ? $view->exposed_widgets : '';
-  $variables['more']       = $view->display_handler->renderMoreLink();
-  $variables['feed_icon']  = !empty($view->feed_icon) ? $view->feed_icon : '';
+  $vars['exposed']    = !empty($view->exposed_widgets) ? $view->exposed_widgets : '';
+  $vars['more']       = $view->display_handler->renderMoreLink();
+  $vars['feed_icon']  = !empty($view->feed_icon) ? $view->feed_icon : '';
 
-  $variables['pager']      = '';
+  $vars['pager']      = '';
 
   // @todo: Figure out whether this belongs into views_ui_preprocess_views_view.
   // Render title for the admin preview.
-  $variables['title'] = !empty($view->views_ui_context) ? filter_xss_admin($view->getTitle()) : '';
+  $vars['title'] = !empty($view->views_ui_context) ? filter_xss_admin($view->getTitle()) : '';
 
   if ($view->display_handler->renderPager()) {
     $exposed_input = isset($view->exposed_raw_input) ? $view->exposed_raw_input : NULL;
-    $variables['pager'] = $view->renderPager($exposed_input);
+    $vars['pager'] = $view->renderPager($exposed_input);
   }
 
   if (!empty($view->attachment_before)) {
-    $variables['attachment_before'] = $view->attachment_before;
+    $vars['attachment_before'] = $view->attachment_before;
   }
   else {
-    $variables['attachment_before'] = array();
+    $vars['attachment_before'] = array();
   }
   if (!empty($view->attachment_after)) {
-    $variables['attachment_after'] = $view->attachment_after;
+    $vars['attachment_after'] = $view->attachment_after;
   }
   else {
-    $variables['attachment_after'] = array();
+    $vars['attachment_after'] = array();
   }
 
   // Add contextual links to the view. We need to attach them to the dummy
@@ -88,7 +88,7 @@ function template_preprocess_views_view(&$variables) {
   // purposes, it doesn't matter what we attach them to, since once they are
   // processed by contextual_preprocess() they will appear in the $title_suffix
   // variable (which we will then render in views-view.html.twig).
-  views_add_contextual_links($variables['view_array'], 'view', $view, $view->current_display);
+  views_add_contextual_links($vars['view_array'], 'view', $view, $view->current_display);
 
   // Attachments are always updated with the outer view, never by themselves,
   // so they do not have dom ids.
@@ -102,8 +102,8 @@ function template_preprocess_views_view(&$variables) {
     // we set up a hash with the current time, $dom_id, to issue a "unique"
     // identifier for each view. This identifier is written to both
     // Drupal.settings and the DIV wrapper.
-    $variables['dom_id'] = $view->dom_id;
-    $variables['attributes']['class'][] = 'view-dom-id-' . $variables['dom_id'];
+    $vars['dom_id'] = $view->dom_id;
+    $vars['attributes']['class'][] = 'view-dom-id-' . $vars['dom_id'];
   }
 
   // If using AJAX, send identifying data about this view.
@@ -112,13 +112,13 @@ function template_preprocess_views_view(&$variables) {
       'views' => array(
         'ajax_path' => url('views/ajax'),
         'ajaxViews' => array(
-          'views_dom_id:' . $variables['dom_id'] => array(
+          'views_dom_id:' . $vars['dom_id'] => array(
             'view_name' => $view->storage->id(),
             'view_display_id' => $view->current_display,
             'view_args' => check_plain(implode('/', $view->args)),
             'view_path' => check_plain(current_path()),
             'view_base_path' => $view->getPath(),
-            'view_dom_id' => $variables['dom_id'],
+            'view_dom_id' => $vars['dom_id'],
             // To fit multiple views on a page, the programmer may have
             // overridden the display's pager_element.
             'pager_element' => isset($view->pager) ? $view->pager->getPagerId() : 0,
@@ -133,21 +133,21 @@ function template_preprocess_views_view(&$variables) {
   // If form fields were found in the view, reformat the view output as a form.
   if (views_view_has_form_elements($view)) {
     // Copy the rows so as not to modify them by reference when rendering.
-    $rows = $variables['rows'];
+    $rows = $vars['rows'];
     $rows = drupal_render($rows);
-    $output = !empty($rows) ? $rows : $variables['empty'];
+    $output = !empty($rows) ? $rows : $vars['empty'];
     $form = drupal_get_form(views_form_id($view), $view, $output);
     // The form is requesting that all non-essential views elements be hidden,
     // usually because the rendered step is not a view result.
     if ($form['show_view_elements']['#value'] == FALSE) {
-      $variables['header'] = '';
-      $variables['exposed'] = '';
-      $variables['pager'] = '';
-      $variables['footer'] = '';
-      $variables['more'] = '';
-      $variables['feed_icon'] = '';
+      $vars['header'] = '';
+      $vars['exposed'] = '';
+      $vars['pager'] = '';
+      $vars['footer'] = '';
+      $vars['more'] = '';
+      $vars['feed_icon'] = '';
     }
-    $variables['rows'] = $form;
+    $vars['rows'] = $form;
   }
 }
 
@@ -156,7 +156,7 @@ function template_preprocess_views_view(&$variables) {
  *
  * Default template: views-view-fields.html.twig.
  *
- * @param array $variables
+ * @param array $vars
  *   An associative array containing:
  *   - view: The view object.
  *   - options: An array of options. Each option contains:
@@ -170,22 +170,22 @@ function template_preprocess_views_view(&$variables) {
  *       visually distinct.
  *    - row: An array containing information about the current row.
  */
-function template_preprocess_views_view_fields(&$variables) {
-  $view = $variables['view'];
+function template_preprocess_views_view_fields(&$vars) {
+  $view = $vars['view'];
 
   // Loop through the fields for this view.
   $previous_inline = FALSE;
-  $variables['fields'] = array(); // ensure it's at least an empty array.
+  $vars['fields'] = array(); // ensure it's at least an empty array.
   foreach ($view->field as $id => $field) {
     // render this even if set to exclude so it can be used elsewhere.
     $field_output = $view->style_plugin->getField($view->row_index, $id);
     $empty = $field->isValueEmpty($field_output, $field->options['empty_zero']);
-    if (empty($field->options['exclude']) && (!$empty || (empty($field->options['hide_empty']) && empty($variables['options']['hide_empty'])))) {
+    if (empty($field->options['exclude']) && (!$empty || (empty($field->options['hide_empty']) && empty($vars['options']['hide_empty'])))) {
       $object = new stdClass();
       $object->handler = &$view->field[$id];
-      $object->inline = !empty($variables['options']['inline'][$id]);
+      $object->inline = !empty($vars['options']['inline'][$id]);
 
-      $object->element_type = $object->handler->elementType(TRUE, !$variables['options']['default_field_elements'], $object->inline);
+      $object->element_type = $object->handler->elementType(TRUE, !$vars['options']['default_field_elements'], $object->inline);
       if ($object->element_type) {
         $attributes = array();
         if ($object->handler->options['element_default_classes']) {
@@ -209,22 +209,22 @@ function template_preprocess_views_view_fields(&$variables) {
       }
 
       $object->content = $field_output;
-      if (isset($view->field[$id]->field_alias) && isset($variables['row']->{$view->field[$id]->field_alias})) {
-        $object->raw = $variables['row']->{$view->field[$id]->field_alias};
+      if (isset($view->field[$id]->field_alias) && isset($vars['row']->{$view->field[$id]->field_alias})) {
+        $object->raw = $vars['row']->{$view->field[$id]->field_alias};
       }
       else {
         $object->raw = NULL; // make sure it exists to reduce NOTICE
       }
 
-      if (!empty($variables['options']['separator']) && $previous_inline && $object->inline && $object->content) {
-        $object->separator = filter_xss_admin($variables['options']['separator']);
+      if (!empty($vars['options']['separator']) && $previous_inline && $object->inline && $object->content) {
+        $object->separator = filter_xss_admin($vars['options']['separator']);
       }
 
       $object->class = drupal_clean_css_identifier($id);
 
       $previous_inline = $object->inline;
       $object->inline_html = $object->handler->elementWrapperType(TRUE, TRUE);
-      if ($object->inline_html === '' && $variables['options']['default_field_elements']) {
+      if ($object->inline_html === '' && $vars['options']['default_field_elements']) {
         $object->inline_html = $object->inline ? 'span' : 'div';
       }
 
@@ -260,7 +260,7 @@ function template_preprocess_views_view_fields(&$variables) {
           $object->label_html .= ': ';
         }
 
-        $object->elementLabelType = $object->handler->elementLabelType(TRUE, !$variables['options']['default_field_elements']);
+        $object->elementLabelType = $object->handler->elementLabelType(TRUE, !$vars['options']['default_field_elements']);
         if ($object->elementLabelType) {
           $attributes = array();
           if ($object->handler->options['element_default_classes']) {
@@ -282,7 +282,7 @@ function template_preprocess_views_view_fields(&$variables) {
         }
       }
 
-      $variables['fields'][$id] = $object;
+      $vars['fields'][$id] = $object;
     }
   }
 
@@ -326,7 +326,7 @@ function theme_views_view_fields($variables) {
  *
  * Default template: views-view-grouping.html.twig.
  *
- * @param array $variables
+ * @param array $vars
  *   An associative array containing:
  *   - view: The view object.
  *   - rows: The rows returned from the view.
@@ -335,8 +335,8 @@ function theme_views_view_fields($variables) {
  *   - content: The content to be grouped.
  *   - title: The group heading.
   */
-function template_preprocess_views_view_grouping(&$variables) {
-  $variables['content'] = $variables['view']->style_plugin->renderGroupingSets($variables['rows'], $variables['grouping_level']);
+function template_preprocess_views_view_grouping(&$vars) {
+  $vars['content'] = $vars['view']->style_plugin->renderGroupingSets($vars['rows'], $vars['grouping_level']);
 }
 
 /**
@@ -346,11 +346,11 @@ function template_preprocess_views_view_grouping(&$variables) {
  * $field->field_alias says what the raw value in $row will be. Reach it like
  * this: @code { $row->{$field->field_alias} @endcode
  */
-function theme_views_view_field($variables) {
-  $view = $variables['view'];
-  $field = $variables['field'];
-  $row = $variables['row'];
-  return $variables['output'];
+function theme_views_view_field($vars) {
+  $view = $vars['view'];
+  $field = $vars['field'];
+  $row = $vars['row'];
+  return $vars['output'];
 }
 
 /**
@@ -358,15 +358,15 @@ function theme_views_view_field($variables) {
  *
  * Default template: views-view-field.html.twig.
  *
- * @param array $variables
+ * @param array $vars
  *   An associative array containing:
  *   - field: The field handler object for the current field.
  *   - row: Object representing the raw result of the SQL query for the current
  *     field.
  *   - view: Instance of the ViewExecutable object for the parent view.
  */
-function template_preprocess_views_view_field(&$variables) {
-  $variables['output'] = $variables['field']->advancedRender($variables['row']);
+function template_preprocess_views_view_field(&$vars) {
+  $vars['output'] = $vars['field']->advancedRender($vars['row']);
 }
 
 /**
@@ -376,15 +376,15 @@ function template_preprocess_views_view_field(&$variables) {
  *
  * Default template: views-view-summary.html.twig.
  *
- * @param array $variables
+ * @param array $vars
  *   An associative array containing:
  *   - view: A ViewExecutable object.
  *   - rows: The raw row data.
  */
-function template_preprocess_views_view_summary(&$variables) {
-  $view = $variables['view'];
+function template_preprocess_views_view_summary(&$vars) {
+  $view = $vars['view'];
   $argument = $view->argument[$view->build_info['summary_level']];
-  $variables['row_classes'] = array();
+  $vars['row_classes'] = array();
 
   $url_options = array();
 
@@ -402,13 +402,13 @@ function template_preprocess_views_view_summary(&$variables) {
   // could cause performance problems.
   $row_args = array();
 
-  foreach ($variables['rows'] as $id => $row) {
+  foreach ($vars['rows'] as $id => $row) {
     $row_args[$id] = $argument->summaryArgument($row);
   }
   $argument->processSummaryArguments($row_args);
 
-  foreach ($variables['rows'] as $id => $row) {
-    $variables['rows'][$id]->link = $argument->summaryName($row);
+  foreach ($vars['rows'] as $id => $row) {
+    $vars['rows'][$id]->link = $argument->summaryName($row);
     $args = $view->args;
     $args[$argument->position] = $row_args[$id];
 
@@ -416,13 +416,13 @@ function template_preprocess_views_view_summary(&$variables) {
     if (!empty($argument->options['summary_options']['base_path'])) {
       $base_path = $argument->options['summary_options']['base_path'];
     }
-    $variables['rows'][$id]->url = url($view->getUrl($args, $base_path), $url_options);
-    $variables['rows'][$id]->count = intval($row->{$argument->count_alias});
-    $variables['row_classes'][$id] = array();
-    if (isset($active_urls[$variables['rows'][$id]->url])) {
-      $variables['row_classes'][$id]['class'][] = 'active';
+    $vars['rows'][$id]->url = url($view->getUrl($args, $base_path), $url_options);
+    $vars['rows'][$id]->count = intval($row->{$argument->count_alias});
+    $vars['row_classes'][$id] = array();
+    if (isset($active_urls[$vars['rows'][$id]->url])) {
+      $vars['row_classes'][$id]['class'][] = 'active';
     }
-    $variables['row_classes'][$id] = new Attribute($variables['row_classes'][$id]);
+    $vars['row_classes'][$id] = new Attribute($vars['row_classes'][$id]);
   }
 }
 
@@ -431,7 +431,7 @@ function template_preprocess_views_view_summary(&$variables) {
  *
  * Default template: views-view-summary-unformatted.html.twig.
  *
- * @param array $variables
+ * @param array $vars
  *   An associative array containing:
  *   - view: A ViewExecutable object.
  *   - rows: The raw row data.
@@ -439,10 +439,10 @@ function template_preprocess_views_view_summary(&$variables) {
  *     - separator: A string to be placed between inline fields to keep them
  *       visually distinct.
  */
-function template_preprocess_views_view_summary_unformatted(&$variables) {
-  $view = $variables['view'];
+function template_preprocess_views_view_summary_unformatted(&$vars) {
+  $view = $vars['view'];
   $argument = $view->argument[$view->build_info['summary_level']];
-  $variables['row_classes'] = array();
+  $vars['row_classes'] = array();
 
   $url_options = array();
 
@@ -462,17 +462,17 @@ function template_preprocess_views_view_summary_unformatted(&$variables) {
   // by the validator. This is not done per single argument value, because
   // this could cause performance problems.
   $row_args = array();
-  foreach ($variables['rows'] as $id => $row) {
+  foreach ($vars['rows'] as $id => $row) {
     $row_args[$id] = $argument->summaryArgument($row);
   }
   $argument->processSummaryArguments($row_args);
 
-  foreach ($variables['rows'] as $id => $row) {
+  foreach ($vars['rows'] as $id => $row) {
     // Only false on first time.
     if ($count++) {
-      $variables['rows'][$id]->separator = filter_xss_admin($variables['options']['separator']);
+      $vars['rows'][$id]->separator = filter_xss_admin($vars['options']['separator']);
     }
-    $variables['rows'][$id]->link = $argument->summaryName($row);
+    $vars['rows'][$id]->link = $argument->summaryName($row);
     $args = $view->args;
     $args[$argument->position] = $row_args[$id];
 
@@ -480,13 +480,13 @@ function template_preprocess_views_view_summary_unformatted(&$variables) {
     if (!empty($argument->options['summary_options']['base_path'])) {
       $base_path = $argument->options['summary_options']['base_path'];
     }
-    $variables['rows'][$id]->url = url($view->getUrl($args, $base_path), $url_options);
-    $variables['rows'][$id]->count = intval($row->{$argument->count_alias});
-    $variables['row_classes'][$id] = array();
-    if (isset($active_urls[$variables['rows'][$id]->url])) {
-      $variables['row_classes'][$id]['class'][] = 'active';
+    $vars['rows'][$id]->url = url($view->getUrl($args, $base_path), $url_options);
+    $vars['rows'][$id]->count = intval($row->{$argument->count_alias});
+    $vars['row_classes'][$id] = array();
+    if (isset($active_urls[$vars['rows'][$id]->url])) {
+      $vars['row_classes'][$id]['class'][] = 'active';
     }
-    $variables['row_classes'][$id] = new Attribute($variables['row_classes'][$id]);
+    $vars['row_classes'][$id] = new Attribute($vars['row_classes'][$id]);
   }
 }
 
@@ -495,24 +495,24 @@ function template_preprocess_views_view_summary_unformatted(&$variables) {
  *
  * Default template: views-view-table.html.twig.
  *
- * @param array $variables
+ * @param array $vars
  *   An associative array containing:
  *   - view: A ViewExecutable object.
  *   - rows: The raw row data.
  */
-function template_preprocess_views_view_table(&$variables) {
-  $view = $variables['view'];
+function template_preprocess_views_view_table(&$vars) {
+  $view = $vars['view'];
 
   // We need the raw data for this grouping, which is passed in
-  // as $variables['rows'].
+  // as $vars['rows'].
   // However, the template also needs to use for the rendered fields.  We
-  // therefore swap the raw data out to a new variable and reset $variables['rows']
+  // therefore swap the raw data out to a new variable and reset $vars['rows']
   // so that it can get rebuilt.
   // Store rows so that they may be used by further preprocess functions.
-  $result = $variables['result'] = $variables['rows'];
-  $variables['rows'] = array();
-  $variables['field_classes'] = array();
-  $variables['header'] = array();
+  $result = $vars['result'] = $vars['rows'];
+  $vars['rows'] = array();
+  $vars['field_classes'] = array();
+  $vars['header'] = array();
 
   $options = $view->style_plugin->options;
   $handler = $view->style_plugin;
@@ -537,16 +537,16 @@ function template_preprocess_views_view_table(&$variables) {
   foreach ($columns as $field => $column) {
     // Create a second variable so we can easily find what fields we have and
     // what the CSS classes should be.
-    $variables['fields'][$field] = drupal_clean_css_identifier($field);
+    $vars['fields'][$field] = drupal_clean_css_identifier($field);
     if ($active == $field) {
-      $variables['fields'][$field] .= ' active';
+      $vars['fields'][$field] .= ' active';
     }
 
     // render the header labels
     if ($field == $column && empty($fields[$field]->options['exclude'])) {
       $label = check_plain(!empty($fields[$field]) ? $fields[$field]->label() : '');
       if (empty($options['info'][$field]['sortable']) || !$fields[$field]->clickSortable()) {
-        $variables['header'][$field] = $label;
+        $vars['header'][$field] = $label;
       }
       else {
         $initial = !empty($options['info'][$field]['default_sort_order']) ? $options['info'][$field]['default_sort_order'] : 'asc';
@@ -571,59 +571,59 @@ function template_preprocess_views_view_table(&$variables) {
           'attributes' => array('title' => $title),
           'query' => $query,
         );
-        $variables['header'][$field] = l($label, current_path(), $link_options);
+        $vars['header'][$field] = l($label, current_path(), $link_options);
       }
 
       // Set up the header label class.
-      $variables['header_classes'][$field] = array();
+      $vars['header_classes'][$field] = array();
       if ($fields[$field]->options['element_default_classes']) {
-        $variables['header_classes'][$field]['class'][] = 'views-field';
-        $variables['header_classes'][$field]['class'][] = 'views-field-' . $variables['fields'][$field];
+        $vars['header_classes'][$field]['class'][] = 'views-field';
+        $vars['header_classes'][$field]['class'][] = 'views-field-' . $vars['fields'][$field];
       }
-      $variables['header_classes'][$field] = new Attribute($variables['header_classes'][$field]);
+      $vars['header_classes'][$field] = new Attribute($vars['header_classes'][$field]);
       $class = $fields[$field]->elementLabelClasses(0);
       if ($class) {
-        $variables['header_classes'][$field]['class'][] = $class;
+        $vars['header_classes'][$field]['class'][] = $class;
       }
       // Add responsive header classes.
       if (!empty($options['info'][$field]['responsive'])) {
-        $variables['header_classes'][$field]['class'][] = $options['info'][$field]['responsive'];
+        $vars['header_classes'][$field]['class'][] = $options['info'][$field]['responsive'];
         $responsive = TRUE;
       }
       // Add a CSS align class to each field if one was set.
       if (!empty($options['info'][$field]['align'])) {
-        $variables['header_classes'][$field]['class'][] = drupal_clean_css_identifier($options['info'][$field]['align']);
+        $vars['header_classes'][$field]['class'][] = drupal_clean_css_identifier($options['info'][$field]['align']);
       }
       // Add a header label wrapper if one was selected.
-      if ($variables['header'][$field]) {
+      if ($vars['header'][$field]) {
         $element_label_type = $fields[$field]->elementLabelType(TRUE, TRUE);
         if ($element_label_type) {
-          $variables['header'][$field] = '<' . $element_label_type . '>' . $variables['header'][$field] . '</' . $element_label_type . '>';
+          $vars['header'][$field] = '<' . $element_label_type . '>' . $vars['header'][$field] . '</' . $element_label_type . '>';
         }
       }
     }
 
     // Add a CSS align class to each field if one was set.
     if (!empty($options['info'][$field]['align'])) {
-      $variables['fields'][$field] .= ' ' . drupal_clean_css_identifier($options['info'][$field]['align']);
+      $vars['fields'][$field] .= ' ' . drupal_clean_css_identifier($options['info'][$field]['align']);
     }
 
     // Render each field into its appropriate column.
     foreach ($result as $num => $row) {
       // Add field classes.
-      $variables['field_classes'][$field][$num] = array();
+      $vars['field_classes'][$field][$num] = array();
       if ($fields[$field]->options['element_default_classes']) {
-        $variables['field_classes'][$field][$num]['class'][] = 'views-field';
-        $variables['field_classes'][$field][$num]['class'][] = 'views-field-' . $variables['fields'][$field];
+        $vars['field_classes'][$field][$num]['class'][] = 'views-field';
+        $vars['field_classes'][$field][$num]['class'][] = 'views-field-' . $vars['fields'][$field];
       }
-      $variables['field_classes'][$field][$num] = new Attribute($variables['field_classes'][$field][$num]);
+      $vars['field_classes'][$field][$num] = new Attribute($vars['field_classes'][$field][$num]);
 
       if ($classes = $fields[$field]->elementClasses($num)) {
-        $variables['field_classes'][$field][$num]['class'][] = $classes;
+        $vars['field_classes'][$field][$num]['class'][] = $classes;
       }
       // Add responsive header classes.
       if (!empty($options['info'][$field]['responsive'])) {
-        $variables['field_classes'][$field][$num]['class'][] = $options['info'][$field]['responsive'];
+        $vars['field_classes'][$field][$num]['class'][] = $options['info'][$field]['responsive'];
       }
 
       if (!empty($fields[$field]) && empty($fields[$field]->options['exclude'])) {
@@ -634,20 +634,20 @@ function template_preprocess_views_view_table(&$variables) {
         }
 
         // Don't bother with separators and stuff if the field does not show up.
-        if (empty($field_output) && !empty($variables['rows'][$num][$column])) {
+        if (empty($field_output) && !empty($vars['rows'][$num][$column])) {
           continue;
         }
 
         // Place the field into the column, along with an optional separator.
-        if (!empty($variables['rows'][$num][$column])) {
+        if (!empty($vars['rows'][$num][$column])) {
           if (!empty($options['info'][$column]['separator'])) {
-            $variables['rows'][$num][$column] .= filter_xss_admin($options['info'][$column]['separator']);
+            $vars['rows'][$num][$column] .= filter_xss_admin($options['info'][$column]['separator']);
           }
         }
         else {
-          $variables['rows'][$num][$column] = '';
+          $vars['rows'][$num][$column] = '';
         }
-        $variables['rows'][$num][$column] .= $field_output;
+        $vars['rows'][$num][$column] .= $field_output;
       }
     }
 
@@ -655,83 +655,83 @@ function template_preprocess_views_view_table(&$variables) {
     // field is not empty.
     if (!empty($options['info'][$field]['empty_column'])) {
       $empty = TRUE;
-      foreach ($variables['rows'] as $num => $columns) {
+      foreach ($vars['rows'] as $num => $columns) {
         $empty &= empty($columns[$column]);
       }
       if ($empty) {
-        foreach ($variables['rows'] as $num => &$column_items) {
+        foreach ($vars['rows'] as $num => &$column_items) {
           unset($column_items[$column]);
-          unset($variables['header'][$column]);
+          unset($vars['header'][$column]);
         }
       }
     }
   }
 
   // Hide table header if all labels are empty.
-  if (!array_filter($variables['header'])) {
-    $variables['header'] = array();
+  if (!array_filter($vars['header'])) {
+    $vars['header'] = array();
   }
 
   $count = 0;
-  $variables['row_classes'] = array();
-  foreach ($variables['rows'] as $num => $row) {
-    $variables['row_classes'][$num] = array();
+  $vars['row_classes'] = array();
+  foreach ($vars['rows'] as $num => $row) {
+    $vars['row_classes'][$num] = array();
     if ($row_class_special) {
-      $variables['row_classes'][$num]['class'][] = ($count++ % 2 == 0) ? 'odd' : 'even';
+      $vars['row_classes'][$num]['class'][] = ($count++ % 2 == 0) ? 'odd' : 'even';
       if ($num === 0) {
-        $variables['row_classes'][$num]['class'][] = 'views-row-first';
+        $vars['row_classes'][$num]['class'][] = 'views-row-first';
       }
-      elseif ($num === (count($variables['rows']) - 1)) {
-        $variables['row_classes'][$num]['class'][] = 'views-row-last';
+      elseif ($num === (count($vars['rows']) - 1)) {
+        $vars['row_classes'][$num]['class'][] = 'views-row-last';
       }
     }
     if ($row_class = $handler->getRowClass($num)) {
-      $variables['row_classes'][$num]['class'][] = $row_class;
+      $vars['row_classes'][$num]['class'][] = $row_class;
     }
-    $variables['row_classes'][$num] = new Attribute($variables['row_classes'][$num]);
+    $vars['row_classes'][$num] = new Attribute($vars['row_classes'][$num]);
   }
 
-  $variables['attributes']['class'][] = 'views-table';
-  $variables['attributes']['class'][] = 'views-view-table';
-  if (empty($variables['rows']) && !empty($options['empty_table'])) {
+  $vars['attributes']['class'][] = 'views-table';
+  $vars['attributes']['class'][] = 'views-view-table';
+  if (empty($vars['rows']) && !empty($options['empty_table'])) {
     $build = $view->display_handler->renderArea('empty');
-    $variables['rows'][0][0] = drupal_render($build);
-    $variables['row_classes'][0] = new Attribute(array('class' => 'odd'));
+    $vars['rows'][0][0] = drupal_render($build);
+    $vars['row_classes'][0] = new Attribute(array('class' => 'odd'));
     // Calculate the amounts of rows with output.
-    $variables['field_classes'][0][0] = new Attribute(array(
-      'colspan' => count($variables['header']),
+    $vars['field_classes'][0][0] = new Attribute(array(
+      'colspan' => count($vars['header']),
       'class' => 'views-empty',
     ));
   }
 
   if (!empty($options['sticky'])) {
-    $variables['view']->element['#attached']['library'][] = array('system', 'drupal.tableheader');
-    $variables['attributes']['class'][] = "sticky-enabled";
+    $vars['view']->element['#attached']['library'][] = array('system', 'drupal.tableheader');
+    $vars['attributes']['class'][] = "sticky-enabled";
   }
-  $variables['attributes']['class'][] = 'cols-' . count($variables['header']);
+  $vars['attributes']['class'][] = 'cols-' . count($vars['header']);
 
   // Add the caption to the list if set.
   if (!empty($handler->options['caption'])) {
-    $variables['caption'] = Xss::filterAdmin($handler->options['caption']);
-    $variables['caption_needed'] = TRUE;
+    $vars['caption'] = Xss::filterAdmin($handler->options['caption']);
+    $vars['caption_needed'] = TRUE;
   }
   else {
-    $variables['caption'] = '';
-    $variables['caption_needed'] = FALSE;
+    $vars['caption'] = '';
+    $vars['caption_needed'] = FALSE;
   }
 
-  $variables['summary'] = $handler->options['summary'];
-  $variables['description'] = $handler->options['description'];
-  $variables['caption_needed'] |= !empty($variables['summary']) || !empty($variables['description']);
+  $vars['summary'] = $handler->options['summary'];
+  $vars['description'] = $handler->options['description'];
+  $vars['caption_needed'] |= !empty($vars['summary']) || !empty($vars['description']);
 
   // If the table has headers and it should react responsively to columns hidden
   // with the classes represented by the constants RESPONSIVE_PRIORITY_MEDIUM
   // and RESPONSIVE_PRIORITY_LOW, add the tableresponsive behaviors.
-  if (isset($variables['header']) && $responsive) {
-    $variables['view']->element['#attached']['library'][] = array('system', 'drupal.tableresponsive');
+  if (isset($vars['header']) && $responsive) {
+    $vars['view']->element['#attached']['library'][] = array('system', 'drupal.tableresponsive');
     // Add 'responsive-enabled' class to the table to identify it for JS.
     // This is needed to target tables constructed by this function.
-    $variables['attributes']['class'][] = 'responsive-enabled';
+    $vars['attributes']['class'][] = 'responsive-enabled';
   }
 }
 
@@ -740,108 +740,62 @@ function template_preprocess_views_view_table(&$variables) {
  *
  * Default template: views-view-grid.html.twig.
  *
- * @param array $variables
+ * @param array $vars
  *   An associative array containing:
  *   - view: The view object.
  *   - rows: An array of row items. Each row is an array of content.
  */
-function template_preprocess_views_view_grid(&$variables) {
-  $options = $variables['options'] = $variables['view']->style_plugin->options;
-  $horizontal = ($options['alignment'] === 'horizontal');
-
-  $variables['attributes']['class'] = array(
-    'views-view-grid',
-    $options['alignment'],
-    'cols-' . $options['columns'],
-    'clearfix',
-  );
-
-  $col = 0;
-  $row = 0;
-  $items = array();
-  $remainders = count($variables['rows']) % $options['columns'];
-  $num_rows = floor(count($variables['rows']) / $options['columns']);
-
-  // Iterate over each rendered views result row.
-  foreach ($variables['rows'] as $item) {
-
-    // Add the item.
-    if ($horizontal) {
-      $items[$row]['content'][$col]['content'] = $item;
-    }
-    else {
-      $items[$col]['content'][$row]['content'] = $item;
-    }
+function template_preprocess_views_view_grid(&$vars) {
+  $view = $vars['view'];
+  $options = $view->style_plugin->options;
+  $handler = $view->style_plugin;
+  $default_row_class = isset($options['default_row_class']) ? $options['default_row_class'] : TRUE;
+  $row_class_special = isset($options['row_class_special']) ? $options['row_class_special'] : TRUE;
 
-    // Create attributes for rows.
-    if (!$horizontal || ($horizontal && empty($items[$row]['attributes']))) {
-      $row_attributes = array('class' => array());
-      // Add default views row classes.
-      if ($options['row_class_default']) {
-        $row_attributes['class'][] = 'views-row';
-        $row_attributes['class'][] = 'row-' . ($row + 1);
-        if ($horizontal) {
-          $row_attributes['class'][] = 'clearfix';
-        }
-      }
-      // Add custom row classes.
-      $row_class = array_filter(explode(' ', $options['row_class_custom']));
-      if (!empty($row_class)) {
-        $row_attributes['class'] = array_merge($row_attributes['class'], $row_class);
-      }
-      // Add row attributes to the item.
-      if ($horizontal) {
-        $items[$row]['attributes'] = new Attribute($row_attributes);
-      }
-      else {
-        $items[$col]['content'][$row]['attributes'] = new Attribute($row_attributes);
+  $columns = $options['columns'];
+  $vars['attributes']['class'][] = 'views-view-grid cols-' . $columns;
+
+  $rows = array();
+  $row_indexes = array();
+
+  if ($options['alignment'] == 'horizontal') {
+    $row = array();
+    $col_count = 0;
+    $row_count = 0;
+    $count = 0;
+    foreach ($vars['rows'] as $row_index => $item) {
+      $count++;
+      $row[] = $item;
+      $row_indexes[$row_count][$col_count] = $row_index;
+      $col_count++;
+      if ($count % $columns == 0) {
+        $rows[] = $row;
+        $row = array();
+        $col_count = 0;
+        $row_count++;
       }
     }
-
-    // Create attributes for columns.
-    if ($horizontal || (!$horizontal && empty($items[$col]['attributes']))) {
-      $col_attributes = array('class' => array());
-      // Add default views column classes.
-      if ($options['col_class_default']) {
-        $col_attributes['class'][] = 'views-col';
-        $col_attributes['class'][] = 'col-' . ($col + 1);
-        if (!$horizontal) {
-          $col_attributes['class'][] = 'clearfix';
+    if ($row) {
+      // Fill up the last line only if it's configured, but this is default.
+      if (!empty($handler->options['fill_single_line']) && count($rows)) {
+        for ($i = 0; $i < ($columns - $col_count); $i++) {
+          $row[] = '';
         }
       }
-      // Add custom column classes.
-      $col_class = array_filter(explode(' ', $options['col_class_custom']));
-      if (!empty($col_class)) {
-        $col_attributes['class'] = array_merge($col_attributes['class'], $col_class);
-      }
-      // Add automatic width for columns.
-      if ($options['automatic_width']) {
-        $col_attributes['style'] = 'width: ' . (100 / $options['columns']) . '%;';
-      }
-      // Add column attributes to the item.
-      if ($horizontal) {
-        $items[$row]['content'][$col]['attributes'] = new Attribute($col_attributes);
-      }
-      else {
-        $items[$col]['attributes'] = new Attribute($col_attributes);
-      }
-    }
-
-    // Increase, decrease or reset appropriate integers.
-    if ($horizontal) {
-      if ($col == 0 && $col != ($options['columns'] - 1)) {
-        $col++;
-      }
-      elseif ($col >= ($options['columns'] - 1)) {
-        $col = 0;
-        $row++;
-      }
-      else {
-        $col++;
-      }
+      $rows[] = $row;
     }
-    else {
+  }
+  else {
+    $num_rows = floor(count($vars['rows']) / $columns);
+    // The remainders are the 'odd' columns that are slightly longer.
+    $remainders = count($vars['rows']) % $columns;
+    $row = 0;
+    $col = 0;
+    foreach ($vars['rows'] as $count => $item) {
+      $rows[$row][$col] = $item;
+      $row_indexes[$row][$col] = $count;
       $row++;
+
       if (!$remainders && $row == $num_rows) {
         $row = 0;
         $col++;
@@ -852,10 +806,53 @@ function template_preprocess_views_view_grid(&$variables) {
         $remainders--;
       }
     }
+    for ($i = 0; $i < count($rows[0]); $i++) {
+      // This should be a string so this is ok.
+      if (!isset($rows[count($rows) - 1][$i])) {
+        $rows[count($rows) - 1][$i] = '';
+      }
+    }
   }
 
-  // Add items to the variables array.
-  $variables['items'] = $items;
+  // Apply the row classes.
+  foreach ($rows as $row_number => $row) {
+    $row_classes = array();
+    if ($default_row_class) {
+      $row_classes['class'][] = 'row-' . ($row_number + 1);
+    }
+    if ($row_class_special) {
+      if ($row_number == 0) {
+        $row_classes['class'][] = 'row-first';
+      }
+      if (count($rows) == ($row_number + 1)) {
+        $row_classes['class'][] = 'row-last';
+      }
+    }
+    $row_classes = new Attribute($row_classes);
+
+    foreach ($rows[$row_number] as $column_number => $item) {
+      $vars['column_classes'][$row_number][$column_number] = array();
+      if ($default_row_class) {
+        $vars['column_classes'][$row_number][$column_number]['class'][] = 'col-' . ($column_number + 1);
+      }
+      if ($row_class_special) {
+        if ($column_number == 0) {
+          $vars['column_classes'][$row_number][$column_number]['class'][] = 'col-first';
+        }
+        elseif (count($rows[$row_number]) == ($column_number + 1)) {
+          $vars['column_classes'][$row_number][$column_number]['class'][] = 'col-last';
+        }
+      }
+      if (isset($row_indexes[$row_number][$column_number]) && $column_class = $view->style_plugin->getRowClass($row_indexes[$row_number][$column_number])) {
+        $vars['column_classes'][$row_number][$column_number]['class'][] = $column_class;
+      }
+      $vars['column_classes'][$row_number][$column_number] = new Attribute($vars['column_classes'][$row_number][$column_number]);
+    }
+  }
+  $vars['rows'] = $rows;
+  if (!empty($handler->options['summary'])) {
+    $vars['attributes']['summary'] = $handler->options['summary'];
+  }
 }
 
 /**
@@ -863,45 +860,45 @@ function template_preprocess_views_view_grid(&$variables) {
  *
  * Default template: views-view-unformatted.html.twig.
  *
- * @param array $variables
+ * @param array $vars
  *   An associative array containing:
  *   - view: The view object.
  *   - rows: An array of row items. Each row is an array of content.
  */
-function template_preprocess_views_view_unformatted(&$variables) {
-  $view = $variables['view'];
-  $rows = $variables['rows'];
+function template_preprocess_views_view_unformatted(&$vars) {
+  $view = $vars['view'];
+  $rows = $vars['rows'];
   $style = $view->style_plugin;
   $options = $style->options;
 
-  $variables['row_classes'] = array();
-  $variables['classes'] = array();
+  $vars['row_classes'] = array();
+  $vars['classes'] = array();
   $default_row_class = isset($options['default_row_class']) ? $options['default_row_class'] : FALSE;
   $row_class_special = isset($options['row_class_special']) ? $options['row_class_special'] : FALSE;
   // Set up striping values.
   $count = 0;
   $max = count($rows);
   foreach ($rows as $id => $row) {
-    $variables['row_classes'][$id] = array();
+    $vars['row_classes'][$id] = array();
     $count++;
     if ($default_row_class) {
-      $variables['row_classes'][$id]['class'][] = 'views-row';
-      $variables['row_classes'][$id]['class'][] = 'views-row-' . $count;
+      $vars['row_classes'][$id]['class'][] = 'views-row';
+      $vars['row_classes'][$id]['class'][] = 'views-row-' . $count;
     }
     if ($row_class_special) {
-      $variables['row_classes'][$id]['class'][] = 'views-row-' . ($count % 2 ? 'odd' : 'even');
+      $vars['row_classes'][$id]['class'][] = 'views-row-' . ($count % 2 ? 'odd' : 'even');
       if ($count == 1) {
-        $variables['row_classes'][$id]['class'][] = 'views-row-first';
+        $vars['row_classes'][$id]['class'][] = 'views-row-first';
       }
       if ($count == $max) {
-        $variables['row_classes'][$id]['class'][] = 'views-row-last';
+        $vars['row_classes'][$id]['class'][] = 'views-row-last';
       }
     }
 
     if ($row_class = $view->style_plugin->getRowClass($id)) {
-      $variables['row_classes'][$id]['class'][] = $row_class;
+      $vars['row_classes'][$id]['class'][] = $row_class;
     }
-    $variables['row_classes'][$id] = new Attribute($variables['row_classes'][$id]);
+    $vars['row_classes'][$id] = new Attribute($vars['row_classes'][$id]);
   }
 }
 
@@ -942,16 +939,16 @@ function template_preprocess_views_view_list(&$variables) {
  *
  * Default template: views-view-rss.html.twig.
  *
- * @param array $variables
+ * @param array $vars
  *   An associative array containing:
  *   - view: A ViewExecutable object.
  *   - rows: The raw row data.
 */
-function template_preprocess_views_view_rss(&$variables) {
+function template_preprocess_views_view_rss(&$vars) {
   global $base_url;
 
-  $view = $variables['view'];
-  $items = $variables['rows'];
+  $view = $vars['view'];
+  $items = $vars['rows'];
 
   $style = $view->style_plugin;
 
@@ -960,7 +957,7 @@ function template_preprocess_views_view_rss(&$variables) {
   // The RSS 2.0 "spec" doesn't indicate HTML can be used in the description.
   // We strip all HTML tags, but need to prevent double encoding from properly
   // escaped source data (such as &amp becoming &amp;amp;).
-  $variables['description'] = check_plain(decode_entities(strip_tags($style->getDescription())));
+  $vars['description'] = check_plain(decode_entities(strip_tags($style->getDescription())));
 
   if ($view->display_handler->getOption('sitename_title')) {
     $title = $config->get('name');
@@ -971,7 +968,7 @@ function template_preprocess_views_view_rss(&$variables) {
   else {
     $title = $view->getTitle();
   }
-  $variables['title'] = check_plain($title);
+  $vars['title'] = check_plain($title);
 
   // Figure out which display which has a path we're using for this feed. If
   // there isn't one, use the global $base_url
@@ -993,18 +990,18 @@ function template_preprocess_views_view_rss(&$variables) {
       $path = '';
     }
 
-    $variables['link'] = check_url(url($path, $url_options));
+    $vars['link'] = check_url(url($path, $url_options));
   }
 
-  $variables['langcode'] = check_plain(language(Language::TYPE_INTERFACE)->id);
-  $variables['namespaces'] = new Attribute($style->namespaces);
-  $variables['items'] = $items;
-  $variables['channel_elements'] = format_xml_elements($style->channel_elements);
+  $vars['langcode'] = check_plain(language(Language::TYPE_INTERFACE)->id);
+  $vars['namespaces'] = new Attribute($style->namespaces);
+  $vars['items'] = $items;
+  $vars['channel_elements'] = format_xml_elements($style->channel_elements);
 
   // During live preview we don't want to output the header since the contents
   // of the feed are being displayed inside a normal HTML page.
-  if (empty($variables['view']->live_preview)) {
-    $variables['view']->getResponse()->headers->set('Content-Type', 'application/rss+xml; charset=utf-8');
+  if (empty($vars['view']->live_preview)) {
+    $vars['view']->getResponse()->headers->set('Content-Type', 'application/rss+xml; charset=utf-8');
   }
 }
 
@@ -1013,17 +1010,17 @@ function template_preprocess_views_view_rss(&$variables) {
  *
  * Default template: views-view-row-rss.html.twig.
  *
- * @param array $variables
+ * @param array $vars
  *   An associative array containing:
  *   - row: The raw results rows.
  */
-function template_preprocess_views_view_row_rss(&$variables) {
-  $item = $variables['row'];
+function template_preprocess_views_view_row_rss(&$vars) {
+  $item = $vars['row'];
 
-  $variables['title'] = check_plain($item->title);
-  $variables['link'] = check_url($item->link);
-  $variables['description'] = check_plain($item->description);
-  $variables['item_elements'] = empty($item->elements) ? '' : format_xml_elements($item->elements);
+  $vars['title'] = check_plain($item->title);
+  $vars['link'] = check_url($item->link);
+  $vars['description'] = check_plain($item->description);
+  $vars['item_elements'] = empty($item->elements) ? '' : format_xml_elements($item->elements);
 }
 
 /**
@@ -1031,24 +1028,59 @@ function template_preprocess_views_view_row_rss(&$variables) {
  *
  * Default template: views-exposed-form.html.twig.
  *
- * @param array $variables
+ * @param array $vars
  *   An associative array containing:
  *   - form: A render element representing the form.
  */
-function template_preprocess_views_exposed_form(&$variables) {
-  $form = &$variables['form'];
+function template_preprocess_views_exposed_form(&$vars) {
+  $form = &$vars['form'];
+
+  // Put all single checkboxes together in the last spot.
+  $checkboxes = array();
 
   if (!empty($form['q'])) {
-    $variables['q'] = $form['q'];
+    $vars['q'] = $form['q'];
   }
 
-  // Include basic theming for exposed forms.
-  $form['#attached']['library'][] = array('views', 'views.exposed-form');
-
+  $vars['widgets'] = array();
   foreach ($form['#info'] as $id => $info) {
+    // Set aside checkboxes.
+    if (isset($form[$info['value']]['#type']) && $form[$info['value']]['#type'] == 'checkbox') {
+      $checkboxes[] = $form[$info['value']];
+      continue;
+    }
+    $widget = new stdClass();
+    // set up defaults so that there's always something there.
+    $widget->label = $widget->operator = $widget->widget = $widget->description = '';
+
+    $widget->id = isset($form[$info['value']]['#id']) ? $form[$info['value']]['#id'] : '';
+
     if (!empty($info['label'])) {
-      $form[$info['value']]['#title'] = $info['label'];
+      $widget->label = check_plain($info['label']);
+    }
+    if (!empty($info['operator']) && isset($form[$info['operator']])) {
+      $widget->operator = $form[$info['operator']];
     }
+
+    $widget->widget = $form[$info['value']];
+
+    if (!empty($info['description'])) {
+      $widget->description = check_plain($info['description']);
+    }
+
+    $vars['widgets'][$id] = $widget;
+    // Unset the widget, so that it doesn't get rendered twice.
+    unset($form[$info['value']]);
+  }
+
+  // Wrap up all the checkboxes we set aside into a widget.
+  if (!empty($checkboxes)) {
+    $widget = new stdClass();
+    // set up defaults so that there's always something there.
+    $widget->label = $widget->operator = $widget->widget = NULL;
+    $widget->id = 'checkboxes';
+    $widget->widget = $checkboxes;
+    $vars['widgets']['checkboxes'] = $widget;
   }
 }
 
@@ -1087,12 +1119,12 @@ function theme_views_form_views_form($variables) {
 /**
  * Theme function for the Mini pager.
  */
-function theme_views_mini_pager($variables) {
+function theme_views_mini_pager($vars) {
   global $pager_page_array, $pager_total;
 
-  $tags = &$variables['tags'];
-  $element = $variables['element'];
-  $parameters = $variables['parameters'];
+  $tags = &$vars['tags'];
+  $element = $vars['element'];
+  $parameters = $vars['parameters'];
 
   // Fill in default link labels.
   $tags += array(
diff --git a/core/modules/views_ui/admin.inc b/core/modules/views_ui/admin.inc
index c27e42c..192d0ca 100644
--- a/core/modules/views_ui/admin.inc
+++ b/core/modules/views_ui/admin.inc
@@ -275,15 +275,6 @@ function views_ui_pre_render_add_fieldset_markup($form) {
     }
   }
 
-  // Hide the fieldsets if there is nothing in there.
-  if (isset($form['fieldsets']['#value'])) {
-    foreach ($form['fieldsets']['#value'] as $fieldset) {
-      if (!element_children($form[$fieldset])) {
-        $form[$fieldset]['#access'] = FALSE;
-      }
-    }
-  }
-
   return $form;
 }
 
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/AddItem.php b/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/AddItem.php
index 8f20c54..a1907ab 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/AddItem.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/AddItem.php
@@ -61,7 +61,9 @@ public function buildForm(array $form, array &$form_state) {
     );
 
     $executable = $view->get('executable');
-    $executable->setDisplay($display_id);
+    if (!$executable->setDisplay($display_id)) {
+      views_ajax_error(t('Invalid display id @display', array('@display' => $display_id)));
+    }
     $display = &$executable->displayHandlers->get($display_id);
 
     $types = ViewExecutable::viewsHandlerTypes();
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/ConfigItem.php b/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/ConfigItem.php
index 5aa0039..aeb5295 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/ConfigItem.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/ConfigItem.php
@@ -65,7 +65,9 @@ public function buildForm(array $form, array &$form_state) {
     );
     $executable = $view->get('executable');
     $save_ui_cache = FALSE;
-    $executable->setDisplay($display_id);
+    if (!$executable->setDisplay($display_id)) {
+      views_ajax_error(t('Invalid display id @display', array('@display' => $display_id)));
+    }
     $item = $executable->getItem($display_id, $type, $id);
 
     if ($item) {
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/ConfigItemExtra.php b/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/ConfigItemExtra.php
index 4b8a3bd..14895f8 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/ConfigItemExtra.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/ConfigItemExtra.php
@@ -63,7 +63,9 @@ public function buildForm(array $form, array &$form_state) {
       ),
     );
     $executable = $view->get('executable');
-    $executable->setDisplay($display_id);
+    if (!$executable->setDisplay($display_id)) {
+      views_ajax_error(t('invalid display id @display', array('@display' => $display_id)));
+    }
     $item = $executable->getItem($display_id, $type, $id);
 
     if ($item) {
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/Display.php b/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/Display.php
index d1151ea..d8c1e9a 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/Display.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/Display.php
@@ -64,7 +64,9 @@ public function buildForm(array $form, array &$form_state) {
     $section = $form_state['section'];
 
     $executable = $view->get('executable');
-    $executable->setDisplay($display_id);
+    if (!$executable->setDisplay($display_id)) {
+      views_ajax_error(t('Invalid display id @display', array('@display' => $display_id)));
+    }
     $display = &$executable->display[$display_id];
 
     // Get form from the handler.
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/Rearrange.php b/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/Rearrange.php
index c8d8a94..170182b 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/Rearrange.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/Rearrange.php
@@ -54,7 +54,9 @@ public function buildForm(array $form, array &$form_state) {
 
     $types = ViewExecutable::viewsHandlerTypes();
     $executable = $view->get('executable');
-    $executable->setDisplay($display_id);
+    if (!$executable->setDisplay($display_id)) {
+      views_ajax_error(t('Invalid display id @display', array('@display' => $display_id)));
+    }
     $display = &$executable->displayHandlers->get($display_id);
     $form['#title'] = t('Rearrange @type', array('@type' => $types[$type]['ltitle']));
     $form['#section'] = $display_id . 'rearrange-item';
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Form/BasicSettingsForm.php b/core/modules/views_ui/lib/Drupal/views_ui/Form/BasicSettingsForm.php
index bfac4e6..9631e38 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/Form/BasicSettingsForm.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/Form/BasicSettingsForm.php
@@ -56,7 +56,7 @@ public function buildForm(array $form, array &$form_state) {
     $form['basic']['ui_show_display_embed'] = array(
       '#type' => 'checkbox',
       '#title' => t('Show the embed display in the ui.'),
-      '#description' => t("Allow advanced user to use the embed view display. The plugin itself works if it's not visible in the ui"),
+      '#description' => t('Allow advanced user to use the embed view display. The plugin itself works if it\'s not visible in the ui'),
       '#default_value' => $config->get('ui.show.display_embed'),
     );
 
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Plugin/Menu/LocalAction/AddViewLocalAction.php b/core/modules/views_ui/lib/Drupal/views_ui/Plugin/Menu/LocalAction/AddViewLocalAction.php
deleted file mode 100644
index 406107f..0000000
--- a/core/modules/views_ui/lib/Drupal/views_ui/Plugin/Menu/LocalAction/AddViewLocalAction.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\views_ui\Plugin\Menu\AddViewLocalAction.
- */
-
-namespace Drupal\views_ui\Plugin\Menu\LocalAction;
-
-use Drupal\Core\Annotation\Translation;
-use Drupal\Core\Menu\LocalActionBase;
-use Drupal\Core\Annotation\Menu\LocalAction;
-
-/**
- * @LocalAction(
- *   id = "views_add_local_action",
- *   route_name = "views_ui.add",
- *   title = @Translation("Add new view"),
- *   appears_on = {"views_ui.list"}
- * )
- */
-class AddViewLocalAction extends LocalActionBase {
-
-}
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Plugin/Menu/LocalTask/ViewsListTask.php b/core/modules/views_ui/lib/Drupal/views_ui/Plugin/Menu/LocalTask/ViewsListTask.php
deleted file mode 100644
index f1237fc..0000000
--- a/core/modules/views_ui/lib/Drupal/views_ui/Plugin/Menu/LocalTask/ViewsListTask.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\views_ui\Plugin\Menu\LocalTask\ViewsListTask.
- */
-
-namespace Drupal\views_ui\Plugin\Menu\LocalTask;
-
-use Drupal\Core\Annotation\Translation;
-use Drupal\Core\Menu\LocalTaskBase;
-use Drupal\Core\Annotation\Menu\LocalTask;
-
-
-/**
- * @LocalTask(
- *   id = "views_ui_list_tab",
- *   route_name = "views_ui.list",
- *   title = @Translation("List"),
- *   tab_root_id = "views_ui_list_tab"
- * )
- */
-class ViewsListTask extends LocalTaskBase {
-
-}
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Plugin/Menu/LocalTask/ViewsSettingsAdvancedTask.php b/core/modules/views_ui/lib/Drupal/views_ui/Plugin/Menu/LocalTask/ViewsSettingsAdvancedTask.php
deleted file mode 100644
index 4ab9b77..0000000
--- a/core/modules/views_ui/lib/Drupal/views_ui/Plugin/Menu/LocalTask/ViewsSettingsAdvancedTask.php
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\views_ui\Plugin\Menu\LocalTask\ViewsSettingsAdvancedTas.
- */
-
-namespace Drupal\views_ui\Plugin\Menu\LocalTask;
-
-use Drupal\Core\Annotation\Translation;
-use Drupal\Core\Menu\LocalTaskBase;
-use Drupal\Core\Annotation\Menu\LocalTask;
-
-/**
- * @LocalTask(
- *   id = "views_ui_settings_advanced_tab",
- *   route_name = "views_ui.settings.advanced",
- *   title = @Translation("Advanced"),
- *   tab_root_id = "views_ui_list_tab",
- *   tab_parent_id = "views_ui_settings_tab",
- *   weight = "10"
- * )
- */
-class ViewsSettingsAdvancedTask extends LocalTaskBase {
-
-}
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Plugin/Menu/LocalTask/ViewsSettingsBasicTask.php b/core/modules/views_ui/lib/Drupal/views_ui/Plugin/Menu/LocalTask/ViewsSettingsBasicTask.php
deleted file mode 100644
index c8d454f..0000000
--- a/core/modules/views_ui/lib/Drupal/views_ui/Plugin/Menu/LocalTask/ViewsSettingsBasicTask.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\views_ui\Plugin\Menu\LocalTask\ViewsSettingsBasicTask.
- */
-
-namespace Drupal\views_ui\Plugin\Menu\LocalTask;
-
-use Drupal\Core\Annotation\Translation;
-use Drupal\Core\Menu\LocalTaskBase;
-use Drupal\Core\Annotation\Menu\LocalTask;
-
-/**
- * @LocalTask(
- *   id = "views_ui_settings_basic_tab",
- *   route_name = "views_ui.settings.basic",
- *   title = @Translation("Basic"),
- *   tab_root_id = "views_ui_list_tab",
- *   tab_parent_id = "views_ui_settings_tab"
- * )
- */
-class ViewsSettingsBasicTask extends LocalTaskBase {
-
-}
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Plugin/Menu/LocalTask/ViewsSettingsTask.php b/core/modules/views_ui/lib/Drupal/views_ui/Plugin/Menu/LocalTask/ViewsSettingsTask.php
deleted file mode 100644
index 9dddf80..0000000
--- a/core/modules/views_ui/lib/Drupal/views_ui/Plugin/Menu/LocalTask/ViewsSettingsTask.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\views_ui\Plugin\Menu\LocalTask\ViewsSettingsTask.
- */
-
-namespace Drupal\views_ui\Plugin\Menu\LocalTask;
-
-use Drupal\Core\Annotation\Translation;
-use Drupal\Core\Menu\LocalTaskBase;
-use Drupal\Core\Annotation\Menu\LocalTask;
-
-/**
- * @LocalTask(
- *   id = "views_ui_settings_tab",
- *   route_name = "views_ui.settings.basic",
- *   title = @Translation("Settings"),
- *   tab_root_id = "views_ui_list_tab"
- * )
- */
-class ViewsSettingsTask extends LocalTaskBase {
-
-}
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Tests/ExposedFormUITest.php b/core/modules/views_ui/lib/Drupal/views_ui/Tests/ExposedFormUITest.php
index 9024d36..5757bcd 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/Tests/ExposedFormUITest.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/Tests/ExposedFormUITest.php
@@ -84,7 +84,7 @@ function testExposedAdminUi() {
     // Now check the sort criteria.
     $this->drupalGet('admin/structure/views/nojs/config-item/test_exposed_admin_ui/default/sort/created');
     $this->helperButtonHasLabel('edit-options-expose-button-button', t('Expose sort'));
-    $this->assertNoFieldById('edit-options-expose-label', '', 'Make sure no label field is shown');
+    $this->assertNoFieldById('edit-options-expose-label', '', t('Make sure no label field is shown'));
 
     // Click the Grouped Filters button.
     $this->drupalGet('admin/structure/views/nojs/config-item/test_exposed_admin_ui/default/filter/type');
@@ -140,7 +140,7 @@ function testExposedAdminUi() {
     $edit["options[group_info][group_items][3][value][article]"] = TRUE;
     $edit["options[group_info][group_items][3][value][page]"] = TRUE;
     $this->drupalPost(NULL, $edit, t('Apply'));
-    $this->assertRaw(t('The title is required if value for this item is defined.'), 'Group items should have a title');
+    $this->assertRaw(t('The title is required if value for this item is defined.'), t('Group items should have a title'));
 
     // Un-expose the filter.
     $this->drupalGet('admin/structure/views/nojs/config-item/test_exposed_admin_ui/default/filter/type');
@@ -157,6 +157,6 @@ function testExposedAdminUi() {
     $this->drupalPost('admin/structure/views/nojs/config-item/test_exposed_admin_ui/default/sort/created', $edit, t('Expose sort'));
     // Check the label of the expose button.
     $this->helperButtonHasLabel('edit-options-expose-button-button', t('Hide sort'));
-    $this->assertFieldById('edit-options-expose-label', '', 'Make sure a label field is shown');
+    $this->assertFieldById('edit-options-expose-label', '', t('Make sure a label field is shown'));
   }
 }
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/ViewUI.php b/core/modules/views_ui/lib/Drupal/views_ui/ViewUI.php
index e3538e6..92fa27b 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/ViewUI.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/ViewUI.php
@@ -775,7 +775,7 @@ public function cacheSet() {
    *   TRUE if the view is locked, FALSE otherwise.
    */
   public function isLocked() {
-    return is_object($this->lock) && ($this->lock->owner != $GLOBALS['user']->id());
+    return is_object($this->lock) && ($this->lock->owner != $GLOBALS['user']->uid);
   }
 
   /**
diff --git a/core/modules/views_ui/views_ui.module b/core/modules/views_ui/views_ui.module
index b208d92..4ce0595 100644
--- a/core/modules/views_ui/views_ui.module
+++ b/core/modules/views_ui/views_ui.module
@@ -25,23 +25,29 @@ function views_ui_menu() {
     'route_name' => 'views_ui.list',
   );
 
+  $items['admin/structure/views/list'] = array(
+    'title' => 'List',
+    'type' => MENU_DEFAULT_LOCAL_TASK,
+  );
+
   $items['admin/structure/views/add'] = array(
     'route_name' => 'views_ui.add',
     'type' => MENU_SIBLING_LOCAL_TASK,
   );
 
-  // @todo - remove all items of type MENU_VISIBLE_IN_BREADCRUMB
-  // when there is a route-aware breadcrumb builder.
   $items['admin/structure/views/settings'] = array(
     'title' => 'Settings',
     'route_name' => 'views_ui.settings.basic',
-    'type' => MENU_VISIBLE_IN_BREADCRUMB,
+    'type' => MENU_LOCAL_TASK,
+  );
+  $items['admin/structure/views/settings/basic'] = array(
+    'title' => 'Basic',
+    'type' => MENU_DEFAULT_LOCAL_TASK,
   );
-
   $items['admin/structure/views/settings/advanced'] = array(
     'title' => 'Advanced',
     'route_name' => 'views_ui.settings.advanced',
-    'type' => MENU_VISIBLE_IN_BREADCRUMB,
+    'type' => MENU_LOCAL_TASK,
   );
 
   // The primary Edit View page. Secondary tabs for each Display are added in
@@ -109,6 +115,21 @@ function views_ui_entity_info(&$entity_info) {
 }
 
 /**
+ * Implements hook_local_actions().
+ */
+function views_ui_local_actions() {
+  return array(
+    array(
+      'route_name' => 'views_ui.add',
+      'title' => t('Add new view'),
+      'appears_on' => array(
+        'views_ui.list',
+      ),
+    ),
+  );
+}
+
+/**
  * Implements hook_theme().
  */
 function views_ui_theme() {
@@ -212,21 +233,21 @@ function views_ui_library_info() {
 /**
  * Implements hook_preprocess_HOOK() for views-view.html.twig.
  */
-function views_ui_preprocess_views_view(&$variables) {
-  $view = $variables['view'];
+function views_ui_preprocess_views_view(&$vars) {
+  $view = $vars['view'];
   if (!empty($view->live_preview) && Drupal::moduleHandler()->moduleExists('contextual')) {
     $view->setShowAdminLinks(FALSE);
     foreach (array('title', 'header', 'exposed', 'rows', 'pager', 'more', 'footer', 'empty', 'attachment_after', 'attachment_before') as $section) {
-      if (!empty($variables[$section])) {
-        $variables[$section] = array(
+      if (!empty($vars[$section])) {
+        $vars[$section] = array(
           '#theme' => 'views_ui_view_preview_section',
           '#view' => $view,
           '#section' => $section,
-          '#content' => $variables[$section],
+          '#content' => $vars[$section],
           '#theme_wrappers' => array('views_ui_container'),
           '#attributes' => array('class' => 'contextual-region'),
         );
-        $variables[$section] = $variables[$section];
+        $vars[$section] = $vars[$section];
       }
     }
   }
diff --git a/core/modules/views_ui/views_ui.theme.inc b/core/modules/views_ui/views_ui.theme.inc
index d998763..e0ac755 100644
--- a/core/modules/views_ui/views_ui.theme.inc
+++ b/core/modules/views_ui/views_ui.theme.inc
@@ -227,8 +227,8 @@ function theme_views_ui_build_group_filter_form($variables) {
 /**
  * Turn the rearrange form into a proper table
  */
-function theme_views_ui_rearrange_filter_form(&$variables) {
-  $form = $variables['form'];
+function theme_views_ui_rearrange_filter_form(&$vars) {
+  $form = $vars['form'];
   $rows = $ungroupable_rows = array();
   // Enable grouping only if > 1 group.
   $grouping = count(array_keys($form['#group_options'])) > 1;
@@ -428,49 +428,49 @@ function theme_views_ui_style_plugin_table($variables) {
  *   - view: The view object.
  *   - section: The section name of a View (e.g. title, rows or pager).
  */
-function template_preprocess_views_ui_view_preview_section(&$variables) {
-  switch ($variables['section']) {
+function template_preprocess_views_ui_view_preview_section(&$vars) {
+  switch ($vars['section']) {
     case 'title':
-      $variables['title'] = t('Title');
-      $links = views_ui_view_preview_section_display_category_links($variables['view'], 'title', $variables['title']);
+      $vars['title'] = t('Title');
+      $links = views_ui_view_preview_section_display_category_links($vars['view'], 'title', $vars['title']);
       break;
     case 'header':
-      $variables['title'] = t('Header');
-      $links = views_ui_view_preview_section_handler_links($variables['view'], $variables['section']);
+      $vars['title'] = t('Header');
+      $links = views_ui_view_preview_section_handler_links($vars['view'], $vars['section']);
       break;
     case 'empty':
-      $variables['title'] = t('No results behavior');
-      $links = views_ui_view_preview_section_handler_links($variables['view'], $variables['section']);
+      $vars['title'] = t('No results behavior');
+      $links = views_ui_view_preview_section_handler_links($vars['view'], $vars['section']);
       break;
     case 'exposed':
       // @todo Sorts can be exposed too, so we may need a better title.
-      $variables['title'] = t('Exposed Filters');
-      $links = views_ui_view_preview_section_display_category_links($variables['view'], 'exposed_form_options', $variables['title']);
+      $vars['title'] = t('Exposed Filters');
+      $links = views_ui_view_preview_section_display_category_links($vars['view'], 'exposed_form_options', $vars['title']);
       break;
     case 'rows':
       // @todo The title needs to depend on what is being viewed.
-      $variables['title'] = t('Content');
-      $links = views_ui_view_preview_section_rows_links($variables['view']);
+      $vars['title'] = t('Content');
+      $links = views_ui_view_preview_section_rows_links($vars['view']);
       break;
     case 'pager':
-      $variables['title'] = t('Pager');
-      $links = views_ui_view_preview_section_display_category_links($variables['view'], 'pager_options', $variables['title']);
+      $vars['title'] = t('Pager');
+      $links = views_ui_view_preview_section_display_category_links($vars['view'], 'pager_options', $vars['title']);
       break;
     case 'more':
-      $variables['title'] = t('More');
-      $links = views_ui_view_preview_section_display_category_links($variables['view'], 'use_more', $variables['title']);
+      $vars['title'] = t('More');
+      $links = views_ui_view_preview_section_display_category_links($vars['view'], 'use_more', $vars['title']);
       break;
     case 'footer':
-      $variables['title'] = t('Footer');
-      $links = views_ui_view_preview_section_handler_links($variables['view'], $variables['section']);
+      $vars['title'] = t('Footer');
+      $links = views_ui_view_preview_section_handler_links($vars['view'], $vars['section']);
       break;
     case 'attachment_before':
       // @todo: Add links to the attachment configuration page.
-      $variables['title'] = t('Attachment before');
+      $vars['title'] = t('Attachment before');
       break;
     case 'attachment_after':
       // @todo: Add links to the attachment configuration page.
-      $variables['title'] = t('Attachment after');
+      $vars['title'] = t('Attachment after');
       break;
   }
 
@@ -483,7 +483,7 @@ function template_preprocess_views_ui_view_preview_section(&$variables) {
         'library' => array(array('contextual', 'drupal.contextual-links')),
       ),
     );
-    $variables['links'] = $build;
+    $vars['links'] = $build;
   }
-  $variables['theme_hook_suggestions'][] = 'views_ui_view_preview_section__' . $variables['section'];
+  $vars['theme_hook_suggestions'][] = 'views_ui_view_preview_section__' . $vars['section'];
 }
diff --git a/core/profiles/standard/config/rdf.mapping.comment.comment_node_article.yml b/core/profiles/standard/config/rdf.mapping.comment.comment_node_article.yml
index 3a7ecaa..487fe5d 100644
--- a/core/profiles/standard/config/rdf.mapping.comment.comment_node_article.yml
+++ b/core/profiles/standard/config/rdf.mapping.comment.comment_node_article.yml
@@ -2,23 +2,34 @@ id: comment.comment_node_article
 targetEntityType: comment
 bundle: comment_node_article
 types:
-  - 'schema:Comment'
+  - 'sioc:Post'
+  - 'sioct:Comment'
 fieldMappings:
-  subject:
+  title:
     properties:
-      - 'schema:name'
+      - 'dc:title'
   created:
     properties:
-      - 'schema:dateCreated'
+      - 'dc:date'
+      - 'dc:created'
+    datatype: 'xsd:dateTime'
     datatype_callback: 'date_iso8601'
   changed:
     properties:
-      - 'schema:dateModified'
+      - 'dc:modified'
+    datatype: 'xsd:dateTime'
     datatype_callback: 'date_iso8601'
   comment_body:
     properties:
-      - 'schema:text'
+      - 'content:encoded'
   uid:
     properties:
-      - 'schema:author'
+      - 'sioc:has_creator'
+    mapping_type: 'rel'
+  name:
+    properties:
+      - 'foaf:name'
+  pid:
+    properties:
+      - 'sioc:reply_of'
     mapping_type: 'rel'
diff --git a/core/profiles/standard/config/rdf.mapping.comment.comment_node_page.yml b/core/profiles/standard/config/rdf.mapping.comment.comment_node_page.yml
deleted file mode 100644
index d36438f..0000000
--- a/core/profiles/standard/config/rdf.mapping.comment.comment_node_page.yml
+++ /dev/null
@@ -1,24 +0,0 @@
-id: comment.comment_node_page
-targetEntityType: comment
-bundle: comment_node_page
-types:
-  - 'schema:Comment'
-fieldMappings:
-  subject:
-    properties:
-      - 'schema:name'
-  created:
-    properties:
-      - 'schema:dateCreated'
-    datatype_callback: 'date_iso8601'
-  changed:
-    properties:
-      - 'schema:dateModified'
-    datatype_callback: 'date_iso8601'
-  comment_body:
-    properties:
-      - 'schema:text'
-  uid:
-    properties:
-      - 'schema:author'
-    mapping_type: 'rel'
diff --git a/core/profiles/standard/config/rdf.mapping.node.article.yml b/core/profiles/standard/config/rdf.mapping.node.article.yml
index b5413de..ac31562 100644
--- a/core/profiles/standard/config/rdf.mapping.node.article.yml
+++ b/core/profiles/standard/config/rdf.mapping.node.article.yml
@@ -2,35 +2,48 @@ id: node.article
 targetEntityType: node
 bundle: article
 types:
-  - 'schema:Article'
+  - 'foaf:Document'
+  - 'sioc:Item'
 fieldMappings:
   title:
     properties:
-      - 'schema:name'
+      - 'dc:title'
   created:
     properties:
-      - 'schema:dateCreated'
+      - 'dc:date'
+      - 'dc:created'
+    datatype: 'xsd:dateTime'
     datatype_callback: 'date_iso8601'
   changed:
     properties:
-      - 'schema:dateModified'
+      - 'dc:modified'
+    datatype: 'xsd:dateTime'
     datatype_callback: 'date_iso8601'
   body:
     properties:
-      - 'schema:text'
+      - 'content:encoded'
   uid:
     properties:
-      - 'schema:author'
+      - 'sioc:has_creator'
     mapping_type: 'rel'
+  name:
+    properties:
+      - 'foaf:name'
   comment_count:
     properties:
-      - 'schema:interactionCount'
-    datatype_callback: 'Drupal\rdf\SchemaOrgDataConverter::interactionCount'
+      - 'sioc:num_replies'
+    datatype: 'xsd:integer'
+  last_activity:
+    properties:
+      - 'sioc:last_activity_date'
+    datatype: 'xsd:dateTime'
+    datatype_callback: 'date_iso8601'
   field_image:
     properties:
-      - 'schema:image'
+      - 'og:image'
+      - 'rdfs:seeAlso'
     mapping_type: 'rel'
   field_tags:
     properties:
-      - 'schema:about'
+      - 'dc:subject'
     mapping_type: 'rel'
diff --git a/core/profiles/standard/config/rdf.mapping.node.page.yml b/core/profiles/standard/config/rdf.mapping.node.page.yml
index 91330c7..b21ff4c 100644
--- a/core/profiles/standard/config/rdf.mapping.node.page.yml
+++ b/core/profiles/standard/config/rdf.mapping.node.page.yml
@@ -2,27 +2,39 @@ id: node.page
 targetEntityType: node
 bundle: page
 types:
-  - 'schema:WebPage'
+  - 'foaf:Document'
+  - 'sioc:Item'
 fieldMappings:
   title:
     properties:
-      - 'schema:name'
+      - 'dc:title'
   created:
     properties:
-      - 'schema:dateCreated'
+      - 'dc:date'
+      - 'dc:created'
+    datatype: 'xsd:dateTime'
     datatype_callback: 'date_iso8601'
   changed:
     properties:
-      - 'schema:dateModified'
+      - 'dc:modified'
+    datatype: 'xsd:dateTime'
     datatype_callback: 'date_iso8601'
   body:
     properties:
-      - 'schema:text'
+      - 'content:encoded'
   uid:
     properties:
-      - 'schema:author'
+      - 'sioc:has_creator'
     mapping_type: 'rel'
+  name:
+    properties:
+      - 'foaf:name'
   comment_count:
     properties:
-      - 'schema:interactionCount'
-    datatype_callback: 'Drupal\rdf\SchemaOrgDataConverter::interactionCount'
+      - 'sioc:num_replies'
+    datatype: 'xsd:integer'
+  last_activity:
+    properties:
+      - 'sioc:last_activity_date'
+    datatype: 'xsd:dateTime'
+    datatype_callback: 'date_iso8601'
diff --git a/core/profiles/standard/config/rdf.mapping.taxonomy_term.tags.yml b/core/profiles/standard/config/rdf.mapping.taxonomy_term.tags.yml
index 051795c..1e8c3da 100644
--- a/core/profiles/standard/config/rdf.mapping.taxonomy_term.tags.yml
+++ b/core/profiles/standard/config/rdf.mapping.taxonomy_term.tags.yml
@@ -2,11 +2,9 @@ id: taxonomy_term.tags
 targetEntityType: taxonomy_term
 bundle: tags
 types:
-  - 'schema:Thing'
+  - 'skos:Concept'
 fieldMappings:
   name:
     properties:
-      - 'schema:name'
-  description:
-    properties:
-      - 'schema:description'
+      - 'rdfs:label'
+      - 'skos:prefLabel'
diff --git a/core/profiles/standard/config/rdf.mapping.user.user.yml b/core/profiles/standard/config/rdf.mapping.user.user.yml
new file mode 100644
index 0000000..aca7813
--- /dev/null
+++ b/core/profiles/standard/config/rdf.mapping.user.user.yml
@@ -0,0 +1,13 @@
+id: user.user
+targetEntityType: user
+bundle: user
+types:
+  - 'sioc:UserAccount'
+fieldMappings:
+  name:
+    properties:
+      - 'foaf:name'
+  homepage:
+    properties:
+      - 'foaf:page'
+    mapping_type: 'rel'
diff --git a/core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php b/core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php
deleted file mode 100644
index f780877..0000000
--- a/core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php
+++ /dev/null
@@ -1,413 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\Tests\Component\Datetime\DateTimePlusTest.
- */
-
-namespace Drupal\Tests\Component\Datetime;
-
-use Drupal\Tests\UnitTestCase;
-use Drupal\Component\Datetime\DateTimePlus;
-
-/**
- * Tests the DateTimePlus component.
- *
- * @see \Drupal\Component\Datetime\DateTimePlus
- */
-class DateTimePlusTest extends UnitTestCase {
-
-  /**
-   * Test information.
-   */
-  public static function getInfo() {
-    return array(
-      'name' => 'DateTimePlus',
-      'description' => 'Test DateTimePlus functionality.',
-      'group' => 'Datetime',
-    );
-  }
-
-  /**
-   * Test creating dates from string and array input.
-   *
-   * @param mixed $input
-   *   Input argument for DateTimePlus.
-   * @param string $timezone
-   *   Timezone argument for DateTimePlus.
-   * @param string $expected
-   *   Expected output from DateTimePlus::format().
-   *
-   * @dataProvider providerTestDates
-   */
-  public function testDates($input, $timezone, $expected) {
-    $date = new DateTimePlus($input, $timezone);
-    $value = $date->format('c');
-
-    if (is_array($input)) {
-      $input = var_export($input, TRUE);
-    }
-    $this->assertEquals($expected, $value, sprintf("Test new DateTimePlus(%s, %s): should be %s, found %s.", $input, $timezone, $expected, $value));
-  }
-
-  /**
-   * Test creating dates from timestamps, and manipulating timezones.
-   *
-   * @param mixed $input
-   *   Input argument for DateTimePlus().
-   * @param array $initial
-   *   An array containing:
-   *   - 'timezone_initial' - Timezone argument for DateTimePlus.
-   *   - 'format_initial' - Format argument for DateTimePlus.
-   *   - 'expected_initial_date' - Expected output from DateTimePlus::format().
-   *   - 'expected_initial_timezone' - Expected output from
-   *      DateTimePlus::getTimeZone()::getName().
-   *   - 'expected_initial_offset' - Expected output from DateTimePlus::getOffset().
-   * @param array $transform
-   *   An array containing:
-   *   - 'timezone_transform' - Argument to transform date to another timezone via
-   *     DateTimePlus::setTimezone().
-   *   - 'format_transform' - Format argument to use when transforming date to
-   *     another timezone.
-   *   - 'expected_transform_date' - Expected output from DateTimePlus::format(),
-   *     after timezone transform.
-   *   - 'expected_transform_timezone' - Expected output from
-   *     DateTimePlus::getTimeZone()::getName(), after timezone transform.
-   *   - 'expected_transform_offset' - Expected output from
-   *      DateTimePlus::getOffset(), after timezone transform.
-   *
-   * @dataProvider providerTestDateTimestamp
-   */
-  public function testDateTimestamp($input, array $initial, array $transform) {
-    // Initialize a new date object.
-    $date = new DateTimePlus($input, $initial['timezone']);
-
-    // Check format.
-    $value = $date->format($initial['format']);
-    $this->assertEquals($initial['expected_date'], $value, sprintf("Test new DateTimePlus(%s, %s): should be %s, found %s.", $input, $initial['timezone'], $initial['expected_date'], $value));
-
-    // Check timezone name.
-    $value = $date->getTimeZone()->getName();
-    $this->assertEquals($initial['expected_timezone'], $value, sprintf("The current timezone is %s: should be %s.", $value, $initial['expected_timezone']));
-
-    // Check offset.
-    $value = $date->getOffset();
-    $this->assertEquals($initial['expected_offset'], $value, sprintf("The current offset is %s: should be %s.", $value, $initial['expected_offset']));
-
-    // Transform the date to another timezone.
-    $date->setTimezone(new \DateTimeZone($transform['timezone']));
-
-    // Check transformed format.
-    $value = $date->format($transform['format']);
-    $this->assertEquals($transform['expected_date'], $value, sprintf("Test \$date->setTimezone(new \\DateTimeZone(%s)): should be %s, found %s.", $transform['timezone'], $transform['expected_date'], $value));
-
-    // Check transformed timezone.
-    $value = $date->getTimeZone()->getName();
-    $this->assertEquals($transform['expected_timezone'], $value, sprintf("The current timezone should be %s, found %s.", $transform['expected_timezone'], $value));
-
-    // Check transformed offset.
-    $value = $date->getOffset();
-    $this->assertEquals($transform['expected_offset'], $value, sprintf("The current offset should be %s, found %s.", $transform['expected_offset'], $value));
-
-  }
-
-  /**
-   * Test creating dates from format strings.
-   *
-   * @param string $input
-   *   Input argument for DateTimePlus.
-   * @param string $timezone
-   *   Timezone argument for DateTimePlus.
-   * @param string $format_date
-   *   Format argument for DateTimePlus::format().
-   * @param string $expected
-   *   Expected output from DateTimePlus::format().
-   *
-   * @dataProvider providerTestDateFormat
-   */
-  public function testDateFormat($input, $timezone, $format, $format_date, $expected) {
-    $date = new DateTimePlus($input, $timezone, $format);
-    $value = $date->format($format_date);
-    $this->assertEquals($expected, $value, sprintf("Test new DateTimePlus(%s, %s, %s): should be %s, found %s.", $input, $timezone, $format, $expected, $value));
-  }
-
-  /**
-   * Test invalid date handling.
-   *
-   * @param mixed $input
-   *   Input argument for DateTimePlus.
-   * @param string $timezone
-   *   Timezone argument for DateTimePlus.
-   * @param string $format
-   *   Format argument for DateTimePlus.
-   * @param string $message
-   *   Message to print if no errors are thrown by the invalid dates.
-   *
-   * @dataProvider providerTestInvalidDates
-   */
-  public function testInvalidDates($input, $timezone, $format, $message) {
-    $date = new DateTimePlus($input, $timezone, $format);
-    $this->assertNotEquals(count($date->getErrors()), 0, $message);
-  }
-
-  /**
-   * Test that DrupalDateTime can detect the right timezone to use.
-   * When specified or not.
-   *
-   * @param mixed $input
-   *   Input argument for DateTimePlus.
-   * @param mixed $timezone
-   *   Timezone argument for DateTimePlus.
-   * @param string $expected_timezone
-   *   Expected timezone returned from DateTimePlus::getTimezone::getName().
-   * @param string $message
-   *   Message to print on test failure.
-   *
-   * @dataProvider providerTestDateTimezone
-   */
-  public function testDateTimezone($input, $timezone, $expected_timezone, $message) {
-    $date = new DateTimePlus($input, $timezone);
-    $timezone = $date->getTimezone()->getName();
-    $this->assertEquals($timezone, $expected_timezone, $message);
-  }
-
-  /**
-   * Provide data for date tests.
-   *
-   * @return array
-   *   An array of arrays, each containing the input parameters for
-   *   DateTimePlusTest::testDates().
-   *
-   * @see DateTimePlusTest::testDates().
-   */
-  public function providerTestDates() {
-    return array(
-      // String input.
-      // Create date object from datetime string.
-      array('2009-03-07 10:30', 'America/Chicago', '2009-03-07T10:30:00-06:00'),
-      // Same during daylight savings time.
-      array('2009-06-07 10:30', 'America/Chicago', '2009-06-07T10:30:00-05:00'),
-      // Create date object from date string.
-      array('2009-03-07', 'America/Chicago', '2009-03-07T00:00:00-06:00'),
-      // Same during daylight savings time.
-      array('2009-06-07', 'America/Chicago', '2009-06-07T00:00:00-05:00'),
-      // Create date object from date string.
-      array('2009-03-07 10:30', 'Australia/Canberra', '2009-03-07T10:30:00+11:00'),
-      // Same during daylight savings time.
-      array('2009-06-07 10:30', 'Australia/Canberra', '2009-06-07T10:30:00+10:00'),
-
-      // Array input.
-      // Create date object from date array, date only.
-      array(array('year' => 2010, 'month' => 2, 'day' => 28), 'America/Chicago', '2010-02-28T00:00:00-06:00'),
-      // Create date object from date array with hour.
-      array(array('year' => 2010, 'month' => 2, 'day' => 28, 'hour' => 10), 'America/Chicago', '2010-02-28T10:00:00-06:00'),
-      // Create date object from date array, date only.
-      array(array('year' => 2010, 'month' => 2, 'day' => 28), 'Europe/Berlin', '2010-02-28T00:00:00+01:00'),
-      // Create date object from date array with hour.
-      array(array('year' => 2010, 'month' => 2, 'day' => 28, 'hour' => 10), 'Europe/Berlin', '2010-02-28T10:00:00+01:00'),
-    );
-  }
-
-  /**
-   * Provide data for testDateFormats.
-   *
-   * @return array
-   *   An array of arrays, each containing:
-   *   - 'input' - Input to DateTimePlus.
-   *   - 'timezone' - Timezone for DateTimePlus.
-   *   - 'format' - Date format for DateTimePlus.
-   *   - 'format_date' - Date format for use in $date->format() method.
-   *   - 'expected' - The expected return from DateTimePlus.
-   *
-   * @see testDateFormats()
-   */
-  public function providerTestDateFormat() {
-    return array(
-      // Create a year-only date.
-      array('2009', NULL, 'Y', 'Y', '2009'),
-      // Create a month and year-only date.
-      array('2009-10', NULL, 'Y-m', 'Y-m', '2009-10'),
-      // Create a time-only date.
-      array('T10:30:00', NULL, '\TH:i:s', 'H:i:s', '10:30:00'),
-      // Create a time-only date.
-      array('10:30:00', NULL, 'H:i:s', 'H:i:s', '10:30:00'),
-    );
-  }
-
-  /**
-   * Provide data for testInvalidDates.
-   *
-   * @return array
-   *   An array of arrays, each containing:
-   *   - 'input' - Input for DateTimePlus.
-   *   - 'timezone' - Timezone for DateTimePlus.
-   *   - 'format' - Format for DateTimePlus.
-   *   - 'message' - Message to display on failure.
-   *
-   * @see testInvalidDates
-   */
-  public function providerTestInvalidDates() {
-    return array(
-      // Test for invalid month names when we are using a short version
-      // of the month.
-      array('23 abc 2012', NULL, 'd M Y', "23 abc 2012 contains an invalid month name and did not produce errors."),
-      // Test for invalid hour.
-      array('0000-00-00T45:30:00', NULL, 'Y-m-d\TH:i:s', "0000-00-00T45:30:00 contains an invalid hour and did not produce errors."),
-      // Test for invalid day.
-      array('0000-00-99T05:30:00', NULL, 'Y-m-d\TH:i:s', "0000-00-99T05:30:00 contains an invalid day and did not produce errors."),
-      // Test for invalid month.
-      array('0000-75-00T15:30:00', NULL, 'Y-m-d\TH:i:s', "0000-75-00T15:30:00 contains an invalid month and did not produce errors."),
-      // Test for invalid year.
-      array('11-08-01T15:30:00', NULL, 'Y-m-d\TH:i:s', "11-08-01T15:30:00 contains an invalid year and did not produce errors."),
-      // Test for invalid year from date array. 10000 as a year will
-      // create an exception error in the PHP DateTime object.
-      array(array('year' => 10000, 'month' => 7, 'day' => 8, 'hour' => 8, 'minute' => 0, 'second' => 0), 'America/Chicago', NULL, "array('year' => 10000, 'month' => 7, 'day' => 8, 'hour' => 8, 'minute' => 0, 'second' => 0) contains an invalid year and did not produce errors."),
-      // Test for invalid month from date array.
-      array(array('year' => 2010, 'month' => 27, 'day' => 8, 'hour' => 8, 'minute' => 0, 'second' => 0), 'America/Chicago', NULL, "array('year' => 2010, 'month' => 27, 'day' => 8, 'hour' => 8, 'minute' => 0, 'second' => 0) contains an invalid month and did not produce errors."),
-      // Test for invalid hour from date array.
-      array(array('year' => 2010, 'month' => 2, 'day' => 28, 'hour' => 80, 'minute' => 0, 'second' => 0), 'America/Chicago', NULL, "array('year' => 2010, 'month' => 2, 'day' => 28, 'hour' => 80, 'minute' => 0, 'second' => 0) contains an invalid hour and produces errors."),
-      // Test for invalid minute from date array.
-      array(array('year' => 2010, 'month' => 7, 'day' => 8, 'hour' => 8, 'minute' => 88, 'second' => 0), 'America/Chicago', NULL, "array('year' => 2010, 'month' => 7, 'day' => 8, 'hour' => 8, 'minute' => 88, 'second' => 0) contains an invalid minute and produces errors."),
-    );
-  }
-
-  /**
-   * Provide data for testDateTimezone.
-   *
-   * @return array
-   *   An array of arrays, each containing:
-   *   - 'date' - Date string or object for DateTimePlus.
-   *   - 'timezone' - Timezone string for DateTimePlus.
-   *   - 'expected' - Expected return from DateTimePlus::getTimezone()::getName().
-   '   - 'message' - Message to display on test failure.
-   *
-   * @see testDateTimezone
-   */
-  public function providerTestDateTimezone() {
-    // Use a common date for most of the tests.
-    $date_string = '2007-01-31 21:00:00';
-
-    // Detect the system timezone.
-    $system_timezone = date_default_timezone_get();
-
-    return array(
-      // Create a date object with an unspecified timezone, which should
-      // end up using the system timezone.
-      array($date_string, NULL, $system_timezone, 'DateTimePlus uses the system timezone when there is no site timezone.'),
-      // Create a date object with a specified timezone name.
-      array($date_string, 'America/Yellowknife', 'America/Yellowknife', 'DateTimePlus uses the specified timezone if provided.'),
-      // Create a date object with a timezone object.
-      array($date_string, new \DateTimeZone('Australia/Canberra'), 'Australia/Canberra', 'DateTimePlus uses the specified timezone if provided.'),
-      // Create a date object with another date object.
-      array(new DateTimePlus('now', 'Pacific/Midway'), NULL, 'Pacific/Midway', 'DateTimePlus uses the specified timezone if provided.'),
-    );
-  }
-
-  /**
-   * Provide data for testDateTimestamp.
-   *
-   * @return array
-   *   An array of arrays, each containing the arguments required for
-   *   self::testDateTimestamp().
-   *
-   * @see testDateTimestamp()
-   */
-  public function providerTestDateTimestamp() {
-    return array(
-      // Create date object from a unix timestamp and display it in
-      // local time.
-      array(
-        'input' => 0,
-        'initial' => array(
-          'timezone' => 'UTC',
-          'format' => 'c',
-          'expected_date' => '1970-01-01T00:00:00+00:00',
-          'expected_timezone' => 'UTC',
-          'expected_offset' => 0,
-        ),
-        'transorm' => array(
-          'timezone' => 'America/Los_Angeles',
-          'format' => 'c',
-          'expected_date' => '1969-12-31T16:00:00-08:00',
-          'expected_timezone' => 'America/Los_Angeles',
-          'expected_offset' => '-28800',
-        ),
-      ),
-      // Create a date using the timestamp of zero, then display its
-      // value both in UTC and the local timezone.
-      array(
-        'input' => 0,
-        'initial' => array(
-          'timezone' => 'America/Los_Angeles',
-          'format' => 'c',
-          'expected_date' => '1969-12-31T16:00:00-08:00',
-          'expected_timezone' => 'America/Los_Angeles',
-          'expected_offset' => '-28800',
-        ),
-        'transform' => array(
-          'timezone' => 'UTC',
-          'format' => 'c',
-          'expected_date' => '1970-01-01T00:00:00+00:00',
-          'expected_timezone' => 'UTC',
-          'expected_offset' => 0,
-        ),
-      ),
-      // Create date object from datetime string in UTC, and convert
-      // it to a local date.
-      array(
-        'input' => '1970-01-01 00:00:00',
-        'initial' => array(
-          'timezone' => 'UTC',
-          'format' => 'c',
-          'expected_date' => '1970-01-01T00:00:00+00:00',
-          'expected_timezone' => 'UTC',
-          'expected_offset' => 0,
-        ),
-        'transform' => array(
-          'timezone' => 'America/Los_Angeles',
-          'format' => 'c',
-          'expected_date' => '1969-12-31T16:00:00-08:00',
-          'expected_timezone' => 'America/Los_Angeles',
-          'expected_offset' => '-28800',
-        ),
-      ),
-      // Convert the local time to UTC using string input.
-      array(
-        'input' => '1969-12-31 16:00:00',
-        'initial' => array(
-          'timezone' => 'America/Los_Angeles',
-          'format' => 'c',
-          'expected_date' => '1969-12-31T16:00:00-08:00',
-          'expected_timezone' => 'America/Los_Angeles',
-          'expected_offset' => '-28800',
-        ),
-        'transform' => array(
-          'timezone' => 'UTC',
-          'format' => 'c',
-          'expected_date' => '1970-01-01T00:00:00+00:00',
-          'expected_timezone' => 'UTC',
-          'expected_offset' => 0,
-        ),
-      ),
-      // Convert the local time to UTC using string input.
-      array(
-        'input' => '1969-12-31 16:00:00',
-        'initial' => array(
-          'timezone' => 'Europe/Warsaw',
-          'format' => 'c',
-          'expected_date' => '1969-12-31T16:00:00+01:00',
-          'expected_timezone' => 'Europe/Warsaw',
-          'expected_offset' => '+3600',
-        ),
-        'transform' => array(
-          'timezone' => 'UTC',
-          'format' => 'c',
-          'expected_date' => '1969-12-31T15:00:00+00:00',
-          'expected_timezone' => 'UTC',
-          'expected_offset' => 0,
-        ),
-      ),
-    );
-  }
-
-}
diff --git a/core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php b/core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php
index f9cab9a..2212eef 100644
--- a/core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php
@@ -80,6 +80,7 @@ public function testSetChecks() {
       $this->assertNull($route->getOption('_access_checks'));
     }
 
+
     $this->setupAccessChecker();
 
     $this->accessManager->setChecks($this->routeCollection);
@@ -241,21 +242,6 @@ public function testCheckConjunctions($conjunction, $name, $condition_one, $cond
   }
 
   /**
-   * Tests the static access checker interface.
-   */
-  public function testStaticAccessCheckInterface() {
-    $mock_static = $this->getMock('Drupal\Core\Access\StaticAccessCheckInterface');
-    $mock_static->expects($this->once())
-      ->method('appliesTo')
-      ->will($this->returnValue(array('_access')));
-
-    $this->container->set('test_static_access', $mock_static);
-    $this->accessManager->addCheckService('test_static_access');
-
-    $this->accessManager->setChecks($this->routeCollection);
-  }
-
-  /**
    * Converts AccessCheckInterface constants to a string.
    *
    * @param mixed $constant
@@ -283,8 +269,6 @@ protected static function convertAccessCheckInterfaceToString($constant) {
    * Adds a default access check service to the container and the access manager.
    */
   protected function setupAccessChecker() {
-    $this->accessManager = new AccessManager();
-    $this->accessManager->setContainer($this->container);
     $access_check = new DefaultAccessCheck();
     $this->container->register('test_access_default', $access_check);
     $this->accessManager->addCheckService('test_access_default');
diff --git a/core/tests/Drupal/Tests/Core/Access/DefaultAccessCheckTest.php b/core/tests/Drupal/Tests/Core/Access/DefaultAccessCheckTest.php
index ab02aec..bb96686 100644
--- a/core/tests/Drupal/Tests/Core/Access/DefaultAccessCheckTest.php
+++ b/core/tests/Drupal/Tests/Core/Access/DefaultAccessCheckTest.php
@@ -45,10 +45,17 @@ protected function setUp() {
 
 
   /**
-   * Tests the appliesTo method.
+   * Test the applies method.
    */
-  public function testAppliesTo() {
-    $this->assertEquals($this->accessChecker->appliesTo(), array('_access'), 'Access checker returned the expected appliesTo() array.');
+  public function testApplies() {
+    $route = new Route('/test-route');
+    $this->assertFalse($this->accessChecker->applies($route), 'Access checker applied even no _access was defined as requirement.');
+
+    $route->addRequirements(array('_access' => 'FALSE'));
+    $this->assertTrue($this->accessChecker->applies($route), 'Access checker applied even a _access was defined as requirement.');
+
+    $route->addRequirements(array('_access' => 'TRUE'));
+    $this->assertTrue($this->accessChecker->applies($route), 'Access checker applied even a _access was defined as requirement.');
   }
 
   /**
diff --git a/core/tests/Drupal/Tests/Core/Asset/CssCollectionGrouperUnitTest.php b/core/tests/Drupal/Tests/Core/Asset/CssCollectionGrouperUnitTest.php
deleted file mode 100644
index adf5e88..0000000
--- a/core/tests/Drupal/Tests/Core/Asset/CssCollectionGrouperUnitTest.php
+++ /dev/null
@@ -1,216 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\system\Tests\Asset\CssGrouperUnitTest.
- */
-
-
-namespace Drupal\Tests\Core\Asset;
-
-use Drupal\Core\Asset\CssCollectionGrouper;
-use Drupal\Tests\UnitTestCase;
-
-/**
- * Tests the CssCollectionGrouper class.
- *
- * @group Asset
- */
-class CssCollectionGrouperUnitTest extends UnitTestCase {
-
-  /**
-   * A CSS asset grouper.
-   *
-   * @var \Drupal\Core\Asset\CssCollectionGrouper object.
-   */
-  protected $grouper;
-
-  public static function getInfo() {
-    return array(
-      'name' => 'CSS asset collection grouper functionality',
-      'description' => 'Tests the CSS asset collection grouper.',
-      'group' => 'Asset handling',
-    );
-  }
-
-  function setUp() {
-    parent::setUp();
-
-    $this->grouper = new CssCollectionGrouper();
-  }
-
-  /**
-   * Tests \Drupal\Core\Asset\CssCollectionGrouper.
-   */
-  function testGrouper() {
-    $css_assets = array(
-      'system.base.css' => array(
-        'group' => -100,
-        'every_page' => TRUE,
-        'type' => 'file',
-        'weight' => 0.012,
-        'media' => 'all',
-        'preprocess' => TRUE,
-        'data' => 'core/modules/system/system.base.css',
-        'browsers' => array('IE' => TRUE, '!IE' => TRUE),
-        'basename' => 'system.base.css',
-      ),
-      'system.theme.css' => array(
-        'group' => -100,
-        'every_page' => TRUE,
-        'type' => 'file',
-        'weight' => 0.013,
-        'media' => 'all',
-        'preprocess' => TRUE,
-        'data' => 'core/modules/system/system.theme.css',
-        'browsers' => array('IE' => TRUE, '!IE' => TRUE),
-        'basename' => 'system.theme.css',
-      ),
-      'jquery.ui.core.css' => array(
-        'group' => -100,
-        'type' => 'file',
-        'weight' => 0.004,
-        'every_page' => FALSE,
-        'media' => 'all',
-        'preprocess' => TRUE,
-        'data' => 'core/misc/ui/themes/base/jquery.ui.core.css',
-        'browsers' => array('IE' => TRUE, '!IE' => TRUE),
-        'basename' => 'jquery.ui.core.css',
-      ),
-      0 => array(
-        'type' => 'inline',
-        'group' => 0,
-        'weight' => 0.007,
-        'every_page' => FALSE,
-        'media' => 'all',
-        'preprocess' => TRUE,
-        'data' => 'body { padding: 0px; }',
-        'browsers' => array('IE' => TRUE, '!IE' => TRUE),
-      ),
-      1 => array(
-        'type' => 'inline',
-        'group' => 0,
-        'weight' => 0.007,
-        'every_page' => FALSE,
-        'media' => 'all',
-        'preprocess' => FALSE,
-        'data' => 'body { margin: 0px; }',
-        'browsers' => array('IE' => TRUE, '!IE' => TRUE),
-      ),
-      'field.css' => array(
-        'every_page' => TRUE,
-        'group' => 0,
-        'type' => 'file',
-        'weight' => 0.011,
-        'media' => 'all',
-        'preprocess' => TRUE,
-        'data' => 'core/modules/field/theme/field.css',
-        'browsers' => array('IE' => TRUE, '!IE' => TRUE),
-        'basename' => 'field.css',
-      ),
-      'external.css' => array(
-        'every_page' => FALSE,
-        'group' => 0,
-        'type' => 'external',
-        'weight' => 0.009,
-        'media' => 'all',
-        'preprocess' => TRUE,
-        'data' => 'http://example.com/external.css',
-        'browsers' => array('IE' => TRUE, '!IE' => TRUE),
-        'basename' => 'external.css',
-      ),
-      'style.css' => array(
-        'group' => 100,
-        'every_page' => TRUE,
-        'media' => 'all',
-        'type' => 'file',
-        'weight' => 0.001,
-        'preprocess' => TRUE,
-        'data' => 'core/themes/bartik/css/style.css',
-        'browsers' => array('IE' => TRUE, '!IE' => TRUE),
-        'basename' => 'style.css',
-      ),
-      'print.css' => array(
-        'group' => 100,
-        'every_page' => TRUE,
-        'media' => 'print',
-        'type' => 'file',
-        'weight' => 0.003,
-        'preprocess' => TRUE,
-        'data' => 'core/themes/bartik/css/print.css',
-        'browsers' => array('IE' => TRUE, '!IE' => TRUE),
-        'basename' => 'print.css',
-      ),
-    );
-
-    $groups = $this->grouper->group($css_assets);
-
-    $this->assertSame(count($groups), 7, "7 groups created.");
-
-    // Check group 1.
-    $this->assertSame($groups[0]['group'], -100);
-    $this->assertSame($groups[0]['every_page'], TRUE);
-    $this->assertSame($groups[0]['type'], 'file');
-    $this->assertSame($groups[0]['media'], 'all');
-    $this->assertSame($groups[0]['preprocess'], TRUE);
-    $this->assertSame(count($groups[0]['items']), 2);
-    $this->assertContains($css_assets['system.base.css'], $groups[0]['items']);
-    $this->assertContains($css_assets['system.theme.css'], $groups[0]['items']);
-
-    // Check group 2.
-    $this->assertSame($groups[1]['group'], -100);
-    $this->assertSame($groups[1]['every_page'], FALSE);
-    $this->assertSame($groups[1]['type'], 'file');
-    $this->assertSame($groups[1]['media'], 'all');
-    $this->assertSame($groups[1]['preprocess'], TRUE);
-    $this->assertSame(count($groups[1]['items']), 1);
-    $this->assertContains($css_assets['jquery.ui.core.css'], $groups[1]['items']);
-
-    // Check group 3.
-    $this->assertSame($groups[2]['group'], 0);
-    $this->assertSame($groups[2]['every_page'], FALSE);
-    $this->assertSame($groups[2]['type'], 'inline');
-    $this->assertSame($groups[2]['media'], 'all');
-    $this->assertSame($groups[2]['preprocess'], TRUE);
-    $this->assertSame(count($groups[2]['items']), 2);
-    $this->assertContains($css_assets[0], $groups[2]['items']);
-    $this->assertContains($css_assets[1], $groups[2]['items']);
-
-    // Check group 4.
-    $this->assertSame($groups[3]['group'], 0);
-    $this->assertSame($groups[3]['every_page'], TRUE);
-    $this->assertSame($groups[3]['type'], 'file');
-    $this->assertSame($groups[3]['media'], 'all');
-    $this->assertSame($groups[3]['preprocess'], TRUE);
-    $this->assertSame(count($groups[3]['items']), 1);
-    $this->assertContains($css_assets['field.css'], $groups[3]['items']);
-
-    // Check group 5.
-    $this->assertSame($groups[4]['group'], 0);
-    $this->assertSame($groups[4]['every_page'], FALSE);
-    $this->assertSame($groups[4]['type'], 'external');
-    $this->assertSame($groups[4]['media'], 'all');
-    $this->assertSame($groups[4]['preprocess'], TRUE);
-    $this->assertSame(count($groups[4]['items']), 1);
-    $this->assertContains($css_assets['external.css'], $groups[4]['items']);
-
-    // Check group 6.
-    $this->assertSame($groups[5]['group'], 100);
-    $this->assertSame($groups[5]['every_page'], TRUE);
-    $this->assertSame($groups[5]['type'], 'file');
-    $this->assertSame($groups[5]['media'], 'all');
-    $this->assertSame($groups[5]['preprocess'], TRUE);
-    $this->assertSame(count($groups[5]['items']), 1);
-    $this->assertContains($css_assets['style.css'], $groups[5]['items']);
-
-    // Check group 7.
-    $this->assertSame($groups[6]['group'], 100);
-    $this->assertSame($groups[6]['every_page'], TRUE);
-    $this->assertSame($groups[6]['type'], 'file');
-    $this->assertSame($groups[6]['media'], 'print');
-    $this->assertSame($groups[6]['preprocess'], TRUE);
-    $this->assertSame(count($groups[6]['items']), 1);
-    $this->assertContains($css_assets['print.css'], $groups[6]['items']);
-  }
-
-}
diff --git a/core/tests/Drupal/Tests/Core/Asset/CssCollectionRendererUnitTest.php b/core/tests/Drupal/Tests/Core/Asset/CssCollectionRendererUnitTest.php
deleted file mode 100644
index cd97a61..0000000
--- a/core/tests/Drupal/Tests/Core/Asset/CssCollectionRendererUnitTest.php
+++ /dev/null
@@ -1,572 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\system\Tests\Asset\CssCollectionRendererUnitTest.
- */
-
-
-namespace {
-
-/**
- * CssRenderer uses file_create_url(), which *is* available when using the
- * Simpletest test runner, but not when using the PHPUnit test runner; hence
- * this hack.
- */
-if (!function_exists('file_create_url')) {
-
-  /**
-   * Temporary mock for file_create_url(), until that is moved into
-   * Component/Utility.
-   */
-  function file_create_url($uri) {
-    return 'file_create_url:' . $uri;
-  }
-
-}
-
-if (!function_exists('variable_get')) {
-
-  function variable_get($variable, $default) {
-    return $default;
-  }
-
-}
-
-if (!function_exists('check_plain')) {
-
-  function check_plain($text) {
-    return $text;
-  }
-
-}
-
-}
-
-
-
-
-namespace Drupal\Tests\Core\Asset {
-
-use Drupal\Core\Asset\CssCollectionRenderer;
-use Drupal\Tests\UnitTestCase;
-
-/**
- * Tests the CssCollectionRenderer class.
- *
- * @group Asset
- */
-class CssCollectionRendererUnitTest extends UnitTestCase {
-
-  /**
-   * A CSS asset renderer.
-   *
-   * @var \Drupal\Core\Asset\CssRenderer object.
-   */
-  protected $renderer;
-
-  /**
-   * A valid file CSS asset group.
-   *
-   * @var array
-   */
-  protected $file_css_group;
-
-  /**
-   * A valid inline CSS asset group.
-   *
-   * @var array
-   */
-  protected $inline_css_group;
-
-  public static function getInfo() {
-    return array(
-      'name' => 'CSS asset collection renderer functionality',
-      'description' => 'Tests the CSS asset collection renderer.',
-      'group' => 'Asset handling',
-    );
-  }
-
-  function setUp() {
-    parent::setUp();
-
-    $this->renderer = new CssCollectionRenderer();
-    $this->file_css_group = array(
-      'group' => -100,
-      'every_page' => TRUE,
-      'type' => 'file',
-      'media' => 'all',
-      'preprocess' => TRUE,
-      'browsers' => array('IE' => TRUE, '!IE' => TRUE),
-      'items' => array(
-        0 => array(
-          'group' => -100,
-          'every_page' => TRUE,
-          'type' => 'file',
-          'weight' => 0.012,
-          'media' => 'all',
-          'preprocess' => TRUE,
-          'data' => 'tests/Drupal/Tests/Core/Asset/foo.css',
-          'browsers' => array('IE' => TRUE, '!IE' => TRUE),
-          'basename' => 'foo.css',
-        ),
-        1 => array(
-          'group' => -100,
-          'every_page' => TRUE,
-          'type' => 'file',
-          'weight' => 0.013,
-          'media' => 'all',
-          'preprocess' => TRUE,
-          'data' => 'tests/Drupal/Tests/Core/Asset/bar.css',
-          'browsers' => array('IE' => TRUE, '!IE' => TRUE),
-          'basename' => 'bar.css',
-        ),
-      ),
-    );
-    $this->inline_css_group = array(
-      'group' => 0,
-      'every_page' => FALSE,
-      'type' => 'inline',
-      'media' => 'all',
-      'preprocess' => TRUE,
-      'browsers' => array('IE' => TRUE, '!IE' => TRUE),
-      'items' => array(
-        0 => array(
-          'group' => 0,
-          'every_page' => FALSE,
-          'type' => 'inline',
-          'weight' => 0.012,
-          'media' => 'all',
-          'preprocess' => TRUE,
-          'data' => '.girlfriend { display: none; }',
-          'browsers' => array('IE' => TRUE, '!IE' => TRUE),
-        ),
-        1 => array(
-          'group' => 0,
-          'every_page' => FALSE,
-          'type' => 'file',
-          'weight' => 0.013,
-          'media' => 'all',
-          'preprocess' => FALSE,
-          'data' => '#home body { position: fixed; }',
-          'browsers' => array('IE' => TRUE, '!IE' => TRUE),
-        ),
-      ),
-    );
-  }
-
-  /**
-   * Provides data for the CSS asset rendering test.
-   *
-   * @see testRender
-   */
-  function testRenderProvider() {
-    // Default for 'browsers' key in CSS asset.
-    $browsers_default = array('IE' => TRUE, '!IE' => TRUE);
-
-    // Defaults for LINK and STYLE elements.
-    $link_element_defaults = array(
-
-    );
-    $style_element_defaults = array(
-      '#type' => 'html_tag',
-      '#tag' => 'style',
-    );
-
-    $create_link_element = function($href, $media = 'all', $browsers = array()) {
-      return array(
-        '#type' => 'html_tag',
-        '#tag' => 'link',
-        '#attributes' => array(
-          'rel' => 'stylesheet',
-          'href' => $href,
-          'media' => $media,
-        ),
-        '#browsers' => $browsers,
-      );
-    };
-    $create_style_element = function($value, $media, $browsers = array(), $wrap_in_cdata = FALSE) {
-      $style_element = array(
-        '#type' => 'html_tag',
-        '#tag' => 'style',
-        '#value' => $value,
-        '#attributes' => array(
-          'media' => $media
-        ),
-        '#browsers' => $browsers,
-      );
-      if ($wrap_in_cdata) {
-        $style_element['#value_prefix'] = "\n/* <![CDATA[ */\n";
-        $style_element['#value_suffix'] = "\n/* ]]> */\n";
-      }
-      return $style_element;
-    };
-
-    $create_file_css_asset = function($data, $media = 'all', $preprocess = TRUE) {
-      return array('group' => 0, 'every_page' => FALSE, 'type' => 'file', 'media' => $media, 'preprocess' => $preprocess, 'data' => $data, 'browsers' => array());
-    };
-
-    return array(
-      // Single external CSS asset.
-      0 => array(
-        // CSS assets.
-        array(
-          0 => array('group' => 0, 'every_page' => TRUE, 'type' => 'external', 'media' => 'all', 'preprocess' => TRUE, 'data' => 'http://example.com/popular.js', 'browsers' => array()),
-        ),
-        // Render elements.
-        array(
-          0 => $create_link_element('http://example.com/popular.js', 'all'),
-        ),
-      ),
-      // Single inline CSS asset.
-      1 => array(
-        array(
-          0 => array('group' => 0, 'every_page' => FALSE, 'type' => 'inline', 'media' => 'all', 'preprocess' => FALSE, 'data' => '.girlfriend { display: none; }', 'browsers' => array()),
-        ),
-        array(
-          0 => $create_style_element('.girlfriend { display: none; }', 'all', array(), TRUE),
-        ),
-      ),
-      // Single file CSS asset.
-      2 => array(
-        array(
-          0 => array('group' => 0, 'every_page' => TRUE, 'type' => 'file', 'media' => 'all', 'preprocess' => TRUE, 'data' => 'public://css/file-every_page-all', 'browsers' => array()),
-        ),
-        array(
-          0 => $create_link_element(file_create_url('public://css/file-every_page-all') . '?0', 'all'),
-        ),
-      ),
-      // 31 file CSS assets: expect 31 link elements.
-      3 => array(
-        array(
-          0 => $create_file_css_asset('public://css/1.css'),
-          1 => $create_file_css_asset('public://css/2.css'),
-          2 => $create_file_css_asset('public://css/3.css'),
-          3 => $create_file_css_asset('public://css/4.css'),
-          4 => $create_file_css_asset('public://css/5.css'),
-          5 => $create_file_css_asset('public://css/6.css'),
-          6 => $create_file_css_asset('public://css/7.css'),
-          7 => $create_file_css_asset('public://css/8.css'),
-          8 => $create_file_css_asset('public://css/9.css'),
-          9 => $create_file_css_asset('public://css/10.css'),
-          10 => $create_file_css_asset('public://css/11.css'),
-          11 => $create_file_css_asset('public://css/12.css'),
-          12 => $create_file_css_asset('public://css/13.css'),
-          13 => $create_file_css_asset('public://css/14.css'),
-          14 => $create_file_css_asset('public://css/15.css'),
-          15 => $create_file_css_asset('public://css/16.css'),
-          16 => $create_file_css_asset('public://css/17.css'),
-          17 => $create_file_css_asset('public://css/18.css'),
-          18 => $create_file_css_asset('public://css/19.css'),
-          19 => $create_file_css_asset('public://css/20.css'),
-          20 => $create_file_css_asset('public://css/21.css'),
-          21 => $create_file_css_asset('public://css/22.css'),
-          22 => $create_file_css_asset('public://css/23.css'),
-          23 => $create_file_css_asset('public://css/24.css'),
-          24 => $create_file_css_asset('public://css/25.css'),
-          25 => $create_file_css_asset('public://css/26.css'),
-          26 => $create_file_css_asset('public://css/27.css'),
-          27 => $create_file_css_asset('public://css/28.css'),
-          28 => $create_file_css_asset('public://css/29.css'),
-          29 => $create_file_css_asset('public://css/30.css'),
-          30 => $create_file_css_asset('public://css/31.css'),
-        ),
-        array(
-          0 => $create_link_element(file_create_url('public://css/1.css') . '?0'),
-          1 => $create_link_element(file_create_url('public://css/2.css') . '?0'),
-          2 => $create_link_element(file_create_url('public://css/3.css') . '?0'),
-          3 => $create_link_element(file_create_url('public://css/4.css') . '?0'),
-          4 => $create_link_element(file_create_url('public://css/5.css') . '?0'),
-          5 => $create_link_element(file_create_url('public://css/6.css') . '?0'),
-          6 => $create_link_element(file_create_url('public://css/7.css') . '?0'),
-          7 => $create_link_element(file_create_url('public://css/8.css') . '?0'),
-          8 => $create_link_element(file_create_url('public://css/9.css') . '?0'),
-          9 => $create_link_element(file_create_url('public://css/10.css') . '?0'),
-          10 => $create_link_element(file_create_url('public://css/11.css') . '?0'),
-          11 => $create_link_element(file_create_url('public://css/12.css') . '?0'),
-          12 => $create_link_element(file_create_url('public://css/13.css') . '?0'),
-          13 => $create_link_element(file_create_url('public://css/14.css') . '?0'),
-          14 => $create_link_element(file_create_url('public://css/15.css') . '?0'),
-          15 => $create_link_element(file_create_url('public://css/16.css') . '?0'),
-          16 => $create_link_element(file_create_url('public://css/17.css') . '?0'),
-          17 => $create_link_element(file_create_url('public://css/18.css') . '?0'),
-          18 => $create_link_element(file_create_url('public://css/19.css') . '?0'),
-          19 => $create_link_element(file_create_url('public://css/20.css') . '?0'),
-          20 => $create_link_element(file_create_url('public://css/21.css') . '?0'),
-          21 => $create_link_element(file_create_url('public://css/22.css') . '?0'),
-          22 => $create_link_element(file_create_url('public://css/23.css') . '?0'),
-          23 => $create_link_element(file_create_url('public://css/24.css') . '?0'),
-          24 => $create_link_element(file_create_url('public://css/25.css') . '?0'),
-          25 => $create_link_element(file_create_url('public://css/26.css') . '?0'),
-          26 => $create_link_element(file_create_url('public://css/27.css') . '?0'),
-          27 => $create_link_element(file_create_url('public://css/28.css') . '?0'),
-          28 => $create_link_element(file_create_url('public://css/29.css') . '?0'),
-          29 => $create_link_element(file_create_url('public://css/30.css') . '?0'),
-          30 => $create_link_element(file_create_url('public://css/31.css') . '?0'),
-        ),
-      ),
-      // 32 file CSS assets with the same properties: expect 2 style elements.
-      4 => array(
-        array(
-          0 => $create_file_css_asset('public://css/1.css'),
-          1 => $create_file_css_asset('public://css/2.css'),
-          2 => $create_file_css_asset('public://css/3.css'),
-          3 => $create_file_css_asset('public://css/4.css'),
-          4 => $create_file_css_asset('public://css/5.css'),
-          5 => $create_file_css_asset('public://css/6.css'),
-          6 => $create_file_css_asset('public://css/7.css'),
-          7 => $create_file_css_asset('public://css/8.css'),
-          8 => $create_file_css_asset('public://css/9.css'),
-          9 => $create_file_css_asset('public://css/10.css'),
-          10 => $create_file_css_asset('public://css/11.css'),
-          11 => $create_file_css_asset('public://css/12.css'),
-          12 => $create_file_css_asset('public://css/13.css'),
-          13 => $create_file_css_asset('public://css/14.css'),
-          14 => $create_file_css_asset('public://css/15.css'),
-          15 => $create_file_css_asset('public://css/16.css'),
-          16 => $create_file_css_asset('public://css/17.css'),
-          17 => $create_file_css_asset('public://css/18.css'),
-          18 => $create_file_css_asset('public://css/19.css'),
-          19 => $create_file_css_asset('public://css/20.css'),
-          20 => $create_file_css_asset('public://css/21.css'),
-          21 => $create_file_css_asset('public://css/22.css'),
-          22 => $create_file_css_asset('public://css/23.css'),
-          23 => $create_file_css_asset('public://css/24.css'),
-          24 => $create_file_css_asset('public://css/25.css'),
-          25 => $create_file_css_asset('public://css/26.css'),
-          26 => $create_file_css_asset('public://css/27.css'),
-          27 => $create_file_css_asset('public://css/28.css'),
-          28 => $create_file_css_asset('public://css/29.css'),
-          29 => $create_file_css_asset('public://css/30.css'),
-          30 => $create_file_css_asset('public://css/31.css'),
-          31 => $create_file_css_asset('public://css/32.css'),
-        ),
-        array(
-          0 => $create_style_element('
-@import url("' . file_create_url('public://css/1.css') . '?0");
-@import url("' . file_create_url('public://css/2.css') . '?0");
-@import url("' . file_create_url('public://css/3.css') . '?0");
-@import url("' . file_create_url('public://css/4.css') . '?0");
-@import url("' . file_create_url('public://css/5.css') . '?0");
-@import url("' . file_create_url('public://css/6.css') . '?0");
-@import url("' . file_create_url('public://css/7.css') . '?0");
-@import url("' . file_create_url('public://css/8.css') . '?0");
-@import url("' . file_create_url('public://css/9.css') . '?0");
-@import url("' . file_create_url('public://css/10.css') . '?0");
-@import url("' . file_create_url('public://css/11.css') . '?0");
-@import url("' . file_create_url('public://css/12.css') . '?0");
-@import url("' . file_create_url('public://css/13.css') . '?0");
-@import url("' . file_create_url('public://css/14.css') . '?0");
-@import url("' . file_create_url('public://css/15.css') . '?0");
-@import url("' . file_create_url('public://css/16.css') . '?0");
-@import url("' . file_create_url('public://css/17.css') . '?0");
-@import url("' . file_create_url('public://css/18.css') . '?0");
-@import url("' . file_create_url('public://css/19.css') . '?0");
-@import url("' . file_create_url('public://css/20.css') . '?0");
-@import url("' . file_create_url('public://css/21.css') . '?0");
-@import url("' . file_create_url('public://css/22.css') . '?0");
-@import url("' . file_create_url('public://css/23.css') . '?0");
-@import url("' . file_create_url('public://css/24.css') . '?0");
-@import url("' . file_create_url('public://css/25.css') . '?0");
-@import url("' . file_create_url('public://css/26.css') . '?0");
-@import url("' . file_create_url('public://css/27.css') . '?0");
-@import url("' . file_create_url('public://css/28.css') . '?0");
-@import url("' . file_create_url('public://css/29.css') . '?0");
-@import url("' . file_create_url('public://css/30.css') . '?0");
-@import url("' . file_create_url('public://css/31.css') . '?0");
-', 'all'),
-          1 => $create_style_element('
-@import url("' . file_create_url('public://css/32.css') . '?0");
-', 'all'),
-        ),
-      ),
-      // 32 file CSS assets with the same properties, except for the 10th and
-      // 20th files, they have different 'media' properties. Expect 5 style
-      // elements.
-      5 => array(
-        array(
-          0 => $create_file_css_asset('public://css/1.css'),
-          1 => $create_file_css_asset('public://css/2.css'),
-          2 => $create_file_css_asset('public://css/3.css'),
-          3 => $create_file_css_asset('public://css/4.css'),
-          4 => $create_file_css_asset('public://css/5.css'),
-          5 => $create_file_css_asset('public://css/6.css'),
-          6 => $create_file_css_asset('public://css/7.css'),
-          7 => $create_file_css_asset('public://css/8.css'),
-          8 => $create_file_css_asset('public://css/9.css'),
-          9 => $create_file_css_asset('public://css/10.css', 'screen'),
-          10 => $create_file_css_asset('public://css/11.css'),
-          11 => $create_file_css_asset('public://css/12.css'),
-          12 => $create_file_css_asset('public://css/13.css'),
-          13 => $create_file_css_asset('public://css/14.css'),
-          14 => $create_file_css_asset('public://css/15.css'),
-          15 => $create_file_css_asset('public://css/16.css'),
-          16 => $create_file_css_asset('public://css/17.css'),
-          17 => $create_file_css_asset('public://css/18.css'),
-          18 => $create_file_css_asset('public://css/19.css'),
-          19 => $create_file_css_asset('public://css/20.css', 'print'),
-          20 => $create_file_css_asset('public://css/21.css'),
-          21 => $create_file_css_asset('public://css/22.css'),
-          22 => $create_file_css_asset('public://css/23.css'),
-          23 => $create_file_css_asset('public://css/24.css'),
-          24 => $create_file_css_asset('public://css/25.css'),
-          25 => $create_file_css_asset('public://css/26.css'),
-          26 => $create_file_css_asset('public://css/27.css'),
-          27 => $create_file_css_asset('public://css/28.css'),
-          28 => $create_file_css_asset('public://css/29.css'),
-          29 => $create_file_css_asset('public://css/30.css'),
-          30 => $create_file_css_asset('public://css/31.css'),
-          31 => $create_file_css_asset('public://css/32.css'),
-        ),
-        array(
-          0 => $create_style_element('
-@import url("' . file_create_url('public://css/1.css') . '?0");
-@import url("' . file_create_url('public://css/2.css') . '?0");
-@import url("' . file_create_url('public://css/3.css') . '?0");
-@import url("' . file_create_url('public://css/4.css') . '?0");
-@import url("' . file_create_url('public://css/5.css') . '?0");
-@import url("' . file_create_url('public://css/6.css') . '?0");
-@import url("' . file_create_url('public://css/7.css') . '?0");
-@import url("' . file_create_url('public://css/8.css') . '?0");
-@import url("' . file_create_url('public://css/9.css') . '?0");
-', 'all'),
-          1 => $create_style_element('
-@import url("' . file_create_url('public://css/10.css') . '?0");
-', 'screen'),
-          2 => $create_style_element('
-@import url("' . file_create_url('public://css/11.css') . '?0");
-@import url("' . file_create_url('public://css/12.css') . '?0");
-@import url("' . file_create_url('public://css/13.css') . '?0");
-@import url("' . file_create_url('public://css/14.css') . '?0");
-@import url("' . file_create_url('public://css/15.css') . '?0");
-@import url("' . file_create_url('public://css/16.css') . '?0");
-@import url("' . file_create_url('public://css/17.css') . '?0");
-@import url("' . file_create_url('public://css/18.css') . '?0");
-@import url("' . file_create_url('public://css/19.css') . '?0");
-', 'all'),
-          3 => $create_style_element('
-@import url("' . file_create_url('public://css/20.css') . '?0");
-', 'print'),
-          4 => $create_style_element('
-@import url("' . file_create_url('public://css/21.css') . '?0");
-@import url("' . file_create_url('public://css/22.css') . '?0");
-@import url("' . file_create_url('public://css/23.css') . '?0");
-@import url("' . file_create_url('public://css/24.css') . '?0");
-@import url("' . file_create_url('public://css/25.css') . '?0");
-@import url("' . file_create_url('public://css/26.css') . '?0");
-@import url("' . file_create_url('public://css/27.css') . '?0");
-@import url("' . file_create_url('public://css/28.css') . '?0");
-@import url("' . file_create_url('public://css/29.css') . '?0");
-@import url("' . file_create_url('public://css/30.css') . '?0");
-@import url("' . file_create_url('public://css/31.css') . '?0");
-@import url("' . file_create_url('public://css/32.css') . '?0");
-', 'all'),
-        ),
-      ),
-      // 32 file CSS assets with the same properties, except for the 15th, which
-      // has 'preprocess' = FALSE. Expect 1 link element and 2 style elements.
-      6 => array(
-        array(
-          0 => $create_file_css_asset('public://css/1.css'),
-          1 => $create_file_css_asset('public://css/2.css'),
-          2 => $create_file_css_asset('public://css/3.css'),
-          3 => $create_file_css_asset('public://css/4.css'),
-          4 => $create_file_css_asset('public://css/5.css'),
-          5 => $create_file_css_asset('public://css/6.css'),
-          6 => $create_file_css_asset('public://css/7.css'),
-          7 => $create_file_css_asset('public://css/8.css'),
-          8 => $create_file_css_asset('public://css/9.css'),
-          9 => $create_file_css_asset('public://css/10.css'),
-          10 => $create_file_css_asset('public://css/11.css'),
-          11 => $create_file_css_asset('public://css/12.css'),
-          12 => $create_file_css_asset('public://css/13.css'),
-          13 => $create_file_css_asset('public://css/14.css'),
-          14 => $create_file_css_asset('public://css/15.css', 'all', FALSE),
-          15 => $create_file_css_asset('public://css/16.css'),
-          16 => $create_file_css_asset('public://css/17.css'),
-          17 => $create_file_css_asset('public://css/18.css'),
-          18 => $create_file_css_asset('public://css/19.css'),
-          19 => $create_file_css_asset('public://css/20.css'),
-          20 => $create_file_css_asset('public://css/21.css'),
-          21 => $create_file_css_asset('public://css/22.css'),
-          22 => $create_file_css_asset('public://css/23.css'),
-          23 => $create_file_css_asset('public://css/24.css'),
-          24 => $create_file_css_asset('public://css/25.css'),
-          25 => $create_file_css_asset('public://css/26.css'),
-          26 => $create_file_css_asset('public://css/27.css'),
-          27 => $create_file_css_asset('public://css/28.css'),
-          28 => $create_file_css_asset('public://css/29.css'),
-          29 => $create_file_css_asset('public://css/30.css'),
-          30 => $create_file_css_asset('public://css/31.css'),
-          31 => $create_file_css_asset('public://css/32.css'),
-        ),
-        array(
-          0 => $create_style_element('
-@import url("' . file_create_url('public://css/1.css') . '?0");
-@import url("' . file_create_url('public://css/2.css') . '?0");
-@import url("' . file_create_url('public://css/3.css') . '?0");
-@import url("' . file_create_url('public://css/4.css') . '?0");
-@import url("' . file_create_url('public://css/5.css') . '?0");
-@import url("' . file_create_url('public://css/6.css') . '?0");
-@import url("' . file_create_url('public://css/7.css') . '?0");
-@import url("' . file_create_url('public://css/8.css') . '?0");
-@import url("' . file_create_url('public://css/9.css') . '?0");
-@import url("' . file_create_url('public://css/10.css') . '?0");
-@import url("' . file_create_url('public://css/11.css') . '?0");
-@import url("' . file_create_url('public://css/12.css') . '?0");
-@import url("' . file_create_url('public://css/13.css') . '?0");
-@import url("' . file_create_url('public://css/14.css') . '?0");
-', 'all'),
-          1 => $create_link_element(file_create_url('public://css/15.css') . '?0'),
-          2 => $create_style_element('
-@import url("' . file_create_url('public://css/16.css') . '?0");
-@import url("' . file_create_url('public://css/17.css') . '?0");
-@import url("' . file_create_url('public://css/18.css') . '?0");
-@import url("' . file_create_url('public://css/19.css') . '?0");
-@import url("' . file_create_url('public://css/20.css') . '?0");
-@import url("' . file_create_url('public://css/21.css') . '?0");
-@import url("' . file_create_url('public://css/22.css') . '?0");
-@import url("' . file_create_url('public://css/23.css') . '?0");
-@import url("' . file_create_url('public://css/24.css') . '?0");
-@import url("' . file_create_url('public://css/25.css') . '?0");
-@import url("' . file_create_url('public://css/26.css') . '?0");
-@import url("' . file_create_url('public://css/27.css') . '?0");
-@import url("' . file_create_url('public://css/28.css') . '?0");
-@import url("' . file_create_url('public://css/29.css') . '?0");
-@import url("' . file_create_url('public://css/30.css') . '?0");
-@import url("' . file_create_url('public://css/31.css') . '?0");
-@import url("' . file_create_url('public://css/32.css') . '?0");
-', 'all'),
-        ),
-      ),
-    );
-  }
-
-  /**
-   * Tests CSS asset rendering.
-   *
-   * @dataProvider testRenderProvider
-   */
-  function testRender(array $css_assets, array $render_elements) {
-    $this->assertSame($render_elements, $this->renderer->render($css_assets));
-  }
-
-  /**
-   * Tests a CSS asset group with the invalid 'type' => 'internal'.
-   */
-  function testRenderInvalidType() {
-    $this->setExpectedException('Exception', 'Invalid CSS asset type.');
-
-    $css_group = array(
-      'group' => 0,
-      'every_page' => TRUE,
-      'type' => 'internal',
-      'media' => 'all',
-      'preprocess' => TRUE,
-      'browsers' => array(),
-      'data' => 'http://example.com/popular.js'
-    );
-    $this->renderer->render($css_group);
-  }
-}
-}
diff --git a/core/tests/Drupal/Tests/Core/Asset/CssOptimizerUnitTest.php b/core/tests/Drupal/Tests/Core/Asset/CssOptimizerUnitTest.php
deleted file mode 100644
index 41eb529..0000000
--- a/core/tests/Drupal/Tests/Core/Asset/CssOptimizerUnitTest.php
+++ /dev/null
@@ -1,227 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\system\Tests\Asset\CssOptimizerUnitTest.
- */
-
-
-namespace {
-
-/**
- * CssOptimizer uses file_create_url(), which *is* available when using the
- * Simpletest test runner, but not when using the PHPUnit test runner; hence
- * this hack.
- */
-if (!function_exists('file_create_url')) {
-
-  /**
-   * Temporary mock for file_create_url(), until that is moved into
-   * Component/Utility.
-   */
-  function file_create_url($uri) {
-    return 'file_create_url:' . $uri;
-  }
-
-}
-
-if (!function_exists('file_uri_scheme')) {
-
-  function file_uri_scheme($uri) {
-    return FALSE;
-  }
-
-}
-
-}
-
-
-namespace Drupal\Tests\Core\Asset {
-
-use Drupal\Core\Asset\CssOptimizer;
-use Drupal\Tests\UnitTestCase;
-
-/**
- * Tests the CssOptimizer class.
- *
- * @group Asset
- */
-class CssOptimizerUnitTest extends UnitTestCase {
-
-  /**
-   * A CSS asset optimizer.
-   *
-   * @var \Drupal\Core\Asset\CssOptimizer object.
-   */
-  protected $optimizer;
-
-  /**
-   * A valid file CSS asset group.
-   *
-   * @var array
-   */
-  protected $file_css_group;
-
-  /**
-   * A valid inline CSS asset group.
-   *
-   * @var array
-   */
-  protected $inline_css_group;
-
-  public static function getInfo() {
-    return array(
-      'name' => 'CSS asset optimizer functionality',
-      'description' => 'Tests the CSS asset optimizer.',
-      'group' => 'Asset handling',
-    );
-  }
-
-  function setUp() {
-    parent::setUp();
-
-    $this->optimizer = new CssOptimizer();
-  }
-
-  /**
-   * Provides data for the CSS asset optimizing test.
-   */
-  function testOptimizeProvider() {
-    $path = dirname(__FILE__)  . '/css_test_files/';
-    return array(
-      // File. Tests:
-      // - Stripped comments and white-space.
-      // - Retain white-space in selectors. (http://drupal.org/node/472820)
-      // - Retain pseudo-selectors. (http://drupal.org/node/460448)
-      0 => array(
-        array(
-          'group' => -100,
-          'every_page' => TRUE,
-          'type' => 'file',
-          'weight' => 0.012,
-          'media' => 'all',
-          'preprocess' => TRUE,
-          'data' => $path . 'css_input_without_import.css',
-          'browsers' => array('IE' => TRUE, '!IE' => TRUE),
-          'basename' => 'css_input_without_import.css',
-        ),
-        file_get_contents($path . 'css_input_without_import.css.optimized.css'),
-      ),
-      // File. Tests:
-      // - Proper URLs in imported files. (http://drupal.org/node/265719)
-      // - A background image with relative paths, which must be rewritten.
-      // - The rewritten background image path must also be passed through
-      //   file_create_url(). (https://drupal.org/node/1961340)
-      1 => array(
-        array(
-          'group' => -100,
-          'every_page' => TRUE,
-          'type' => 'file',
-          'weight' => 0.013,
-          'media' => 'all',
-          'preprocess' => TRUE,
-          'data' => $path . 'css_input_with_import.css',
-          'browsers' => array('IE' => TRUE, '!IE' => TRUE),
-          'basename' => 'css_input_with_import.css',
-        ),
-        str_replace('url(images/icon.png)', 'url(' . file_create_url($path . 'images/icon.png') . ')', file_get_contents($path . 'css_input_with_import.css.optimized.css')),
-      ),
-      // File. Tests:
-      // - Retain comment hacks.
-      2 => array(
-        array(
-          'group' => -100,
-          'every_page' => TRUE,
-          'type' => 'file',
-          'weight' => 0.013,
-          'media' => 'all',
-          'preprocess' => TRUE,
-          'data' => $path . 'comment_hacks.css',
-          'browsers' => array('IE' => TRUE, '!IE' => TRUE),
-          'basename' => 'comment_hacks.css',
-        ),
-        file_get_contents($path . 'comment_hacks.css.optimized.css'),
-      ),
-      // Inline. Preprocessing enabled.
-      3 => array(
-        array(
-          'group' => 0,
-          'every_page' => FALSE,
-          'type' => 'inline',
-          'weight' => 0.012,
-          'media' => 'all',
-          'preprocess' => TRUE,
-          'data' => '.girlfriend { display: none; }',
-          'browsers' => array('IE' => TRUE, '!IE' => TRUE),
-        ),
-        ".girlfriend{display:none;}\n",
-      ),
-      // Inline. Preprocessing disabled.
-      4 => array(
-        array(
-          'group' => 0,
-          'every_page' => FALSE,
-          'type' => 'inline',
-          'weight' => 0.013,
-          'media' => 'all',
-          'preprocess' => FALSE,
-          'data' => '#home body { position: fixed; }',
-          'browsers' => array('IE' => TRUE, '!IE' => TRUE),
-        ),
-        '#home body { position: fixed; }',
-      )
-    );
-  }
-
-  /**
-   * Tests optimizing a CSS asset group containing 'type' => 'file'.
-   *
-   * @dataProvider testOptimizeProvider
-   */
-  function testOptimize($css_asset, $expected) {
-    $this->assertEquals($expected, $this->optimizer->optimize($css_asset), 'Group of file CSS assets optimized correctly.');
-  }
-
-  /**
-   * Tests a file CSS asset with preprocessing disabled.
-   */
-  function testTypeFilePreprocessingDisabled() {
-    $this->setExpectedException('Exception', 'Only file CSS assets with preprocessing enabled can be optimized.');
-
-    $css_asset = array(
-      'group' => -100,
-      'every_page' => TRUE,
-      'type' => 'file',
-      'weight' => 0.012,
-      'media' => 'all',
-      // Preprocessing disabled.
-      'preprocess' => FALSE,
-      'data' => 'tests/Drupal/Tests/Core/Asset/foo.css',
-      'browsers' => array('IE' => TRUE, '!IE' => TRUE),
-      'basename' => 'foo.css',
-    );
-    $this->optimizer->optimize($css_asset);
-  }
-
-  /**
-   * Tests a CSS asset with 'type' => 'external'.
-   */
-  function testTypeExternal() {
-    $this->setExpectedException('Exception', 'Only file or inline CSS assets can be optimized.');
-
-    $css_asset = array(
-      'group' => -100,
-      'every_page' => TRUE,
-      // Type external.
-      'type' => 'external',
-      'weight' => 0.012,
-      'media' => 'all',
-      'preprocess' => TRUE,
-      'data' => 'http://example.com/foo.js',
-      'browsers' => array('IE' => TRUE, '!IE' => TRUE),
-    );
-    $this->optimizer->optimize($css_asset);
-  }
-
-}
-}
diff --git a/core/tests/Drupal/Tests/Core/Asset/css_test_files/comment_hacks.css b/core/tests/Drupal/Tests/Core/Asset/css_test_files/comment_hacks.css
deleted file mode 100644
index 8b12d6c..0000000
--- a/core/tests/Drupal/Tests/Core/Asset/css_test_files/comment_hacks.css
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
-* A sample css file, designed to test the effectiveness and stability
-* of function <code>drupal_load_stylesheet_content()</code>.
-*
-*/
-/*
-A large comment block to test for segfaults and speed. This is 60K a's. Extreme but useful to demonstrate flaws in comment striping regexp. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa*/
-.test1 { display:block;}
-
-/* A multiline IE-mac hack (v.2) taken fron Zen theme*/
-/* Hides from IE-mac \*/
-html .clear-block {
- height: 1%;
-}
-.clear-block {
- display: block;
- font:italic bold 12px/30px Georgia, serif;
-}
-
-/* End hide from IE-mac */
-.test2 { display:block; }
-
-/* v1 of the commented backslash hack. This \ character between rules appears to have the effect
-that macIE5 ignores the following rule. Odd, but extremely useful. */
-.bkslshv1 { background-color: #c00; }
-.test3 { display:block; }
-
-/**************** A multiline, multistar comment ***************
-****************************************************************/
-.test4 { display:block;}
-
-/**************************************/
-.comment-in-double-quotes:before {
-  content: "/* ";
-}
-.this_rule_must_stay {
-  color: #f00;
-  background-color: #fff;
-}
-.comment-in-double-quotes:after {
-  content: " */";
-}
-/**************************************/
-.comment-in-single-quotes:before {
-  content: '/*';
-}
-.this_rule_must_stay {
-  color: #f00;
-  background-color: #fff;
-}
-.comment-in-single-quotes:after {
-  content: '*/';
-}
-/**************************************/
-.comment-in-mixed-quotes:before {
-  content: '"/*"';
-}
-.this_rule_must_stay {
-  color: #f00;
-  background-color: #fff;
-}
-.comment-in-mixed-quotes:after {
-  content: "'*/'";
-}
-/**************************************/
-.comment-in-quotes-with-escaped:before {
-  content: '/* \" \' */';
-}
-.this_rule_must_stay {
-  color: #f00;
-  background-color: #fff;
-}
-.comment-in-quotes-with-escaped:after {
-  content: "*/ \" \ '";
-}
-/************************************/
-/*
-"This has to go"
-'This has to go'
-*/
diff --git a/core/tests/Drupal/Tests/Core/Asset/css_test_files/comment_hacks.css.optimized.css b/core/tests/Drupal/Tests/Core/Asset/css_test_files/comment_hacks.css.optimized.css
deleted file mode 100644
index 4e6615a..0000000
--- a/core/tests/Drupal/Tests/Core/Asset/css_test_files/comment_hacks.css.optimized.css
+++ /dev/null
@@ -1 +0,0 @@
-.test1{display:block;}html .clear-block{height:1%;}.clear-block{display:block;font:italic bold 12px/30px Georgia,serif;}.test2{display:block;}.bkslshv1{background-color:#c00;}.test3{display:block;}.test4{display:block;}.comment-in-double-quotes:before{content:"/* ";}.this_rule_must_stay{color:#f00;background-color:#fff;}.comment-in-double-quotes:after{content:" */";}.comment-in-single-quotes:before{content:'/*';}.this_rule_must_stay{color:#f00;background-color:#fff;}.comment-in-single-quotes:after{content:'*/';}.comment-in-mixed-quotes:before{content:'"/*"';}.this_rule_must_stay{color:#f00;background-color:#fff;}.comment-in-mixed-quotes:after{content:"'*/'";}.comment-in-quotes-with-escaped:before{content:'/* \" \' */';}.this_rule_must_stay{color:#f00;background-color:#fff;}.comment-in-quotes-with-escaped:after{content:"*/ \" \ '";}
diff --git a/core/tests/Drupal/Tests/Core/Asset/css_test_files/css_input_with_import.css b/core/tests/Drupal/Tests/Core/Asset/css_test_files/css_input_with_import.css
deleted file mode 100644
index 87afcb3..0000000
--- a/core/tests/Drupal/Tests/Core/Asset/css_test_files/css_input_with_import.css
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-@import "import1.css";
-@import "import2.css";
-
-body {
-  margin: 0;
-  padding: 0;
-  background: #edf5fa;
-  font: 76%/170% Verdana, sans-serif;
-  color: #494949;
-}
-
-.this .is .a .test {
-  font: 1em/100% Verdana, sans-serif;
-  color: #494949;
-}
-.this
-.is
-.a
-.test {
-font: 1em/100% Verdana, sans-serif;
-color: #494949;
-}
-
-textarea, select {
-  font: 1em/160% Verdana, sans-serif;
-  color: #494949;
-}
-
diff --git a/core/tests/Drupal/Tests/Core/Asset/css_test_files/css_input_with_import.css.optimized.css b/core/tests/Drupal/Tests/Core/Asset/css_test_files/css_input_with_import.css.optimized.css
deleted file mode 100644
index 698d9aa..0000000
--- a/core/tests/Drupal/Tests/Core/Asset/css_test_files/css_input_with_import.css.optimized.css
+++ /dev/null
@@ -1,6 +0,0 @@
-ul,select{font:1em/160% Verdana,sans-serif;color:#494949;}.ui-icon{background-image:url(images/icon.png);}
-p,select{font:1em/160% Verdana,sans-serif;color:#494949;}
-body{margin:0;padding:0;background:#edf5fa;font:76%/170% Verdana,sans-serif;color:#494949;}.this .is .a .test{font:1em/100% Verdana,sans-serif;color:#494949;}.this
-.is
-.a
-.test{font:1em/100% Verdana,sans-serif;color:#494949;}textarea,select{font:1em/160% Verdana,sans-serif;color:#494949;}
diff --git a/core/tests/Drupal/Tests/Core/Asset/css_test_files/css_input_without_import.css b/core/tests/Drupal/Tests/Core/Asset/css_test_files/css_input_without_import.css
deleted file mode 100644
index 118dfa4..0000000
--- a/core/tests/Drupal/Tests/Core/Asset/css_test_files/css_input_without_import.css
+++ /dev/null
@@ -1,65 +0,0 @@
-
-/**
- * @file Basic css that does not use import
- */
-
-
-body {
-  margin: 0;
-  padding: 0;
-  background: #edf5fa;
-  font: 76%/170% Verdana, sans-serif;
-  color: #494949;
-}
-
-.this .is .a .test {
-  font: 1em/100% Verdana, sans-serif;
-  color: #494949;
-}
-
-/**
- * CSS spec says that all whitespace is valid whitespace, so this selector
- * should be just as good as the one above.
- */
-.this
-.is
-.a
-.test {
-font: 1em/100% Verdana, sans-serif;
-color: #494949;
-}
-
-some :pseudo .thing {
-  border-radius: 3px;
-}
-
-::-moz-selection {
-  background: #000;
-  color:#fff;
-
-}
-::selection {
-  background: #000;
-  color: #fff;
-}
-
-@media print {
-  * {
-    background: #000 !important;
-    color: #fff !important;
-  }
-  @page {
-    margin: 0.5cm;
-  }
-}
-
-@media screen and (max-device-width: 480px) {
-  background: #000;
-  color: #fff;
-}
-
-textarea, select {
-  font: 1em/160% Verdana, sans-serif;
-  color: #494949;
-}
-
diff --git a/core/tests/Drupal/Tests/Core/Asset/css_test_files/css_input_without_import.css.optimized.css b/core/tests/Drupal/Tests/Core/Asset/css_test_files/css_input_without_import.css.optimized.css
deleted file mode 100644
index 6296378..0000000
--- a/core/tests/Drupal/Tests/Core/Asset/css_test_files/css_input_without_import.css.optimized.css
+++ /dev/null
@@ -1,4 +0,0 @@
-body{margin:0;padding:0;background:#edf5fa;font:76%/170% Verdana,sans-serif;color:#494949;}.this .is .a .test{font:1em/100% Verdana,sans-serif;color:#494949;}.this
-.is
-.a
-.test{font:1em/100% Verdana,sans-serif;color:#494949;}some :pseudo .thing{border-radius:3px;}::-moz-selection{background:#000;color:#fff;}::selection{background:#000;color:#fff;}@media print{*{background:#000 !important;color:#fff !important;}@page{margin:0.5cm;}}@media screen and (max-device-width:480px){background:#000;color:#fff;}textarea,select{font:1em/160% Verdana,sans-serif;color:#494949;}
diff --git a/core/tests/Drupal/Tests/Core/Asset/css_test_files/import1.css b/core/tests/Drupal/Tests/Core/Asset/css_test_files/import1.css
deleted file mode 100644
index 3d5842e..0000000
--- a/core/tests/Drupal/Tests/Core/Asset/css_test_files/import1.css
+++ /dev/null
@@ -1,6 +0,0 @@
-
-ul, select {
-  font: 1em/160% Verdana, sans-serif;
-  color: #494949;
-}
-.ui-icon{background-image: url(images/icon.png);}
\ No newline at end of file
diff --git a/core/tests/Drupal/Tests/Core/Asset/css_test_files/import2.css b/core/tests/Drupal/Tests/Core/Asset/css_test_files/import2.css
deleted file mode 100644
index 367eb57..0000000
--- a/core/tests/Drupal/Tests/Core/Asset/css_test_files/import2.css
+++ /dev/null
@@ -1,5 +0,0 @@
-
-p, select {
-  font: 1em/160% Verdana, sans-serif;
-  color: #494949;
-}
diff --git a/core/tests/Drupal/Tests/Core/Config/CachedStorageTest.php b/core/tests/Drupal/Tests/Core/Config/CachedStorageTest.php
deleted file mode 100644
index e9e32f1..0000000
--- a/core/tests/Drupal/Tests/Core/Config/CachedStorageTest.php
+++ /dev/null
@@ -1,118 +0,0 @@
-<?php
-
-namespace Drupal\Tests\Core\Config;
-
-use Drupal\Tests\UnitTestCase;
-use Drupal\Core\Config\CachedStorage;
-use Drupal\Core\Cache\MemoryBackend;
-use Drupal\Core\Cache\NullBackend;
-use Drupal\Core\Cache\CacheBackendInterface;
-
-/**
- * Tests the interaction of cache and file storage in CachedStorage.
- *
- * @group Config
- */
-class CachedStorageTest extends UnitTestCase {
-
-  public static function getInfo() {
-    return array(
-      'name' => 'Config cached storage test',
-      'description' => 'Tests the interaction of cache and file storage in CachedStorage.',
-      'group' => 'Configuration'
-    );
-  }
-
-  /**
-   * Test listAll static cache.
-   */
-  public function testListAllStaticCache() {
-    $prefix = __FUNCTION__;
-    $storage = $this->getMock('Drupal\Core\Config\StorageInterface');
-
-    $response = array("$prefix." . $this->randomName(), "$prefix." . $this->randomName());
-    $storage->expects($this->once())
-      ->method('listAll')
-      ->with($prefix)
-      ->will($this->returnValue($response));
-
-    $cache = new NullBackend(__FUNCTION__);
-    $cachedStorage = new CachedStorage($storage, $cache);
-    $this->assertEquals($response, $cachedStorage->listAll($prefix));
-    $this->assertEquals($response, $cachedStorage->listAll($prefix));
-  }
-
-  /**
-   * Test CachedStorage::listAll() persistent cache.
-   */
-  public function testListAllPrimedPersistentCache() {
-    $prefix = __FUNCTION__;
-    $storage = $this->getMock('Drupal\Core\Config\StorageInterface');
-    $storage->expects($this->never())->method('listAll');
-
-    $response = array("$prefix." . $this->randomName(), "$prefix." . $this->randomName());
-    $cache = new MemoryBackend(__FUNCTION__);
-    $cache->set('find:' . $prefix, $response);
-    $cachedStorage = new CachedStorage($storage, $cache);
-    $this->assertEquals($response, $cachedStorage->listAll($prefix));
-  }
-
-  /**
-   * Test that we don't fall through to file storage with a primed cache.
-   */
-  public function testGetMultipleOnPrimedCache() {
-    $configNames = array(
-      'foo.bar',
-      'baz.back',
-    );
-    $configCacheValues = array(
-      'foo.bar' => (object) array(
-        'data' => array('foo' => 'bar'),
-      ),
-      'baz.back' => (object) array(
-        'data' => array('foo' => 'bar'),
-      ),
-    );
-    $storage = $this->getMock('Drupal\Core\Config\StorageInterface');
-    $storage->expects($this->never())->method('readMultiple');
-    $cache = new MemoryBackend(__FUNCTION__);
-    foreach ($configCacheValues as $key => $value) {
-      $cache->set($key, $value);
-    }
-    $cachedStorage = new CachedStorage($storage, $cache);
-    $this->assertEquals($configCacheValues, $cachedStorage->readMultiple($configNames));
-  }
-
-  /**
-   * Test fall through to file storage on a cache miss.
-   */
-  public function testGetMultipleOnPartiallyPrimedCache() {
-    $configNames = array(
-      'foo.bar',
-      'baz.back',
-      $this->randomName() . '. ' . $this->randomName(),
-    );
-    $configCacheValues = array(
-      'foo.bar' => (object) array(
-        'data' => array('foo' => 'bar'),
-      ),
-      'baz.back' => (object) array(
-        'data' => array('foo' => 'bar'),
-      ),
-    );
-    $cache = new MemoryBackend(__FUNCTION__);
-    foreach ($configCacheValues as $key => $value) {
-      $cache->set($key, $value);
-    }
-
-    $response = array($configNames[2] => array($this->randomName()));
-    $storage = $this->getMock('Drupal\Core\Config\StorageInterface');
-    $storage->expects($this->once())
-      ->method('readMultiple')
-      ->with(array(2 => $configNames[2]))
-      ->will($this->returnValue($response));
-
-    $cachedStorage = new CachedStorage($storage, $cache);
-    $this->assertEquals($configCacheValues + $response, $cachedStorage->readMultiple($configNames));
-  }
-}
diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityAccessCheckTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityAccessCheckTest.php
index 563a237..895a198 100644
--- a/core/tests/Drupal/Tests/Core/Entity/EntityAccessCheckTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/EntityAccessCheckTest.php
@@ -28,11 +28,28 @@ public static function getInfo() {
   }
 
   /**
-   * Tests the appliesTo method for the access checker.
+   * Tests the method for checking if the access check applies to a route.
    */
-  public function testAppliesTo() {
-    $entity_access = new EntityAccessCheck();
-    $this->assertEquals($entity_access->appliesTo(), array('_entity_access'), 'Access checker returned the expected appliesTo() array.');
+  public function testApplies() {
+    $applies_check = new EntityAccessCheck();
+
+    $route = $this->getMockBuilder('Symfony\Component\Routing\Route')
+      ->disableOriginalConstructor()
+      ->getMock();
+    $route->expects($this->any())
+      ->method('getRequirements')
+      ->will($this->returnValue(array('_entity_access' => '')));
+    $res = $applies_check->applies($route);
+    $this->assertEquals(TRUE, $res);
+
+    $route = $this->getMockBuilder('Symfony\Component\Routing\Route')
+      ->disableOriginalConstructor()
+      ->getMock();
+    $route->expects($this->any())
+      ->method('getRequirements')
+      ->will($this->returnValue(array()));
+    $res = $applies_check->applies($route);
+    $this->assertEquals(FALSE, $res);
   }
 
   /**
diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityCreateAccessCheckTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityCreateAccessCheckTest.php
index d5f50d0..0d4689e 100644
--- a/core/tests/Drupal/Tests/Core/Entity/EntityCreateAccessCheckTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/EntityCreateAccessCheckTest.php
@@ -44,16 +44,34 @@ protected function setUp() {
   }
 
   /**
-   * Tests the appliesTo method for the access checker.
+   * Tests the method for checking if the access check applies to a route.
    */
-  public function testAppliesTo() {
+  public function testApplies() {
     $entity_manager = $this->getMockBuilder('Drupal\Core\Entity\EntityManager')
       ->disableOriginalConstructor()
       ->getMock();
 
-    $entity_access = new EntityCreateAccessCheck($entity_manager);
-    $this->assertEquals($entity_access->appliesTo(), array('_entity_create_access'), 'Access checker returned the expected appliesTo() array.');
+    $applies_check = new EntityCreateAccessCheck($entity_manager);
+
+    $route = $this->getMockBuilder('Symfony\Component\Routing\Route')
+      ->disableOriginalConstructor()
+      ->getMock();
+    $route->expects($this->any())
+      ->method('getRequirements')
+      ->will($this->returnValue(array('_entity_create_access' => '')));
+    $res = $applies_check->applies($route);
+    $this->assertEquals(TRUE, $res);
+
+    $route = $this->getMockBuilder('Symfony\Component\Routing\Route')
+      ->disableOriginalConstructor()
+      ->getMock();
+    $route->expects($this->any())
+      ->method('getRequirements')
+      ->will($this->returnValue(array()));
+    $res = $applies_check->applies($route);
+    $this->assertEquals(FALSE, $res);
   }
+
   /**
    * Provides test data for testAccess.
    *
@@ -82,13 +100,28 @@ public function testAccess($entity_bundle, $requirement, $access, $expected) {
       ->disableOriginalConstructor()
       ->getMock();
 
+    $entity_manager->expects($this->any())
+      ->method('getDefinition')
+      ->with($this->equalTo('entity_test'))
+      ->will($this->returnValue(array('entity_keys' => array('bundle' => 'type'))));
+
+    $storage_controller = $this->getMock('Drupal\Core\Entity\EntityStorageControllerInterface');
+    $values = $entity_bundle ? array('type' => $entity_bundle) : array();
+    $storage_controller->expects($this->any())
+      ->method('create')
+      ->with($this->equalTo($values))
+      ->will($this->returnValue($entity));
+
     $access_controller = $this->getMock('Drupal\Core\Entity\EntityAccessControllerInterface');
     $access_controller->expects($this->once())
-      ->method('createAccess')
-      ->with($entity_bundle)
+      ->method('access')
+      ->with($entity, 'create')
       ->will($this->returnValue($access));
 
     $entity_manager->expects($this->any())
+      ->method('getStorageController')
+      ->will($this->returnValue($storage_controller));
+    $entity_manager->expects($this->any())
       ->method('getAccessController')
       ->will($this->returnValue($access_controller));
 
diff --git a/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php b/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php
deleted file mode 100644
index 5d61a9c..0000000
--- a/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php
+++ /dev/null
@@ -1,207 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\Tests\Core\Menu\LocalTaskManagerTest.
- */
-
-namespace Drupal\Tests\Core\Menu;
-
-use Drupal\Component\Plugin\Factory\DefaultFactory;
-use Drupal\system\Plugin\Type\MenuLocalTaskManager;
-use Drupal\Tests\UnitTestCase;
-use Symfony\Component\HttpFoundation\Request;
-use Zend\Stdlib\ArrayObject;
-
-/**
- * Tests local tasks manager.
- *
- * @see \Drupal\system\Plugin\Type\MenuLocalTaskManager
- */
-class LocalTaskManagerTest extends UnitTestCase {
-
-  /**
-   * The tested manager.
-   *
-   * @var \Drupal\system\Plugin\Type\MenuLocalTaskManager
-   */
-  protected $manager;
-
-  /**
-   * The mocked controller resolver.
-   *
-   * @var \PHPUnit_Framework_MockObject_MockObject
-   */
-  protected $controllerResolver;
-
-  /**
-   * The test request.
-   *
-   * @var \Symfony\Component\HttpFoundation\Request
-   */
-  protected $request;
-
-  /**
-   * The mocked route provider.
-   *
-   * @var \PHPUnit_Framework_MockObject_MockObject
-   */
-  protected $routeProvider;
-
-  /**
-   * The mocked plugin discovery.
-   *
-   * @var \PHPUnit_Framework_MockObject_MockObject
-   */
-  protected $pluginDiscovery;
-
-  /**
-   * The plugin factory used in the test.
-   *
-   * @var \PHPUnit_Framework_MockObject_MockObject
-   */
-  protected $factory;
-
-  public static function getInfo() {
-    return array(
-      'name' => 'Local tasks manager.',
-      'description' => 'Tests local tasks manager.',
-      'group' => 'Menu',
-    );
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  protected function setUp() {
-    parent::setUp();
-
-    $this->controllerResolver = $this->getMock('Symfony\Component\HttpKernel\Controller\ControllerResolverInterface');
-    $this->request = new Request();
-    $this->routeProvider = $this->getMock('Drupal\Core\Routing\RouteProviderInterface');
-    $this->pluginDiscovery = $this->getMock('Drupal\Component\Plugin\Discovery\DiscoveryInterface');
-    $this->factory = $this->getMock('Drupal\Component\Plugin\Factory\FactoryInterface');
-
-    $this->setupLocalTaskManager();
-  }
-
-  /**
-   * Tests the getLocalTasksForRoute method.
-   *
-   * @see \Drupal\system\Plugin\Type\MenuLocalTaskManager::getLocalTasksForRoute()
-   */
-  public function testGetLocalTasksForRouteSingleLevelTitle() {
-    $definitions = array();
-    $definitions['menu_local_task_test_tasks_settings'] = array(
-      'id' => 'menu_local_task_test_tasks_settings',
-      'route_name' => 'menu_local_task_test_tasks_settings',
-      'title' => 'Settings',
-      'tab_root_id' => 'menu_local_task_test_tasks_view',
-      'class' => 'Drupal\menu_test\Plugin\Menu\MenuLocalTasksTestTasksSettings',
-    );
-    $definitions['menu_local_task_test_tasks_edit'] = array(
-      'id' => 'menu_local_task_test_tasks_edit',
-      'route_name' => 'menu_local_task_test_tasks_edit',
-      'title' => 'Settings',
-      'tab_root_id' => 'menu_local_task_test_tasks_view',
-      'class' => 'Drupal\menu_test\Plugin\Menu\MenuLocalTasksTestTasksEdit',
-      'weight' => 20,
-    );
-    $definitions['menu_local_task_test_tasks_view'] = array(
-      'id' => 'menu_local_task_test_tasks_view',
-      'route_name' => 'menu_local_task_test_tasks_view',
-      'title' => 'Settings',
-      'tab_root_id' => 'menu_local_task_test_tasks_view',
-      'class' => 'Drupal\menu_test\Plugin\Menu\MenuLocalTasksTestTasksView',
-    );
-
-    $this->pluginDiscovery->expects($this->any())
-      ->method('getDefinitions')
-      ->will($this->returnValue($definitions));
-
-    $mock_plugin = $this->getMock('Drupal\Core\Menu\LocalTaskInterface');
-
-    $map = array(
-      array('menu_local_task_test_tasks_settings', array(), $mock_plugin),
-      array('menu_local_task_test_tasks_edit', array(), $mock_plugin),
-      array('menu_local_task_test_tasks_view', array(), $mock_plugin),
-    );
-    $this->factory->expects($this->any())
-      ->method('createInstance')
-      ->will($this->returnValueMap($map));
-
-    $this->setupLocalTaskManager();
-
-    $local_tasks = $this->manager->getLocalTasksForRoute('menu_local_task_test_tasks_view');
-    $this->assertEquals(array(0 => array(
-      'menu_local_task_test_tasks_settings' => $mock_plugin,
-      'menu_local_task_test_tasks_view' => $mock_plugin,
-      'menu_local_task_test_tasks_edit' => $mock_plugin,
-    )), $local_tasks);
-  }
-
-  /**
-   * Tests the getTitle method.
-   *
-   * @see \Drupal\system\Plugin\Type\MenuLocalTaskManager::getTitle()
-   */
-  public function testGetTitle() {
-    $menu_local_task = $this->getMock('Drupal\Core\Menu\LocalTaskInterface');
-    $menu_local_task->expects($this->once())
-      ->method('getTitle');
-
-    $this->controllerResolver->expects($this->once())
-      ->method('getArguments')
-      ->with($this->request, array($menu_local_task, 'getTitle'))
-      ->will($this->returnValue(array()));
-
-    $this->manager->getTitle($menu_local_task);
-  }
-
-  /**
-   * Tests the getPath method.
-   *
-   * @see \Drupal\system\Plugin\Type\MenuLocalTaskManager::getPath()
-   */
-  public function testGetPath() {
-    $menu_local_task = $this->getMock('Drupal\Core\Menu\LocalTaskInterface');
-    $menu_local_task->expects($this->once())
-      ->method('getPath');
-
-    $this->controllerResolver->expects($this->once())
-      ->method('getArguments')
-      ->with($this->request, array($menu_local_task, 'getPath'))
-      ->will($this->returnValue(array()));
-
-    $this->manager->getPath($menu_local_task);
-  }
-
-  /**
-   * Setups the local task manager for the test.
-   */
-  protected function setupLocalTaskManager() {
-    $this->manager = $this
-      ->getMockBuilder('Drupal\Core\Menu\LocalTaskManager')
-      ->disableOriginalConstructor()
-      ->setMethods(NULL)
-      ->getMock();
-
-    $property = new \ReflectionProperty('Drupal\Core\Menu\LocalTaskManager', 'controllerResolver');
-    $property->setAccessible(TRUE);
-    $property->setValue($this->manager, $this->controllerResolver);
-
-    $property = new \ReflectionProperty('Drupal\Core\Menu\LocalTaskManager', 'request');
-    $property->setAccessible(TRUE);
-    $property->setValue($this->manager, $this->request);
-
-    $property = new \ReflectionProperty('Drupal\Core\Menu\LocalTaskManager', 'discovery');
-    $property->setAccessible(TRUE);
-    $property->setValue($this->manager, $this->pluginDiscovery);
-
-    $property = new \ReflectionProperty('Drupal\Core\Menu\LocalTaskManager', 'factory');
-    $property->setAccessible(TRUE);
-    $property->setValue($this->manager, $this->factory);
-  }
-
-}
-
diff --git a/core/tests/Drupal/Tests/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecoratorTest.php b/core/tests/Drupal/Tests/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecoratorTest.php
deleted file mode 100644
index 5a53a69..0000000
--- a/core/tests/Drupal/Tests/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecoratorTest.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\Tests\Core\Plugin\Discovery\ContainerDerivativeDiscoveryDecoratorTest.
- */
-
-namespace Drupal\Tests\Core\Plugin\Discovery;
-
-use Drupal\Core\Plugin\Discovery\ContainerDerivativeDiscoveryDecorator;
-use Drupal\Tests\UnitTestCase;
-
-/**
- * Tests the container aware derivative discovery decorator.
- */
-class ContainerDerivativeDiscoveryDecoratorTest extends UnitTestCase {
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function getInfo() {
-    return array(
-      'name' => 'Container aware derivative discovery decorator.',
-      'description' => 'Tests the container aware derivative discovery decorator.',
-      'group' => 'Plugin',
-    );
-  }
-
-  /**
-   * Tests the getDerivativeFetcher method.
-   *
-   * @see \Drupal\Core\Plugin\Discovery\ContainerDerivativeDiscoveryDecorator::getDerivativeFetcher().
-   */
-  public function testGetDerivativeFetcher() {
-    $example_service = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
-    $example_container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')
-      ->setMethods(array('get'))
-      ->getMock();
-    $example_container->expects($this->once())
-      ->method('get')
-      ->with($this->equalTo('example_service'))
-      ->will($this->returnValue($example_service));
-
-    \Drupal::setContainer($example_container);
-
-    $definitions = array();
-    $definitions['container_aware_discovery'] = array(
-      'id' => 'container_aware_discovery',
-      'derivative' => '\Drupal\Tests\Core\Plugin\Discovery\TestContainerDerivativeDiscovery',
-    );
-    $definitions['non_container_aware_discovery'] = array(
-      'id' => 'non_container_aware_discovery',
-      'derivative' => '\Drupal\Tests\Core\Plugin\Discovery\TestDerivativeDiscovery',
-    );
-
-    $discovery_main = $this->getMock('Drupal\Component\Plugin\Discovery\DiscoveryInterface');
-    $discovery_main->expects($this->any())
-      ->method('getDefinitions')
-      ->will($this->returnValue($definitions));
-
-    $discovery = new ContainerDerivativeDiscoveryDecorator($discovery_main);
-    $definitions = $discovery->getDefinitions();
-
-    // Ensure that both the instances from container and non-container test derivatives got added.
-    $this->assertEquals(4, count($definitions));
-  }
-
-}
diff --git a/core/tests/Drupal/Tests/Core/Plugin/Discovery/TestContainerDerivativeDiscovery.php b/core/tests/Drupal/Tests/Core/Plugin/Discovery/TestContainerDerivativeDiscovery.php
deleted file mode 100644
index 88bebf2..0000000
--- a/core/tests/Drupal/Tests/Core/Plugin/Discovery/TestContainerDerivativeDiscovery.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\Tests\Core\Plugin\Discovery\TestContainerDerivativeDiscovery.
- */
-
-namespace Drupal\Tests\Core\Plugin\Discovery;
-
-use Drupal\Core\Plugin\Discovery\ContainerDerivativeInterface;
-use Symfony\Component\DependencyInjection\ContainerInterface;
-use Symfony\Component\EventDispatcher\EventDispatcherInterface;
-
-/**
- * Defines container test derivative discovery.
- */
-class TestContainerDerivativeDiscovery extends TestDerivativeDiscovery implements ContainerDerivativeInterface {
-
-  /**
-   * Constructs a TestContainerDerivativeDiscovery object.
-   *
-   * @var \Symfony\Component\EventDispatcher\EventDispatcherInterface $example_service
-   *   Some service.
-   */
-  public function __construct(EventDispatcherInterface $example_service) {
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function create(ContainerInterface $container, $base_plugin_id) {
-    return new static($container->get('example_service'));
-  }
-
-}
diff --git a/core/tests/Drupal/Tests/Core/Plugin/Discovery/TestDerivativeDiscovery.php b/core/tests/Drupal/Tests/Core/Plugin/Discovery/TestDerivativeDiscovery.php
deleted file mode 100644
index d0b8218..0000000
--- a/core/tests/Drupal/Tests/Core/Plugin/Discovery/TestDerivativeDiscovery.php
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\Tests\Core\Plugin\Discovery\TestDiscovery.
- */
-
-namespace Drupal\Tests\Core\Plugin\Discovery;
-
-use Drupal\Component\Plugin\Derivative\DerivativeInterface;
-
-/**
- * Defines test derivative discovery.
- */
-class TestDerivativeDiscovery implements DerivativeInterface {
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getDerivativeDefinition($derivative_id, array $base_plugin_definition) {
-    $definitions = $this->getDerivativeDefinitions($base_plugin_definition);
-    return $definitions[$derivative_id];
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getDerivativeDefinitions(array $base_plugin_definition) {
-    $plugins = array();
-    for ($i = 0; $i < 2; $i++) {
-      $plugins['test_discovery_' . $i] = $base_plugin_definition;
-    }
-    return $plugins;
-  }
-
-}
diff --git a/core/tests/Drupal/Tests/Core/Route/RoleAccessCheckTest.php b/core/tests/Drupal/Tests/Core/Route/RoleAccessCheckTest.php
index 97b6e23..a0ba259 100644
--- a/core/tests/Drupal/Tests/Core/Route/RoleAccessCheckTest.php
+++ b/core/tests/Drupal/Tests/Core/Route/RoleAccessCheckTest.php
@@ -9,9 +9,9 @@
 
 use Drupal\Core\Access\AccessCheckInterface;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
-use Drupal\Core\Session\UserSession;
 use Drupal\Tests\UnitTestCase;
 use Drupal\user\Access\RoleAccessCheck;
+use Drupal\user\Plugin\Core\Entity\User;
 use Symfony\Component\DependencyInjection\Container;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpKernel\HttpKernelInterface;
@@ -108,25 +108,25 @@ public function roleAccessProvider() {
     // Setup one user with the first role, one with the second, one with both
     // and one final without any of these two roles.
 
-    $account_1 = new UserSession(array(
+    $account_1 = (object) array(
       'uid' => 1,
       'roles' => array($rid_1),
-    ));
+    );
 
-    $account_2 = new UserSession(array(
+    $account_2 = (object) array(
       'uid' => 2,
       'roles' => array($rid_2),
-    ));
+    );
 
-    $account_12 = new UserSession(array(
+    $account_12 = (object) array(
       'uid' => 3,
       'roles' => array($rid_1, $rid_2),
-    ));
+    );
 
-    $account_none = new UserSession(array(
+    $account_none = (object) array(
       'uid' => 1,
       'roles' => array(),
-    ));
+    );
 
     // Setup expected values; specify which paths can be accessed by which user.
     return array(
@@ -169,7 +169,7 @@ public function testRoleAccess($path, $grant_accounts, $deny_accounts) {
     foreach ($deny_accounts as $account) {
       $subrequest = Request::create($path, 'GET');
       $subrequest->attributes->set('account', $account);
-      $message = sprintf('Access denied for user %s with the roles %s on path: %s', $account->id(), implode(', ', $account->roles), $path);
+      $message = sprintf('Access denied for user %s with the roles %s on path: %s', $account->uid, implode(', ', $account->roles), $path);
       $has_access = $role_access_check->access($collection->get($path), $subrequest);
       $this->assertSame(AccessCheckInterface::DENY, $has_access , $message);
     }
diff --git a/core/tests/Drupal/Tests/Core/Session/UserSessionTest.php b/core/tests/Drupal/Tests/Core/Session/UserSessionTest.php
deleted file mode 100644
index 1c26b56..0000000
--- a/core/tests/Drupal/Tests/Core/Session/UserSessionTest.php
+++ /dev/null
@@ -1,156 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\Tests\Core\Session\UserSessionTest.
- */
-
-namespace Drupal\Tests\Core\Session;
-
-use Drupal\Core\DependencyInjection\ContainerBuilder;
-use Drupal\Core\Session\UserSession;
-use Drupal\Tests\UnitTestCase;
-
-/**
- * Tests the user session object.
- *
- * @see \Drupal\Core\Session\UserSession
- */
-class UserSessionTest extends UnitTestCase {
-
-  /**
-   * The user sessions used in the test
-   *
-   * @var \Drupal\Core\Session\AccountInterface[]
-   */
-  protected $users = array();
-
-  public static function getInfo() {
-    return array(
-      'name' => 'User session object',
-      'description' => 'Tests the user session object.',
-      'group' => 'Session',
-    );
-  }
-
-  /**
-   * Provides test data for getHasPermission().
-   *
-   * @return array
-   */
-  public function providerTestHasPermission() {
-    $data = array();
-    $data[] = array('example permission', array('user_one', 'user_two'), array('user_last'));
-    $data[] = array('another example permission', array('user_two'), array('user_one', 'user_last'));
-    $data[] = array('final example permission', array(), array('user_one', 'user_two', 'user_last'));
-
-    return $data;
-  }
-
-  /**
-   * Setups a user session for the test.
-   *
-   * @param array $rids
-   *   The rids of the user.
-   *
-   * @return \Drupal\Core\Session\AccountInterface
-   *   The created user session.
-   */
-  protected function createUserSession(array $rids = array()) {
-    return new UserSession(array('roles' => $rids));
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  protected function setUp() {
-    parent::setUp();
-
-    $roles = array();
-    $roles['role_one'] = $this->getMockBuilder('Drupal\user\Plugin\Core\Entity\Role')
-      ->disableOriginalConstructor()
-      ->setMethods(array('hasPermission'))
-      ->getMock();
-    $roles['role_one']->expects($this->any())
-      ->method('hasPermission')
-      ->will($this->returnValueMap(array(
-        array('example permission', TRUE),
-        array('another example permission', FALSE),
-        array('last example permission', FALSE),
-      )));
-
-    $roles['role_two'] = $this->getMockBuilder('Drupal\user\Plugin\Core\Entity\Role')
-      ->disableOriginalConstructor()
-      ->setMethods(array('hasPermission'))
-      ->getMock();
-    $roles['role_two']->expects($this->any())
-      ->method('hasPermission')
-      ->will($this->returnValueMap(array(
-        array('example permission', TRUE),
-        array('another example permission', TRUE),
-        array('last example permission', FALSE),
-      )));
-
-    $role_storage = $this->getMockBuilder('Drupal\user\RoleStorageController')
-      ->disableOriginalConstructor()
-      ->setMethods(array('loadMultiple'))
-      ->getMock();
-    $role_storage->expects($this->any())
-      ->method('loadMultiple')
-      ->will($this->returnValueMap(array(
-        array(array(), array()),
-        array(NULL, $roles),
-        array(array('role_one'), array($roles['role_one'])),
-        array(array('role_two'), array($roles['role_two'])),
-        array(array('role_one', 'role_two'), array($roles['role_one'], $roles['role_two'])),
-      )));
-
-    $entity_manager = $this->getMockBuilder('Drupal\Core\Entity\EntityManager')
-      ->disableOriginalConstructor()
-      ->getMock();
-    $entity_manager->expects($this->any())
-      ->method('getStorageController')
-      ->with($this->equalTo('user_role'))
-      ->will($this->returnValue($role_storage));
-    $container = new ContainerBuilder();
-    $container->set('plugin.manager.entity', $entity_manager);
-    \Drupal::setContainer($container);
-
-    $this->users['user_one'] = $this->createUserSession(array('role_one'));
-    $this->users['user_two'] = $this->createUserSession(array('role_one', 'role_two'));
-    $this->users['user_last'] = $this->createUserSession();
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  protected function tearDown() {
-    parent::tearDown();
-    $container = new ContainerBuilder();
-    \Drupal::setContainer($container);
-  }
-
-  /**
-   * Tests the has permission method.
-   *
-   * @param string $permission
-   *   The permission to check.
-   * @param \Drupal\Core\Session\AccountInterface[] $sessions_with_access
-   *   The users with access.
-   * @param \Drupal\Core\Session\AccountInterface[] $sessions_without_access
-   *   The users without access.
-   *
-   * @dataProvider providerTestHasPermission
-   *
-   * @see \Drupal\Core\Session\UserSession::hasPermission().
-   */
-  public function testHasPermission($permission, array $sessions_with_access, array $sessions_without_access) {
-    foreach ($sessions_with_access as $name) {
-      $this->assertTrue($this->users[$name]->hasPermission($permission));
-    }
-    foreach ($sessions_without_access as $name) {
-      $this->assertFalse($this->users[$name]->hasPermission($permission));
-    }
-  }
-
-}
diff --git a/core/themes/seven/install-page.css b/core/themes/seven/install-page.css
index a4761fb..69cfcbc 100644
--- a/core/themes/seven/install-page.css
+++ b/core/themes/seven/install-page.css
@@ -75,9 +75,6 @@ body.install-page {
     float: left;
     width: 35%;
   }
-  [dir="rtl"] body.install-page #sidebar-first {
-    float: right;
-  }
 }
 body.install-page #site-name {
   font-size: 2em;
diff --git a/core/themes/seven/seven.theme b/core/themes/seven/seven.theme
index a3caa09..d3f6567 100644
--- a/core/themes/seven/seven.theme
+++ b/core/themes/seven/seven.theme
@@ -5,36 +5,34 @@
  * Functions to support theming in the Seven theme.
  */
 
-use Drupal\Core\Template\RenderWrapper;
-
 /**
  * Implements hook_preprocess_HOOK() for maintenance-page.html.twig.
  */
-function seven_preprocess_maintenance_page(&$variables) {
+function seven_preprocess_maintenance_page(&$vars) {
   // While markup for normal pages is split into page.tpl.php and html.tpl.php,
   // the markup for the maintenance page is all in the single
   // maintenance-page.html.twig template. So, to have what's done in
   // seven_preprocess_html() also happen on the maintenance page, it has to be
   // called here.
-  seven_preprocess_html($variables);
+  seven_preprocess_html($vars);
 }
 
 /**
  * Implements hook_preprocess_HOOK() for html.tpl.php.
  */
-function seven_preprocess_html(&$variables) {
+function seven_preprocess_html(&$vars) {
   drupal_add_library('system', 'normalize');
 }
 
 /**
  * Implements hook_preprocess_HOOK() for page.tpl.php.
  */
-function seven_preprocess_page(&$variables) {
-  $variables['primary_local_tasks'] = $variables['tabs'];
-  unset($variables['primary_local_tasks']['#secondary']);
-  $variables['secondary_local_tasks'] = array(
+function seven_preprocess_page(&$vars) {
+  $vars['primary_local_tasks'] = $vars['tabs'];
+  unset($vars['primary_local_tasks']['#secondary']);
+  $vars['secondary_local_tasks'] = array(
     '#theme' => 'menu_local_tasks',
-    '#secondary' => isset($variables['tabs']['#secondary']) ? $variables['tabs']['#secondary'] : '',
+    '#secondary' => isset($vars['tabs']['#secondary']) ? $vars['tabs']['#secondary'] : '',
   );
 }
 
@@ -146,8 +144,8 @@ function seven_tablesort_indicator($variables) {
 function seven_preprocess_install_page(&$variables) {
   drupal_add_js(drupal_get_path('theme', 'seven') . '/js/mobile.install.js');
   drupal_add_css(drupal_get_path('theme', 'seven') . '/install-page.css', array('group' => CSS_AGGREGATE_THEME));
-  $variables['styles'] = new RenderWrapper('drupal_get_css');
-  $variables['scripts'] = new RenderWrapper('drupal_get_js');
+  $variables['styles'] = drupal_get_css();
+  $variables['scripts'] = drupal_get_js();
 }
 
 /**
diff --git a/core/update.php b/core/update.php
index fba6b86..b74e226 100644
--- a/core/update.php
+++ b/core/update.php
@@ -354,7 +354,7 @@ function update_access_allowed() {
     return user_access('administer software updates');
   }
   catch (\Exception $e) {
-    return ($user->id() == 1);
+    return ($user->uid == 1);
   }
 }
 
