From 7f2710bea80a8912aaddeccdd2e22e12abd950b5 Mon Sep 17 00:00:00 2001
From: Alex Pott <alex.a.pott@googlemail.com>
Date: Thu, 21 Aug 2014 12:20:41 +0100
Subject: [PATCH] Issue #2315333 by tim.plunkett: Move block plugin code out of
 block.module.

---
 core/core.services.yml                        |  3 ++
 .../Drupal/Core/Block}/Annotation/Block.php   |  4 +-
 .../Drupal/Core/Block}/BlockBase.php          | 11 ++--
 .../Drupal/Core/Block}/BlockManager.php       | 16 +++---
 .../Core/Block}/BlockManagerInterface.php     |  4 +-
 .../Core/Block}/BlockPluginInterface.php      | 12 ++---
 .../Core/Extension/ThemeHandlerInterface.php  |  8 +++
 .../src/Plugin/Block/AggregatorFeedBlock.php  |  2 +-
 core/modules/block/block.api.php              | 16 +++---
 core/modules/block/block.services.yml         |  3 --
 core/modules/block/src/BlockInterface.php     |  2 +-
 core/modules/block/src/BlockListBuilder.php   |  6 +--
 core/modules/block/src/BlockPluginBag.php     |  2 +-
 .../CategoryAutocompleteController.php        |  6 +--
 .../src/Event/BlockConditionContextEvent.php  |  2 +-
 core/modules/block/src/Event/BlockEvents.php  |  2 +-
 .../block/src/Tests/BlockConfigSchemaTest.php |  2 +-
 .../block/src/Tests/BlockInterfaceTest.php    |  2 +-
 .../modules/block_test/block_test.module      |  2 +-
 .../Plugin/Block/TestBlockInstantiation.php   |  2 +-
 .../src/Plugin/Block/TestCacheBlock.php       |  2 +-
 .../Plugin/Block/TestContextAwareBlock.php    |  2 +-
 .../src/Plugin/Block/TestHtmlBlock.php        |  2 +-
 .../tests/src/CategoryAutocompleteTest.php    |  2 +-
 .../src/Plugin/Block/BlockContentBlock.php    | 10 ++--
 .../src/Plugin/Block/BookNavigationBlock.php  |  2 +-
 .../forum/src/Plugin/Block/ForumBlockBase.php |  2 +-
 core/modules/language/language.admin.inc      | 18 -------
 .../src/Form/NegotiationConfigureForm.php     | 52 ++++++++++++++-----
 .../src/Plugin/Block/LanguageBlock.php        |  2 +-
 core/modules/menu_ui/menu_ui.module           |  2 +-
 .../node/src/Plugin/Block/SyndicateBlock.php  |  2 +-
 .../search/src/Plugin/Block/SearchBlock.php   |  2 +-
 .../src/Plugin/Block/ShortcutsBlock.php       |  2 +-
 .../Plugin/Block/StatisticsPopularBlock.php   |  2 +-
 .../system/src/Form/PerformanceForm.php       |  2 +-
 .../src/Plugin/Block/SystemBrandingBlock.php  |  2 +-
 .../Plugin/Block/SystemBreadcrumbBlock.php    |  2 +-
 .../src/Plugin/Block/SystemHelpBlock.php      |  2 +-
 .../src/Plugin/Block/SystemMainBlock.php      |  2 +-
 .../src/Plugin/Block/SystemMenuBlock.php      |  2 +-
 .../src/Plugin/Block/SystemPoweredByBlock.php |  2 +-
 core/modules/system/system.module             |  2 +-
 .../src/Plugin/Block/RedirectFormBlock.php    |  2 +-
 .../user/src/Plugin/Block/UserLoginBlock.php  |  2 +-
 .../views/src/Plugin/Block/ViewsBlockBase.php |  2 +-
 .../src/Plugin/views/display/Block.php        |  7 +--
 .../tests/src/Plugin/Block/ViewsBlockTest.php |  3 +-
 .../src/Plugin/views/display/BlockTest.php    | 10 ++--
 .../Tests/Core/Block}/BlockBaseTest.php       |  8 +--
 core/tests/Drupal/Tests/UnitTestCase.php      |  2 +-
 51 files changed, 136 insertions(+), 127 deletions(-)
 rename core/{modules/block/src => lib/Drupal/Core/Block}/Annotation/Block.php (89%)
 rename core/{modules/block/src => lib/Drupal/Core/Block}/BlockBase.php (98%)
 rename core/{modules/block/src => lib/Drupal/Core/Block}/BlockManager.php (86%)
 rename core/{modules/block/src => lib/Drupal/Core/Block}/BlockManagerInterface.php (88%)
 rename core/{modules/block/src => lib/Drupal/Core/Block}/BlockPluginInterface.php (94%)
 rename core/modules/{block => views}/src/Plugin/views/display/Block.php (97%)
 rename core/modules/{block => views}/tests/src/Plugin/views/display/BlockTest.php (87%)
 rename core/{modules/block/tests/src => tests/Drupal/Tests/Core/Block}/BlockBaseTest.php (94%)

diff --git a/core/core.services.yml b/core/core.services.yml
index d6263c74312c..b4e5fe324eb4 100644
--- a/core/core.services.yml
+++ b/core/core.services.yml
@@ -274,6 +274,9 @@ services:
   entity.form_builder:
     class: Drupal\Core\Entity\EntityFormBuilder
     arguments: ['@entity.manager', '@form_builder']
+  plugin.manager.block:
+    class: Drupal\Core\Block\BlockManager
+    parent: default_plugin_manager
   plugin.manager.field.field_type:
     class: Drupal\Core\Field\FieldTypePluginManager
     arguments: ['@container.namespaces', '@cache.discovery', '@module_handler']
diff --git a/core/modules/block/src/Annotation/Block.php b/core/lib/Drupal/Core/Block/Annotation/Block.php
similarity index 89%
rename from core/modules/block/src/Annotation/Block.php
rename to core/lib/Drupal/Core/Block/Annotation/Block.php
index 1f043c4f2149..e29f80dbcfb3 100644
--- a/core/modules/block/src/Annotation/Block.php
+++ b/core/lib/Drupal/Core/Block/Annotation/Block.php
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Contains \Drupal\block\Annotation\Block.
+ * Contains \Drupal\Core\Block\Annotation\Block.
  */
 
-namespace Drupal\block\Annotation;
+namespace Drupal\Core\Block\Annotation;
 
 use Drupal\Component\Annotation\Plugin;
 
diff --git a/core/modules/block/src/BlockBase.php b/core/lib/Drupal/Core/Block/BlockBase.php
similarity index 98%
rename from core/modules/block/src/BlockBase.php
rename to core/lib/Drupal/Core/Block/BlockBase.php
index a2f5e170c8e8..37d5b93d1c11 100644
--- a/core/modules/block/src/BlockBase.php
+++ b/core/lib/Drupal/Core/Block/BlockBase.php
@@ -2,11 +2,12 @@
 
 /**
  * @file
- * Contains \Drupal\block\BlockBase.
+ * Contains \Drupal\Core\Block\BlockBase.
  */
 
-namespace Drupal\block;
+namespace Drupal\Core\Block;
 
+use Drupal\block\BlockInterface;
 use Drupal\block\Event\BlockConditionContextEvent;
 use Drupal\block\Event\BlockEvents;
 use Drupal\Component\Plugin\ContextAwarePluginInterface;
@@ -198,7 +199,7 @@ protected function blockAccess(AccountInterface $account) {
    * BlockBase::blockForm(). Most block plugins should not override this
    * method unless they need to alter the generic form elements.
    *
-   * @see \Drupal\block\BlockBase::blockForm()
+   * @see \Drupal\Core\Block\BlockBase::blockForm()
    */
   public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
     $definition = $this->getPluginDefinition();
@@ -335,7 +336,7 @@ public function blockForm($form, FormStateInterface $form_state) {
    * Most block plugins should not override this method. To add validation
    * for a specific block type, override BlockBase::blockValdiate().
    *
-   * @see \Drupal\block\BlockBase::blockValidate()
+   * @see \Drupal\Core\Block\BlockBase::blockValidate()
    */
   public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
     // Remove the admin_label form item element value so it will not persist.
@@ -369,7 +370,7 @@ public function blockValidate($form, FormStateInterface $form_state) {}
    * Most block plugins should not override this method. To add submission
    * handling for a specific block type, override BlockBase::blockSubmit().
    *
-   * @see \Drupal\block\BlockBase::blockSubmit()
+   * @see \Drupal\Core\Block\BlockBase::blockSubmit()
    */
   public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
     // Process the block's submission handling if no errors occurred only.
diff --git a/core/modules/block/src/BlockManager.php b/core/lib/Drupal/Core/Block/BlockManager.php
similarity index 86%
rename from core/modules/block/src/BlockManager.php
rename to core/lib/Drupal/Core/Block/BlockManager.php
index 706af511b69a..e65d2f6bfa09 100644
--- a/core/modules/block/src/BlockManager.php
+++ b/core/lib/Drupal/Core/Block/BlockManager.php
@@ -2,16 +2,15 @@
 
 /**
  * @file
- * Contains \Drupal\block\BlockManager.
+ * Contains \Drupal\Core\Block\BlockManager.
  */
 
-namespace Drupal\block;
+namespace Drupal\Core\Block;
 
 use Drupal\Core\Cache\CacheBackendInterface;
 use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Plugin\Context\ContextAwarePluginManagerTrait;
 use Drupal\Core\Plugin\DefaultPluginManager;
-use Drupal\Core\StringTranslation\TranslationInterface;
 use Drupal\Core\StringTranslation\StringTranslationTrait;
 
 /**
@@ -19,7 +18,7 @@
  *
  * @todo Add documentation to this class.
  *
- * @see \Drupal\block\BlockPluginInterface
+ * @see \Drupal\Core\Block\BlockPluginInterface
  */
 class BlockManager extends DefaultPluginManager implements BlockManagerInterface {
 
@@ -34,7 +33,7 @@ class BlockManager extends DefaultPluginManager implements BlockManagerInterface
   protected $moduleData;
 
   /**
-   * Constructs a new \Drupal\block\BlockManager object.
+   * Constructs a new \Drupal\Core\Block\BlockManager object.
    *
    * @param \Traversable $namespaces
    *   An object that implements \Traversable which contains the root paths
@@ -43,15 +42,12 @@ class BlockManager extends DefaultPluginManager implements BlockManagerInterface
    *   Cache backend instance to use.
    * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
    *   The module handler to invoke the alter hook with.
-   * @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation
-   *   The translation manager.
    */
-  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, TranslationInterface $string_translation) {
-    parent::__construct('Plugin/Block', $namespaces, $module_handler, 'Drupal\block\Annotation\Block');
+  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
+    parent::__construct('Plugin/Block', $namespaces, $module_handler, 'Drupal\Core\Block\Annotation\Block');
 
     $this->alterInfo('block');
     $this->setCacheBackend($cache_backend, 'block_plugins');
-    $this->stringTranslation = $string_translation;
   }
 
   /**
diff --git a/core/modules/block/src/BlockManagerInterface.php b/core/lib/Drupal/Core/Block/BlockManagerInterface.php
similarity index 88%
rename from core/modules/block/src/BlockManagerInterface.php
rename to core/lib/Drupal/Core/Block/BlockManagerInterface.php
index 665600499b3d..2fa8611c3f74 100644
--- a/core/modules/block/src/BlockManagerInterface.php
+++ b/core/lib/Drupal/Core/Block/BlockManagerInterface.php
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Contains \Drupal\block\BlockManagerInterface.
+ * Contains \Drupal\Core\Block\BlockManagerInterface.
  */
 
-namespace Drupal\block;
+namespace Drupal\Core\Block;
 
 use Drupal\Core\Plugin\Context\ContextAwarePluginManagerInterface;
 
diff --git a/core/modules/block/src/BlockPluginInterface.php b/core/lib/Drupal/Core/Block/BlockPluginInterface.php
similarity index 94%
rename from core/modules/block/src/BlockPluginInterface.php
rename to core/lib/Drupal/Core/Block/BlockPluginInterface.php
index de13fe82414c..200d10de4ac4 100644
--- a/core/modules/block/src/BlockPluginInterface.php
+++ b/core/lib/Drupal/Core/Block/BlockPluginInterface.php
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Contains \Drupal\block\BlockPluginInterface.
+ * Contains \Drupal\Core\Block\BlockPluginInterface.
  */
 
-namespace Drupal\block;
+namespace Drupal\Core\Block;
 
 use Drupal\Component\Plugin\Context\ContextInterface;
 use Drupal\Component\Plugin\DerivativeInspectionInterface;
@@ -109,8 +109,8 @@ public function blockForm($form, FormStateInterface $form_state);
    * @param \Drupal\Core\Form\FormStateInterface $form_state
    *   The current state of the form.
    *
-   * @see \Drupal\block\BlockPluginInterface::blockForm()
-   * @see \Drupal\block\BlockPluginInterface::blockSubmit()
+   * @see \Drupal\Core\Block\BlockPluginInterface::blockForm()
+   * @see \Drupal\Core\Block\BlockPluginInterface::blockSubmit()
    */
   public function blockValidate($form, FormStateInterface $form_state);
 
@@ -126,8 +126,8 @@ public function blockValidate($form, FormStateInterface $form_state);
    * @param \Drupal\Core\Form\FormStateInterface $form_state
    *   The current state of the form.
    *
-   * @see \Drupal\block\BlockPluginInterface::blockForm()
-   * @see \Drupal\block\BlockPluginInterface::blockValidate()
+   * @see \Drupal\Core\Block\BlockPluginInterface::blockForm()
+   * @see \Drupal\Core\Block\BlockPluginInterface::blockValidate()
    */
   public function blockSubmit($form, FormStateInterface $form_state);
 
diff --git a/core/lib/Drupal/Core/Extension/ThemeHandlerInterface.php b/core/lib/Drupal/Core/Extension/ThemeHandlerInterface.php
index da3a6cfc2860..96b636ca647a 100644
--- a/core/lib/Drupal/Core/Extension/ThemeHandlerInterface.php
+++ b/core/lib/Drupal/Core/Extension/ThemeHandlerInterface.php
@@ -131,4 +131,12 @@ public function getBaseThemes(array $themes, $theme);
    */
   public function getName($theme);
 
+  /**
+   * Returns the default theme.
+   *
+   * @return string
+   *   The default theme.
+   */
+  public function getDefault();
+
 }
diff --git a/core/modules/aggregator/src/Plugin/Block/AggregatorFeedBlock.php b/core/modules/aggregator/src/Plugin/Block/AggregatorFeedBlock.php
index 2ead20ed4047..4fcb46440e56 100644
--- a/core/modules/aggregator/src/Plugin/Block/AggregatorFeedBlock.php
+++ b/core/modules/aggregator/src/Plugin/Block/AggregatorFeedBlock.php
@@ -10,7 +10,7 @@
 use Drupal\Component\Utility\NestedArray;
 use Drupal\aggregator\FeedStorageInterface;
 use Drupal\aggregator\ItemStorageInterface;
-use Drupal\block\BlockBase;
+use Drupal\Core\Block\BlockBase;
 use Drupal\Core\Entity\Query\QueryInterface;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
diff --git a/core/modules/block/block.api.php b/core/modules/block/block.api.php
index a33aaa9204d2..2d2f3ccf3ac3 100644
--- a/core/modules/block/block.api.php
+++ b/core/modules/block/block.api.php
@@ -17,14 +17,14 @@
  *
  * To define a block in a module you need to:
  * - Define a Block plugin by creating a new class that implements the
- *   \Drupal\block\BlockPluginInterface, in namespace Plugin\Block under your
+ *   \Drupal\Core\Block\BlockPluginInterface, in namespace Plugin\Block under your
  *   module namespace. For more information about creating plugins, see the
  *   @link plugin_api Plugin API topic. @endlink
- * - Usually you will want to extend the \Drupal\block\BlockBase class, which
+ * - Usually you will want to extend the \Drupal\Core\Block\BlockBase class, which
  *   provides a common configuration form and utility methods for getting and
  *   setting configuration in the block configuration entity.
  * - Block plugins use the annotations defined by
- *   \Drupal\block\Annotation\Block. See the
+ *   \Drupal\Core\Block\Annotation\Block. See the
  *   @link annotation Annotations topic @endlink for more information about
  *   annotations.
  *
@@ -61,7 +61,7 @@
  */
 
 /**
- * Alter the result of \Drupal\block\BlockBase::build().
+ * Alter the result of \Drupal\Core\Block\BlockBase::build().
  *
  * This hook is called after the content has been assembled in a structured
  * array and may be used for doing processing which requires that the complete
@@ -81,7 +81,7 @@
  *   A renderable array of data, as returned from the build() implementation of
  *   the plugin that defined the block:
  *   - #title: The default localized title of the block.
- * @param \Drupal\block\BlockPluginInterface $block
+ * @param \Drupal\Core\Block\BlockPluginInterface $block
  *   The block plugin instance.
  *
  * @see hook_block_view_BASE_BLOCK_ID_alter()
@@ -89,7 +89,7 @@
  *
  * @ingroup block_api
  */
-function hook_block_view_alter(array &$build, \Drupal\block\BlockPluginInterface $block) {
+function hook_block_view_alter(array &$build, \Drupal\Core\Block\BlockPluginInterface $block) {
   // Remove the contextual links on all blocks that provide them.
   if (isset($build['#contextual_links'])) {
     unset($build['#contextual_links']);
@@ -111,7 +111,7 @@ function hook_block_view_alter(array &$build, \Drupal\block\BlockPluginInterface
  *   A renderable array of data, as returned from the build() implementation of
  *   the plugin that defined the block:
  *   - #title: The default localized title of the block.
- * @param \Drupal\block\BlockPluginInterface $block
+ * @param \Drupal\Core\Block\BlockPluginInterface $block
  *   The block plugin instance.
  *
  * @see hook_block_view_alter()
@@ -119,7 +119,7 @@ function hook_block_view_alter(array &$build, \Drupal\block\BlockPluginInterface
  *
  * @ingroup block_api
  */
-function hook_block_view_BASE_BLOCK_ID_alter(array &$build, \Drupal\block\BlockPluginInterface $block) {
+function hook_block_view_BASE_BLOCK_ID_alter(array &$build, \Drupal\Core\Block\BlockPluginInterface $block) {
   // Change the title of the specific block.
   $build['#title'] = t('New title of the block');
 }
diff --git a/core/modules/block/block.services.yml b/core/modules/block/block.services.yml
index e5e58d1c2bfb..dd38a43f23dc 100644
--- a/core/modules/block/block.services.yml
+++ b/core/modules/block/block.services.yml
@@ -1,7 +1,4 @@
 services:
-  plugin.manager.block:
-    class: Drupal\block\BlockManager
-    arguments: ['@container.namespaces', '@cache.discovery', '@module_handler', '@string_translation']
   theme.negotiator.block.admin_demo:
     class: Drupal\block\Theme\AdminDemoNegotiator
     tags:
diff --git a/core/modules/block/src/BlockInterface.php b/core/modules/block/src/BlockInterface.php
index 30179bd1bba3..432e7994126d 100644
--- a/core/modules/block/src/BlockInterface.php
+++ b/core/modules/block/src/BlockInterface.php
@@ -27,7 +27,7 @@ interface BlockInterface extends ConfigEntityInterface {
   /**
    * Returns the plugin instance.
    *
-   * @return \Drupal\block\BlockPluginInterface
+   * @return \Drupal\Core\Block\BlockPluginInterface
    *   The plugin instance for this block.
    */
   public function getPlugin();
diff --git a/core/modules/block/src/BlockListBuilder.php b/core/modules/block/src/BlockListBuilder.php
index 52765f16a8a6..2e1ca965cdc3 100644
--- a/core/modules/block/src/BlockListBuilder.php
+++ b/core/modules/block/src/BlockListBuilder.php
@@ -7,7 +7,7 @@
 
 namespace Drupal\block;
 
-use Drupal\block\BlockManagerInterface;
+use Drupal\Core\Block\BlockManagerInterface;
 use Drupal\Component\Serialization\Json;
 use Drupal\Component\Utility\String;
 use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
@@ -50,7 +50,7 @@ class BlockListBuilder extends ConfigEntityListBuilder implements FormInterface
   /**
    * The block manager.
    *
-   * @var \Drupal\block\BlockManagerInterface
+   * @var \Drupal\Core\Block\BlockManagerInterface
    */
   protected $blockManager;
 
@@ -61,7 +61,7 @@ class BlockListBuilder extends ConfigEntityListBuilder implements FormInterface
    *   The entity type definition.
    * @param \Drupal\Core\Entity\EntityStorageInterface $storage
    *   The entity storage class.
-   * @param \Drupal\block\BlockManagerInterface $block_manager
+   * @param \Drupal\Core\Block\BlockManagerInterface $block_manager
    *   The block manager.
    */
   public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, BlockManagerInterface $block_manager) {
diff --git a/core/modules/block/src/BlockPluginBag.php b/core/modules/block/src/BlockPluginBag.php
index 5693281c8d4a..b854b1629b66 100644
--- a/core/modules/block/src/BlockPluginBag.php
+++ b/core/modules/block/src/BlockPluginBag.php
@@ -45,7 +45,7 @@ public function __construct(PluginManagerInterface $manager, $instance_id, array
   /**
    * {@inheritdoc}
    *
-   * @return \Drupal\block\BlockPluginInterface
+   * @return \Drupal\Core\Block\BlockPluginInterface
    */
   public function &get($instance_id) {
     return parent::get($instance_id);
diff --git a/core/modules/block/src/Controller/CategoryAutocompleteController.php b/core/modules/block/src/Controller/CategoryAutocompleteController.php
index 0c35e82c051b..8d7cf3ada2a6 100644
--- a/core/modules/block/src/Controller/CategoryAutocompleteController.php
+++ b/core/modules/block/src/Controller/CategoryAutocompleteController.php
@@ -7,7 +7,7 @@
 
 namespace Drupal\block\Controller;
 
-use Drupal\block\BlockManagerInterface;
+use Drupal\Core\Block\BlockManagerInterface;
 use Drupal\Component\Utility\String;
 use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
 use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -22,14 +22,14 @@ class CategoryAutocompleteController implements ContainerInjectionInterface {
   /**
    * The block manager.
    *
-   * @var \Drupal\block\BlockManagerInterface
+   * @var \Drupal\Core\Block\BlockManagerInterface
    */
   protected $blockManager;
 
   /**
    * Constructs a new CategoryAutocompleteController.
    *
-   * @param \Drupal\block\BlockManagerInterface $block_manager
+   * @param \Drupal\Core\Block\BlockManagerInterface $block_manager
    *   The block manager.
    */
   public function __construct(BlockManagerInterface $block_manager) {
diff --git a/core/modules/block/src/Event/BlockConditionContextEvent.php b/core/modules/block/src/Event/BlockConditionContextEvent.php
index a290ae6c2898..f20f9713e0f3 100644
--- a/core/modules/block/src/Event/BlockConditionContextEvent.php
+++ b/core/modules/block/src/Event/BlockConditionContextEvent.php
@@ -30,7 +30,7 @@ public function __construct(ConditionPluginBag $conditions) {
   }
 
   /**
-   * @return \Drupal\block\BlockPluginInterface
+   * @return \Drupal\Core\Block\BlockPluginInterface
    */
   public function getConditions() {
     return $this->conditions;
diff --git a/core/modules/block/src/Event/BlockEvents.php b/core/modules/block/src/Event/BlockEvents.php
index 070eb6c7473e..8d71c0702efc 100644
--- a/core/modules/block/src/Event/BlockEvents.php
+++ b/core/modules/block/src/Event/BlockEvents.php
@@ -15,7 +15,7 @@ final class BlockEvents {
   /**
    * Name of the event when gathering condition context for a block plugin.
    *
-   * @see \Drupal\block\BlockBase::getConditionContexts()
+   * @see \Drupal\Core\Block\BlockBase::getConditionContexts()
    * @see \Drupal\block\Event\BlockConditionContextEvent
    */
   const CONDITION_CONTEXT = 'block.condition_context';
diff --git a/core/modules/block/src/Tests/BlockConfigSchemaTest.php b/core/modules/block/src/Tests/BlockConfigSchemaTest.php
index 6cae8e15f059..9065fa4839ac 100644
--- a/core/modules/block/src/Tests/BlockConfigSchemaTest.php
+++ b/core/modules/block/src/Tests/BlockConfigSchemaTest.php
@@ -47,7 +47,7 @@ class BlockConfigSchemaTest extends KernelTestBase {
   /**
    * The block manager.
    *
-   * @var \Drupal\block\BlockManagerInterface
+   * @var \Drupal\Core\Block\BlockManagerInterface
    */
   protected $blockManager;
 
diff --git a/core/modules/block/src/Tests/BlockInterfaceTest.php b/core/modules/block/src/Tests/BlockInterfaceTest.php
index ed70a2fd54a0..7361f96f198e 100644
--- a/core/modules/block/src/Tests/BlockInterfaceTest.php
+++ b/core/modules/block/src/Tests/BlockInterfaceTest.php
@@ -51,7 +51,7 @@ public function testBlockInterface() {
       'display_message' => 'no message set',
     );
     // Initial configuration of the block at construction time.
-    /** @var $display_block \Drupal\block\BlockPluginInterface */
+    /** @var $display_block \Drupal\Core\Block\BlockPluginInterface */
     $display_block = $manager->createInstance('test_block_instantiation', $configuration);
     $this->assertIdentical($display_block->getConfiguration(), $expected_configuration, 'The block was configured correctly.');
 
diff --git a/core/modules/block/tests/modules/block_test/block_test.module b/core/modules/block/tests/modules/block_test/block_test.module
index a527ae1ddeec..d4bf97fcf876 100644
--- a/core/modules/block/tests/modules/block_test/block_test.module
+++ b/core/modules/block/tests/modules/block_test/block_test.module
@@ -5,7 +5,7 @@
  *   Provide test blocks.
  */
 
-use Drupal\block\BlockPluginInterface;
+use Drupal\Core\Block\BlockPluginInterface;
 
 /**
  * Implements hook_block_alter().
diff --git a/core/modules/block/tests/modules/block_test/src/Plugin/Block/TestBlockInstantiation.php b/core/modules/block/tests/modules/block_test/src/Plugin/Block/TestBlockInstantiation.php
index 9f5e77304595..7390bc5a18ec 100644
--- a/core/modules/block/tests/modules/block_test/src/Plugin/Block/TestBlockInstantiation.php
+++ b/core/modules/block/tests/modules/block_test/src/Plugin/Block/TestBlockInstantiation.php
@@ -7,7 +7,7 @@
 
 namespace Drupal\block_test\Plugin\Block;
 
-use Drupal\block\BlockBase;
+use Drupal\Core\Block\BlockBase;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Session\AccountInterface;
 
diff --git a/core/modules/block/tests/modules/block_test/src/Plugin/Block/TestCacheBlock.php b/core/modules/block/tests/modules/block_test/src/Plugin/Block/TestCacheBlock.php
index b6508a8d978b..815f3a4a077d 100644
--- a/core/modules/block/tests/modules/block_test/src/Plugin/Block/TestCacheBlock.php
+++ b/core/modules/block/tests/modules/block_test/src/Plugin/Block/TestCacheBlock.php
@@ -7,7 +7,7 @@
 
 namespace Drupal\block_test\Plugin\Block;
 
-use Drupal\block\BlockBase;
+use Drupal\Core\Block\BlockBase;
 
 /**
  * Provides a block to test caching.
diff --git a/core/modules/block/tests/modules/block_test/src/Plugin/Block/TestContextAwareBlock.php b/core/modules/block/tests/modules/block_test/src/Plugin/Block/TestContextAwareBlock.php
index 0b944147f545..56b127b13fcf 100644
--- a/core/modules/block/tests/modules/block_test/src/Plugin/Block/TestContextAwareBlock.php
+++ b/core/modules/block/tests/modules/block_test/src/Plugin/Block/TestContextAwareBlock.php
@@ -7,7 +7,7 @@
 
 namespace Drupal\block_test\Plugin\Block;
 
-use Drupal\block\BlockBase;
+use Drupal\Core\Block\BlockBase;
 
 /**
  * Provides a context-aware block.
diff --git a/core/modules/block/tests/modules/block_test/src/Plugin/Block/TestHtmlBlock.php b/core/modules/block/tests/modules/block_test/src/Plugin/Block/TestHtmlBlock.php
index 1c6138fe00c1..49925dcaffa3 100644
--- a/core/modules/block/tests/modules/block_test/src/Plugin/Block/TestHtmlBlock.php
+++ b/core/modules/block/tests/modules/block_test/src/Plugin/Block/TestHtmlBlock.php
@@ -7,7 +7,7 @@
 
 namespace Drupal\block_test\Plugin\Block;
 
-use Drupal\block\BlockBase;
+use Drupal\Core\Block\BlockBase;
 
 /**
  * Provides a block to test HTML.
diff --git a/core/modules/block/tests/src/CategoryAutocompleteTest.php b/core/modules/block/tests/src/CategoryAutocompleteTest.php
index fbb226ddfb99..1818a6ec866a 100644
--- a/core/modules/block/tests/src/CategoryAutocompleteTest.php
+++ b/core/modules/block/tests/src/CategoryAutocompleteTest.php
@@ -26,7 +26,7 @@ class CategoryAutocompleteTest extends UnitTestCase {
   protected $autocompleteController;
 
   protected function setUp() {
-    $block_manager = $this->getMock('Drupal\block\BlockManagerInterface');
+    $block_manager = $this->getMock('Drupal\Core\Block\BlockManagerInterface');
     $block_manager->expects($this->any())
       ->method('getCategories')
       ->will($this->returnValue(array('Comment', 'Node', 'None & Such', 'User')));
diff --git a/core/modules/block_content/src/Plugin/Block/BlockContentBlock.php b/core/modules/block_content/src/Plugin/Block/BlockContentBlock.php
index 342d0cc3bbcc..9e40c81efd95 100644
--- a/core/modules/block_content/src/Plugin/Block/BlockContentBlock.php
+++ b/core/modules/block_content/src/Plugin/Block/BlockContentBlock.php
@@ -7,8 +7,8 @@
 
 namespace Drupal\block_content\Plugin\Block;
 
-use Drupal\block\BlockBase;
-use Drupal\block\BlockManagerInterface;
+use Drupal\Core\Block\BlockBase;
+use Drupal\Core\Block\BlockManagerInterface;
 use Drupal\Core\Entity\EntityManager;
 use Drupal\Core\Entity\EntityManagerInterface;
 use Drupal\Core\Form\FormStateInterface;
@@ -32,7 +32,7 @@ class BlockContentBlock extends BlockBase implements ContainerFactoryPluginInter
   /**
    * The Plugin Block Manager.
    *
-   * @var \Drupal\block\BlockManagerInterface.
+   * @var \Drupal\Core\Block\BlockManagerInterface.
    */
   protected $blockManager;
 
@@ -66,7 +66,7 @@ class BlockContentBlock extends BlockBase implements ContainerFactoryPluginInter
    *   The plugin ID for the plugin instance.
    * @param mixed $plugin_definition
    *   The plugin implementation definition.
-   * @param \Drupal\block\BlockManagerInterface
+   * @param \Drupal\Core\Block\BlockManagerInterface
    *   The Plugin Block Manager.
    * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
    *   The entity manager service.
@@ -117,7 +117,7 @@ public function defaultConfiguration() {
   }
 
   /**
-   * Overrides \Drupal\block\BlockBase::blockForm().
+   * Overrides \Drupal\Core\Block\BlockBase::blockForm().
    *
    * Adds body and description fields to the block configuration form.
    */
diff --git a/core/modules/book/src/Plugin/Block/BookNavigationBlock.php b/core/modules/book/src/Plugin/Block/BookNavigationBlock.php
index ad2ea92376e0..441d05255623 100644
--- a/core/modules/book/src/Plugin/Block/BookNavigationBlock.php
+++ b/core/modules/book/src/Plugin/Block/BookNavigationBlock.php
@@ -7,7 +7,7 @@
 
 namespace Drupal\book\Plugin\Block;
 
-use Drupal\block\BlockBase;
+use Drupal\Core\Block\BlockBase;
 use Drupal\book\BookManagerInterface;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
diff --git a/core/modules/forum/src/Plugin/Block/ForumBlockBase.php b/core/modules/forum/src/Plugin/Block/ForumBlockBase.php
index 0ab6a20fcc7e..8e690f09f415 100644
--- a/core/modules/forum/src/Plugin/Block/ForumBlockBase.php
+++ b/core/modules/forum/src/Plugin/Block/ForumBlockBase.php
@@ -7,7 +7,7 @@
 
 namespace Drupal\forum\Plugin\Block;
 
-use Drupal\block\BlockBase;
+use Drupal\Core\Block\BlockBase;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Session\AccountInterface;
 use Drupal\Core\Cache\Cache;
diff --git a/core/modules/language/language.admin.inc b/core/modules/language/language.admin.inc
index 621ed8a3709e..3baf045821cd 100644
--- a/core/modules/language/language.admin.inc
+++ b/core/modules/language/language.admin.inc
@@ -203,21 +203,3 @@ function template_preprocess_language_content_settings_table(&$variables) {
 function theme_language_content_settings_table($variables) {
   return '<h4>' . $variables['build']['#title'] . '</h4>' . drupal_render($variables['build']);
 }
-
-/**
- * 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/src/Form/NegotiationConfigureForm.php b/core/modules/language/src/Form/NegotiationConfigureForm.php
index 35be78440159..28e4d23e7658 100644
--- a/core/modules/language/src/Form/NegotiationConfigureForm.php
+++ b/core/modules/language/src/Form/NegotiationConfigureForm.php
@@ -7,12 +7,13 @@
 
 namespace Drupal\language\Form;
 
-use Drupal\block\BlockManagerInterface;
+use Drupal\Core\Block\BlockManagerInterface;
 use Drupal\Component\Utility\String;
 use Drupal\Component\Utility\Unicode;
 use Drupal\Component\Utility\Xss;
 use Drupal\Core\Config\ConfigFactoryInterface;
-use Drupal\Core\Extension\ModuleHandlerInterface;
+use Drupal\Core\Entity\EntityStorageInterface;
+use Drupal\Core\Extension\ThemeHandlerInterface;
 use Drupal\Core\Form\FormBase;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\language\ConfigurableLanguageManagerInterface;
@@ -49,10 +50,24 @@ class NegotiationConfigureForm extends FormBase {
   /**
    * The block manager.
    *
-   * @var \Drupal\block\BlockManagerInterface
+   * @var \Drupal\Core\Block\BlockManagerInterface
    */
   protected $blockManager;
 
+  /**
+   * The block storage.
+   *
+   * @var \Drupal\Core\Entity\EntityStorageInterface|null
+   */
+  protected $blockStorage;
+
+  /**
+   * The theme handler.
+   *
+   * @var \Drupal\Core\Extension\ThemeHandlerInterface
+   */
+  protected $themeHandler;
+
   /**
    * Constructs a NegotiationConfigureForm object.
    *
@@ -62,25 +77,35 @@ class NegotiationConfigureForm extends FormBase {
    *   The language manager.
    * @param \Drupal\language\LanguageNegotiatorInterface $negotiator
    *   The language negotiation methods manager.
-   * @param \Drupal\block\BlockManagerInterface $block_manager
-   *   The block manager, or NULL if not available.
+   * @param \Drupal\Core\Block\BlockManagerInterface $block_manager
+   *   The block manager.
+   * @param \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler
+   *   The theme handler.
+   * @param \Drupal\Core\Entity\EntityStorageInterface $block_storage
+   *   The block storage, or NULL if not available.
    */
-  public function __construct(ConfigFactoryInterface $config_factory, ConfigurableLanguageManagerInterface $language_manager, LanguageNegotiatorInterface $negotiator, BlockManagerInterface $block_manager = NULL) {
+  public function __construct(ConfigFactoryInterface $config_factory, ConfigurableLanguageManagerInterface $language_manager, LanguageNegotiatorInterface $negotiator, BlockManagerInterface $block_manager, ThemeHandlerInterface $theme_handler, EntityStorageInterface $block_storage = NULL) {
     $this->languageTypes = $config_factory->get('language.types');
     $this->languageManager = $language_manager;
     $this->negotiator = $negotiator;
     $this->blockManager = $block_manager;
+    $this->themeHandler = $theme_handler;
+    $this->blockStorage = $block_storage;
   }
 
   /**
    * {@inheritdoc}
    */
   public static function create(ContainerInterface $container) {
+    $entity_manager = $container->get('entity.manager');
+    $block_storage = $entity_manager->hasController('block', 'storage') ? $entity_manager->getStorage('block') : NULL;
     return new static(
       $container->get('config.factory'),
       $container->get('language_manager'),
       $container->get('language_negotiator'),
-      $container->has('plugin.manager.block') ? $container->get('plugin.manager.block') : NULL
+      $container->get('plugin.manager.block'),
+      $container->get('theme_handler'),
+      $block_storage
     );
   }
 
@@ -152,7 +177,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
       }
 
       $method_weights_type[$type] = $method_weights;
-      $this->config('language.types')->set('negotiation.' . $type . '.method_weights', $method_weights_input)->save();
+      $this->languageTypes->set('negotiation.' . $type . '.method_weights', $method_weights_input)->save();
     }
 
     // Update non-configurable language types and the related language
@@ -166,13 +191,13 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
 
     // Clear block definitions cache since the available blocks and their names
     // may have been changed based on the configurable types.
-    if ($this->blockManager) {
+    if ($this->blockStorage) {
       // 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)));
       $this->disableLanguageSwitcher($non_configurable);
-      $this->blockManager->clearCachedDefinitions();
     }
+    $this->blockManager->clearCachedDefinitions();
 
     $form_state->setRedirect('language.negotiation');
     drupal_set_message($this->t('Language negotiation configuration saved.'));
@@ -214,8 +239,8 @@ protected function configureFormTable(array &$form, $type)  {
     }
 
     $negotiation_info = $form['#language_negotiation_info'];
-    $enabled_methods = $this->config('language.types')->get('negotiation.' . $type . '.enabled') ?: array();
-    $methods_weight = $this->config('language.types')->get('negotiation.' . $type . '.method_weights') ?: array();
+    $enabled_methods = $this->languageTypes->get('negotiation.' . $type . '.enabled') ?: array();
+    $methods_weight = $this->languageTypes->get('negotiation.' . $type . '.method_weights') ?: array();
 
     // Add missing data to the methods lists.
     foreach ($negotiation_info as $method_id => $method) {
@@ -296,7 +321,8 @@ protected function configureFormTable(array &$form, $type)  {
    *   be disabled.
    */
   protected function disableLanguageSwitcher(array $language_types) {
-    $blocks = _block_rehash();
+    $theme = $this->themeHandler->getDefault();
+    $blocks = $this->blockStorage->loadByProperties(array('theme' => $theme));
     foreach ($language_types as $language_type) {
       foreach ($blocks as $block) {
         if (strpos($block->id, 'language_switcher_' . substr($language_type, 9)) !== FALSE) {
diff --git a/core/modules/language/src/Plugin/Block/LanguageBlock.php b/core/modules/language/src/Plugin/Block/LanguageBlock.php
index 42c8c8d9c391..a3aba84ef2c1 100644
--- a/core/modules/language/src/Plugin/Block/LanguageBlock.php
+++ b/core/modules/language/src/Plugin/Block/LanguageBlock.php
@@ -7,7 +7,7 @@
 
 namespace Drupal\language\Plugin\Block;
 
-use Drupal\block\BlockBase;
+use Drupal\Core\Block\BlockBase;
 use Drupal\Core\Session\AccountInterface;
 use Drupal\Core\Language\LanguageManagerInterface;
 use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
diff --git a/core/modules/menu_ui/menu_ui.module b/core/modules/menu_ui/menu_ui.module
index e77410f9d29b..76aee080a624 100644
--- a/core/modules/menu_ui/menu_ui.module
+++ b/core/modules/menu_ui/menu_ui.module
@@ -9,7 +9,7 @@
  */
 
 use Drupal\Core\Entity\EntityInterface;
-use Drupal\block\BlockPluginInterface;
+use Drupal\Core\Block\BlockPluginInterface;
 use Drupal\Core\Menu\MenuLinkInterface;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Render\Element;
diff --git a/core/modules/node/src/Plugin/Block/SyndicateBlock.php b/core/modules/node/src/Plugin/Block/SyndicateBlock.php
index d0038fcc84e2..f4e7123c2a33 100644
--- a/core/modules/node/src/Plugin/Block/SyndicateBlock.php
+++ b/core/modules/node/src/Plugin/Block/SyndicateBlock.php
@@ -7,7 +7,7 @@
 
 namespace Drupal\node\Plugin\Block;
 
-use Drupal\block\BlockBase;
+use Drupal\Core\Block\BlockBase;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Session\AccountInterface;
 
diff --git a/core/modules/search/src/Plugin/Block/SearchBlock.php b/core/modules/search/src/Plugin/Block/SearchBlock.php
index 64b309606ce2..369aad61039a 100644
--- a/core/modules/search/src/Plugin/Block/SearchBlock.php
+++ b/core/modules/search/src/Plugin/Block/SearchBlock.php
@@ -8,7 +8,7 @@
 namespace Drupal\search\Plugin\Block;
 
 use Drupal\Core\Session\AccountInterface;
-use Drupal\block\BlockBase;
+use Drupal\Core\Block\BlockBase;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 use Symfony\Component\HttpFoundation\Request;
 
diff --git a/core/modules/shortcut/src/Plugin/Block/ShortcutsBlock.php b/core/modules/shortcut/src/Plugin/Block/ShortcutsBlock.php
index cb64ec0f6a5d..46beba45b00d 100644
--- a/core/modules/shortcut/src/Plugin/Block/ShortcutsBlock.php
+++ b/core/modules/shortcut/src/Plugin/Block/ShortcutsBlock.php
@@ -7,7 +7,7 @@
 
 namespace Drupal\shortcut\Plugin\Block;
 
-use Drupal\block\BlockBase;
+use Drupal\Core\Block\BlockBase;
 
 /**
  * Provides a 'Shortcut' block.
diff --git a/core/modules/statistics/src/Plugin/Block/StatisticsPopularBlock.php b/core/modules/statistics/src/Plugin/Block/StatisticsPopularBlock.php
index 8a664b01f126..5e42e1c7a68d 100644
--- a/core/modules/statistics/src/Plugin/Block/StatisticsPopularBlock.php
+++ b/core/modules/statistics/src/Plugin/Block/StatisticsPopularBlock.php
@@ -7,7 +7,7 @@
 
 namespace Drupal\statistics\Plugin\Block;
 
-use Drupal\block\BlockBase;
+use Drupal\Core\Block\BlockBase;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Session\AccountInterface;
 
diff --git a/core/modules/system/src/Form/PerformanceForm.php b/core/modules/system/src/Form/PerformanceForm.php
index 98b0b8288eec..f5261f846a6b 100644
--- a/core/modules/system/src/Form/PerformanceForm.php
+++ b/core/modules/system/src/Form/PerformanceForm.php
@@ -116,7 +116,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
       '#open' => TRUE,
     );
     // Identical options to the ones for block caching.
-    // @see \Drupal\block\BlockBase::buildConfigurationForm()
+    // @see \Drupal\Core\Block\BlockBase::buildConfigurationForm()
     $period = array(0, 60, 180, 300, 600, 900, 1800, 2700, 3600, 10800, 21600, 32400, 43200, 86400);
     $period = array_map(array($this->dateFormatter, 'formatInterval'), array_combine($period, $period));
     $period[0] = '<' . t('no caching') . '>';
diff --git a/core/modules/system/src/Plugin/Block/SystemBrandingBlock.php b/core/modules/system/src/Plugin/Block/SystemBrandingBlock.php
index d7289692cce4..77e63e105c88 100644
--- a/core/modules/system/src/Plugin/Block/SystemBrandingBlock.php
+++ b/core/modules/system/src/Plugin/Block/SystemBrandingBlock.php
@@ -8,7 +8,7 @@
 namespace Drupal\system\Plugin\Block;
 
 use Drupal\Component\Utility\NestedArray;
-use Drupal\block\BlockBase;
+use Drupal\Core\Block\BlockBase;
 use Drupal\Core\Config\ConfigFactoryInterface;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
diff --git a/core/modules/system/src/Plugin/Block/SystemBreadcrumbBlock.php b/core/modules/system/src/Plugin/Block/SystemBreadcrumbBlock.php
index 2201ebb5d918..ebdb67707a7d 100644
--- a/core/modules/system/src/Plugin/Block/SystemBreadcrumbBlock.php
+++ b/core/modules/system/src/Plugin/Block/SystemBreadcrumbBlock.php
@@ -7,7 +7,7 @@
 
 namespace Drupal\system\Plugin\Block;
 
-use Drupal\block\BlockBase;
+use Drupal\Core\Block\BlockBase;
 use Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface;
 use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
 use Drupal\Core\Routing\RouteMatchInterface;
diff --git a/core/modules/system/src/Plugin/Block/SystemHelpBlock.php b/core/modules/system/src/Plugin/Block/SystemHelpBlock.php
index a07937226222..70b2098f623c 100644
--- a/core/modules/system/src/Plugin/Block/SystemHelpBlock.php
+++ b/core/modules/system/src/Plugin/Block/SystemHelpBlock.php
@@ -7,7 +7,7 @@
 
 namespace Drupal\system\Plugin\Block;
 
-use Drupal\block\BlockBase;
+use Drupal\Core\Block\BlockBase;
 use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
 use Drupal\Core\Routing\RouteMatchInterface;
diff --git a/core/modules/system/src/Plugin/Block/SystemMainBlock.php b/core/modules/system/src/Plugin/Block/SystemMainBlock.php
index e251cad9cd04..4504081e2a75 100644
--- a/core/modules/system/src/Plugin/Block/SystemMainBlock.php
+++ b/core/modules/system/src/Plugin/Block/SystemMainBlock.php
@@ -7,7 +7,7 @@
 
 namespace Drupal\system\Plugin\Block;
 
-use Drupal\block\BlockBase;
+use Drupal\Core\Block\BlockBase;
 use Drupal\Core\Form\FormStateInterface;
 
 /**
diff --git a/core/modules/system/src/Plugin/Block/SystemMenuBlock.php b/core/modules/system/src/Plugin/Block/SystemMenuBlock.php
index 258ffbb2d770..dd4c6ad3bf09 100644
--- a/core/modules/system/src/Plugin/Block/SystemMenuBlock.php
+++ b/core/modules/system/src/Plugin/Block/SystemMenuBlock.php
@@ -8,7 +8,7 @@
 namespace Drupal\system\Plugin\Block;
 
 use Drupal\Component\Utility\NestedArray;
-use Drupal\block\BlockBase;
+use Drupal\Core\Block\BlockBase;
 use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
 use Drupal\Core\Menu\MenuActiveTrailInterface;
 use Drupal\Core\Menu\MenuLinkTreeInterface;
diff --git a/core/modules/system/src/Plugin/Block/SystemPoweredByBlock.php b/core/modules/system/src/Plugin/Block/SystemPoweredByBlock.php
index 2e197e02c088..c18f1c831001 100644
--- a/core/modules/system/src/Plugin/Block/SystemPoweredByBlock.php
+++ b/core/modules/system/src/Plugin/Block/SystemPoweredByBlock.php
@@ -7,7 +7,7 @@
 
 namespace Drupal\system\Plugin\Block;
 
-use Drupal\block\BlockBase;
+use Drupal\Core\Block\BlockBase;
 use Drupal\Core\Cache\Cache;
 use Drupal\Core\Form\FormStateInterface;
 
diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index 1205a9cc19ff..0fa6a9b49f00 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -13,8 +13,8 @@
 use Drupal\Core\StringTranslation\TranslationWrapper;
 use Drupal\Core\Language\LanguageInterface;
 use Drupal\Core\Menu\MenuTreeParameters;
-use Drupal\block\BlockPluginInterface;
 use Drupal\Core\Url;
+use Drupal\Core\Block\BlockPluginInterface;
 use Drupal\user\UserInterface;
 use Symfony\Component\HttpFoundation\RedirectResponse;
 use GuzzleHttp\Exception\RequestException;
diff --git a/core/modules/system/tests/modules/form_test/src/Plugin/Block/RedirectFormBlock.php b/core/modules/system/tests/modules/form_test/src/Plugin/Block/RedirectFormBlock.php
index 21b79b3161b6..4a0459939243 100644
--- a/core/modules/system/tests/modules/form_test/src/Plugin/Block/RedirectFormBlock.php
+++ b/core/modules/system/tests/modules/form_test/src/Plugin/Block/RedirectFormBlock.php
@@ -7,7 +7,7 @@
 
 namespace Drupal\form_test\Plugin\Block;
 
-use Drupal\block\BlockBase;
+use Drupal\Core\Block\BlockBase;
 use Drupal\Core\Form\FormBuilderInterface;
 use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
 use Drupal\Core\Session\AccountInterface;
diff --git a/core/modules/user/src/Plugin/Block/UserLoginBlock.php b/core/modules/user/src/Plugin/Block/UserLoginBlock.php
index 2cd54f440710..7b3727dbcf06 100644
--- a/core/modules/user/src/Plugin/Block/UserLoginBlock.php
+++ b/core/modules/user/src/Plugin/Block/UserLoginBlock.php
@@ -8,7 +8,7 @@
 namespace Drupal\user\Plugin\Block;
 
 use Drupal\Core\Session\AccountInterface;
-use Drupal\block\BlockBase;
+use Drupal\Core\Block\BlockBase;
 use Symfony\Cmf\Component\Routing\RouteObjectInterface;
 
 /**
diff --git a/core/modules/views/src/Plugin/Block/ViewsBlockBase.php b/core/modules/views/src/Plugin/Block/ViewsBlockBase.php
index 42b176f102f4..fa8948783992 100644
--- a/core/modules/views/src/Plugin/Block/ViewsBlockBase.php
+++ b/core/modules/views/src/Plugin/Block/ViewsBlockBase.php
@@ -7,7 +7,7 @@
 
 namespace Drupal\views\Plugin\Block;
 
-use Drupal\block\BlockBase;
+use Drupal\Core\Block\BlockBase;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
 use Drupal\views\ViewExecutableFactory;
diff --git a/core/modules/block/src/Plugin/views/display/Block.php b/core/modules/views/src/Plugin/views/display/Block.php
similarity index 97%
rename from core/modules/block/src/Plugin/views/display/Block.php
rename to core/modules/views/src/Plugin/views/display/Block.php
index 9f4821333aa8..c42a75edaebf 100644
--- a/core/modules/block/src/Plugin/views/display/Block.php
+++ b/core/modules/views/src/Plugin/views/display/Block.php
@@ -2,17 +2,14 @@
 
 /**
  * @file
- * Definition of Drupal\views\Plugin\views\display\Block.
- * Definition of Drupal\block\Plugin\views\display\Block.
+ * Contains \Drupal\views\Plugin\views\display\Block.
  */
 
-namespace Drupal\block\Plugin\views\display;
+namespace Drupal\views\Plugin\views\display;
 
 use Drupal\Component\Utility\String;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\views\Plugin\Block\ViewsBlock;
-use Drupal\views\Plugin\views\display\DisplayPluginBase;
-use Drupal\views\Views;
 
 /**
  * The plugin that handles a block.
diff --git a/core/modules/views/tests/src/Plugin/Block/ViewsBlockTest.php b/core/modules/views/tests/src/Plugin/Block/ViewsBlockTest.php
index 8df1dfe6f6ad..80a80b91427a 100644
--- a/core/modules/views/tests/src/Plugin/Block/ViewsBlockTest.php
+++ b/core/modules/views/tests/src/Plugin/Block/ViewsBlockTest.php
@@ -10,7 +10,6 @@
 use Drupal\Core\DependencyInjection\ContainerBuilder;
 use Drupal\Tests\UnitTestCase;
 use Drupal\views\Plugin\Block\ViewsBlock;
-use Drupal\block\Plugin\views\display\Block;
 
 // @todo Remove this once the constant got converted.
 if (!defined('BLOCK_LABEL_VISIBLE')) {
@@ -80,7 +79,7 @@ protected function setUp() {
       ->with('block_1')
       ->will($this->returnValue(TRUE));
 
-    $this->executable->display_handler = $this->getMockBuilder('Drupal\block\Plugin\views\display\Block')
+    $this->executable->display_handler = $this->getMockBuilder('Drupal\views\Plugin\views\display\Block')
       ->disableOriginalConstructor()
       ->setMethods(NULL)
       ->getMock();
diff --git a/core/modules/block/tests/src/Plugin/views/display/BlockTest.php b/core/modules/views/tests/src/Plugin/views/display/BlockTest.php
similarity index 87%
rename from core/modules/block/tests/src/Plugin/views/display/BlockTest.php
rename to core/modules/views/tests/src/Plugin/views/display/BlockTest.php
index 7b839900ea3c..6d31174c428f 100644
--- a/core/modules/block/tests/src/Plugin/views/display/BlockTest.php
+++ b/core/modules/views/tests/src/Plugin/views/display/BlockTest.php
@@ -2,15 +2,15 @@
 
 /**
  * @file
- * Contains \Drupal\block\Tests\Plugin\views\display\BlockTest.
+ * Contains \Drupal\views\Tests\Plugin\views\display\BlockTest.
  */
 
-namespace Drupal\block\Tests\Plugin\views\display;
+namespace Drupal\views\Tests\Plugin\views\display;
 
 use Drupal\Tests\UnitTestCase;
 
 /**
- * @coversDefaultClass \Drupal\block\Plugin\views\display\Block
+ * @coversDefaultClass \Drupal\views\Plugin\views\display\Block
  * @group block
  */
 class BlockTest extends UnitTestCase {
@@ -32,7 +32,7 @@ class BlockTest extends UnitTestCase {
   /**
    * The tested block display plugin.
    *
-   * @var \Drupal\block\Plugin\views\display\Block|\PHPUnit_Framework_MockObject_MockObject
+   * @var \Drupal\views\Plugin\views\display\Block|\PHPUnit_Framework_MockObject_MockObject
    */
   protected $blockDisplay;
 
@@ -51,7 +51,7 @@ protected function setUp() {
       ->with('block_1')
       ->will($this->returnValue(TRUE));
 
-    $this->blockDisplay = $this->executable->display_handler = $this->getMockBuilder('Drupal\block\Plugin\views\display\Block')
+    $this->blockDisplay = $this->executable->display_handler = $this->getMockBuilder('Drupal\views\Plugin\views\display\Block')
       ->disableOriginalConstructor()
       ->setMethods(NULL)
       ->getMock();
diff --git a/core/modules/block/tests/src/BlockBaseTest.php b/core/tests/Drupal/Tests/Core/Block/BlockBaseTest.php
similarity index 94%
rename from core/modules/block/tests/src/BlockBaseTest.php
rename to core/tests/Drupal/Tests/Core/Block/BlockBaseTest.php
index fdc3e318ba3a..13320edf9428 100644
--- a/core/modules/block/tests/src/BlockBaseTest.php
+++ b/core/tests/Drupal/Tests/Core/Block/BlockBaseTest.php
@@ -2,17 +2,17 @@
 
 /**
  * @file
- * Contains \Drupal\block\Tests\BlockBaseTest.
+ * Contains \Drupal\Tests\Core\Block\BlockBaseTest.
  */
 
-namespace Drupal\block\Tests;
+namespace Drupal\Tests\Core\Block;
 
 use Drupal\block_test\Plugin\Block\TestBlockInstantiation;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
 use Drupal\Tests\UnitTestCase;
 
 /**
- * @coversDefaultClass \Drupal\block\BlockBase
+ * @coversDefaultClass \Drupal\Core\Block\BlockBase
  * @group block
  */
 class BlockBaseTest extends UnitTestCase {
@@ -20,7 +20,7 @@ class BlockBaseTest extends UnitTestCase {
   /**
    * Tests the machine name suggestion.
    *
-   * @see \Drupal\block\BlockBase::getMachineNameSuggestion().
+   * @see \Drupal\Core\Block\BlockBase::getMachineNameSuggestion().
    */
   public function testGetMachineNameSuggestion() {
     $transliteraton = $this->getMockBuilder('Drupal\Core\Transliteration\PHPTransliteration')
diff --git a/core/tests/Drupal/Tests/UnitTestCase.php b/core/tests/Drupal/Tests/UnitTestCase.php
index b024e6897cba..d37a04042bfd 100644
--- a/core/tests/Drupal/Tests/UnitTestCase.php
+++ b/core/tests/Drupal/Tests/UnitTestCase.php
@@ -157,7 +157,7 @@ public function getConfigStorageStub(array $configs) {
    *   The mocked block.
    */
   protected function getBlockMockWithMachineName($machine_name) {
-    $plugin = $this->getMockBuilder('Drupal\block\BlockBase')
+    $plugin = $this->getMockBuilder('Drupal\Core\Block\BlockBase')
       ->disableOriginalConstructor()
       ->getMock();
     $plugin->expects($this->any())
-- 
GitLab