diff --git a/core/config/schema/core.data_types.schema.yml b/core/config/schema/core.data_types.schema.yml
index 4f6ef0c..7273d16 100644
--- a/core/config/schema/core.data_types.schema.yml
+++ b/core/config/schema/core.data_types.schema.yml
@@ -291,18 +291,17 @@ block_settings:
           sequence:
             - type: string
               label: 'Context'
-    status:
-      type: boolean
-      label: 'Status'
     info:
       type: label
       label: 'Admin info'
-    view_mode:
-      type: string
-      label: 'View mode'
     provider:
       type: string
       label: 'Provider'
+    context_mapping:
+      type: sequence
+      label: 'Context assignments'
+      sequence:
+        - type: string
 
 condition.plugin:
   type: mapping
diff --git a/core/lib/Drupal/Core/Block/BlockBase.php b/core/lib/Drupal/Core/Block/BlockBase.php
index ba1026b..9963132 100644
--- a/core/lib/Drupal/Core/Block/BlockBase.php
+++ b/core/lib/Drupal/Core/Block/BlockBase.php
@@ -10,6 +10,7 @@
 use Drupal\block\BlockInterface;
 use Drupal\Core\Access\AccessResult;
 use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Plugin\ContextAwarePluginAssignmentTrait;
 use Drupal\Core\Plugin\ContextAwarePluginBase;
 use Drupal\Component\Utility\Unicode;
 use Drupal\Component\Utility\NestedArray;
@@ -29,6 +30,8 @@
  */
 abstract class BlockBase extends ContextAwarePluginBase implements BlockPluginInterface {
 
+  use ContextAwarePluginAssignmentTrait;
+
   /**
    * The transliteration service.
    *
@@ -160,6 +163,9 @@ protected function blockAccess(AccountInterface $account) {
    */
   public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
     $definition = $this->getPluginDefinition();
+    $temporary = $form_state->getTemporary();
+    $contexts = isset($temporary['gathered_contexts']) ? $temporary['gathered_contexts'] : [];
+    $form['context_mapping'] = $this->addContextAssignmentElement($this, $contexts);
     $form['provider'] = array(
       '#type' => 'value',
       '#value' => $definition['provider'],
diff --git a/core/modules/aggregator/aggregator.services.yml b/core/modules/aggregator/aggregator.services.yml
index 6b191c8..85b258d 100644
--- a/core/modules/aggregator/aggregator.services.yml
+++ b/core/modules/aggregator/aggregator.services.yml
@@ -14,3 +14,8 @@ services:
   logger.channel.aggregator:
     parent: logger.channel_base
     arguments: ['aggregator']
+  block.aggregator_feed_context:
+      class: Drupal\aggregator\EventSubscriber\AggregatorFeedContext
+      arguments: ['@entity.manager', '@theme.manager']
+      tags:
+        - { name: 'event_subscriber' }
diff --git a/core/modules/aggregator/src/EventSubscriber/AggregatorFeedContext.php b/core/modules/aggregator/src/EventSubscriber/AggregatorFeedContext.php
new file mode 100644
index 0000000..ebdc225
--- /dev/null
+++ b/core/modules/aggregator/src/EventSubscriber/AggregatorFeedContext.php
@@ -0,0 +1,86 @@
+<?php
+/**
+ * @file
+ * Contains AggregatorFeedContext.php.
+ */
+
+namespace Drupal\aggregator\EventSubscriber;
+
+
+use Drupal\block\Event\BlockContextEvent;
+use Drupal\block\EventSubscriber\BlockContextSubscriberBase;
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Plugin\Context\Context;
+use Drupal\Core\Plugin\Context\ContextDefinition;
+use Drupal\Core\Theme\ThemeManagerInterface;
+
+class AggregatorFeedContext extends BlockContextSubscriberBase {
+
+  /**
+   * The entity storage for feeds.
+   *
+   * @var \Drupal\aggregator\FeedStorageInterface
+   */
+  protected $feedStorage;
+
+  /**
+   * The block storage.
+   *
+   * @var \Drupal\Core\Entity\EntityStorageInterface
+   */
+  protected $blockStorage;
+
+  /**
+   * The theme manager.
+   *
+   * @var \Drupal\Core\Theme\ThemeManagerInterface
+   */
+  protected $themeManager;
+
+  /**
+   * Constructs a new NodeRouteContext.
+   *
+   * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
+   *   The entity manager.
+   * @param \Drupal\Core\Theme\ThemeManagerInterface $theme_manager
+   *   The theme manager.
+   */
+  public function __construct(EntityManagerInterface $entity_manager, ThemeManagerInterface $theme_manager) {
+    $this->feedStorage = $entity_manager->getStorage('aggregator_feed');
+    $this->blockStorage = $entity_manager->getStorage('block');
+    $this->themeManager = $theme_manager;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function onBlockActiveContext(BlockContextEvent $event) {
+    $feeds = array();
+    foreach ($this->blockStorage->loadByProperties(array('plugin' => 'aggregator_feed_block', 'theme' => $this->themeManager->getActiveTheme()->getName())) as $block_id => $block) {
+      /** @var $block \Drupal\block\Entity\Block */
+      $block_plugin = $block->getPlugin();
+      /** @var $block_plugin \Drupal\Component\Plugin\ContextAwarePluginInterface */
+      $contexts = $block_plugin->getContextMapping();
+      if (!isset($feeds[$contexts['feed']])) {
+        list(, $fid) = explode(':', $contexts['feed']);
+        $feed = $this->feedStorage->load($fid);
+        $context = new Context(new ContextDefinition('entity:aggregator_feed'));
+        $context->setContextValue($feed);
+        $event->setContext('aggregator.feed:' . $feed->id(), $context);
+      }
+    }
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function onBlockAdministrativeContext(BlockContextEvent $event) {
+    $feeds = $this->feedStorage->loadMultiple();
+    foreach ($feeds as $feed) {
+      $context = new Context(new ContextDefinition('entity:aggregator_feed', $feed->label()));
+      $context->setContextValue($feed);
+      $event->setContext('aggregator.feed:' . $feed->id(), $context);
+    }
+  }
+
+}
diff --git a/core/modules/aggregator/src/Plugin/Block/AggregatorFeedBlock.php b/core/modules/aggregator/src/Plugin/Block/AggregatorFeedBlock.php
index 16ca1af..68e7088 100644
--- a/core/modules/aggregator/src/Plugin/Block/AggregatorFeedBlock.php
+++ b/core/modules/aggregator/src/Plugin/Block/AggregatorFeedBlock.php
@@ -7,7 +7,6 @@
 
 namespace Drupal\aggregator\Plugin\Block;
 
-use Drupal\aggregator\FeedStorageInterface;
 use Drupal\aggregator\ItemStorageInterface;
 use Drupal\Core\Block\BlockBase;
 use Drupal\Core\Cache\Cache;
@@ -23,19 +22,16 @@
  * @Block(
  *   id = "aggregator_feed_block",
  *   admin_label = @Translation("Aggregator feed"),
- *   category = @Translation("Lists (Views)")
+ *   category = @Translation("Lists (Views)"),
+ *   context = {
+ *     "feed" = @ContextDefinition("entity:aggregator_feed", label = @Translation("Aggregator feed"), required = FALSE)
+ *   }
  * )
+ *
  */
 class AggregatorFeedBlock extends BlockBase implements ContainerFactoryPluginInterface {
 
   /**
-   * The entity storage for feeds.
-   *
-   * @var \Drupal\aggregator\FeedStorageInterface
-   */
-  protected $feedStorage;
-
-  /**
    * The entity storage for items.
    *
    * @var \Drupal\aggregator\ItemStorageInterface
@@ -58,16 +54,13 @@ class AggregatorFeedBlock extends BlockBase implements ContainerFactoryPluginInt
    *   The plugin_id for the plugin instance.
    * @param mixed $plugin_definition
    *   The plugin implementation definition.
-   * @param \Drupal\aggregator\FeedStorageInterface $feed_storage
-   *   The entity storage for feeds.
    * @param \Drupal\aggregator\ItemStorageInterface $item_storage
    *   The entity storage for feed items.
    * @param \Drupal\Core\Entity\Query\QueryInterface $item_query
    *   The entity query object for feed items.
    */
-  public function __construct(array $configuration, $plugin_id, $plugin_definition, FeedStorageInterface $feed_storage, ItemStorageInterface $item_storage, QueryInterface $item_query) {
+  public function __construct(array $configuration, $plugin_id, $plugin_definition, ItemStorageInterface $item_storage, QueryInterface $item_query) {
     parent::__construct($configuration, $plugin_id, $plugin_definition);
-    $this->feedStorage = $feed_storage;
     $this->itemStorage = $item_storage;
     $this->itemQuery = $item_query;
   }
@@ -81,7 +74,6 @@ public static function create(ContainerInterface $container, array $configuratio
       $configuration,
       $plugin_id,
       $plugin_definition,
-      $container->get('entity.manager')->getStorage('aggregator_feed'),
       $container->get('entity.manager')->getStorage('aggregator_item'),
       $container->get('entity.query')->get('aggregator_item')
     );
@@ -118,17 +110,6 @@ protected function blockAccess(AccountInterface $account) {
    * {@inheritdoc}
    */
   public function blockForm($form, FormStateInterface $form_state) {
-    $feeds = $this->feedStorage->loadMultiple();
-    $options = array();
-    foreach ($feeds as $feed) {
-      $options[$feed->id()] = $feed->label();
-    }
-    $form['feed'] = array(
-      '#type' => 'select',
-      '#title' => t('Select the feed that should be displayed'),
-      '#default_value' => $this->configuration['feed'],
-      '#options' => $options,
-    );
     $range = range(2, 20);
     $form['block_count'] = array(
       '#type' => 'select',
@@ -152,7 +133,8 @@ public function blockSubmit($form, FormStateInterface $form_state) {
    */
   public function build() {
     // Load the selected feed.
-    if ($feed = $this->feedStorage->load($this->configuration['feed'])) {
+    /** @var $feed \Drupal\aggregator\Entity\Feed */
+    if ($feed = $this->getContextValue('feed')) {
       $result = $this->itemQuery
         ->condition('fid', $feed->id())
         ->range(0, $this->configuration['block_count'])
@@ -194,7 +176,7 @@ public function build() {
    */
   public function getCacheTags() {
     $cache_tags = parent::getCacheTags();
-    $feed = $this->feedStorage->load($this->configuration['feed']);
+    $feed = $this->getContextValue('feed');
     return Cache::mergeTags($cache_tags, $feed->getCacheTags());
   }
 
diff --git a/core/modules/aggregator/src/Tests/AggregatorRenderingTest.php b/core/modules/aggregator/src/Tests/AggregatorRenderingTest.php
index efb3d2f..573d8ce 100644
--- a/core/modules/aggregator/src/Tests/AggregatorRenderingTest.php
+++ b/core/modules/aggregator/src/Tests/AggregatorRenderingTest.php
@@ -44,7 +44,7 @@ public function testBlockLinks() {
     $block = $this->drupalPlaceBlock("aggregator_feed_block", array('label' => 'feed-' . $feed->label()));
 
     // Configure the feed that should be displayed.
-    $block->getPlugin()->setConfigurationValue('feed', $feed->id());
+    $block->getPlugin()->setContextMapping(['feed' => 'aggregator.feed:' . $feed->id()]);
     $block->getPlugin()->setConfigurationValue('block_count', 2);
     $block->save();
 
diff --git a/core/modules/aggregator/src/Tests/DeleteFeedTest.php b/core/modules/aggregator/src/Tests/DeleteFeedTest.php
index 6ec7c50..c4b4bab 100644
--- a/core/modules/aggregator/src/Tests/DeleteFeedTest.php
+++ b/core/modules/aggregator/src/Tests/DeleteFeedTest.php
@@ -30,10 +30,10 @@ function testDeleteFeed() {
 
     // Place a block for both feeds.
     $block = $this->drupalPlaceBlock('aggregator_feed_block');
-    $block->getPlugin()->setConfigurationValue('feed', $feed1->id());
+    $block->getPlugin()->setContextMapping(['feed' => 'aggregator.feed:' . $feed1->id()]);
     $block->save();
     $block2 = $this->drupalPlaceBlock('aggregator_feed_block');
-    $block2->getPlugin()->setConfigurationValue('feed', $feed2->id());
+    $block2->getPlugin()->setContextMapping(['feed' => 'aggregator.feed:' . $feed2->id()]);
     $block2->save();
 
     // Delete feed.
diff --git a/core/modules/block/src/BlockForm.php b/core/modules/block/src/BlockForm.php
index d2dc42f..1eb1114 100644
--- a/core/modules/block/src/BlockForm.php
+++ b/core/modules/block/src/BlockForm.php
@@ -310,7 +310,12 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
     $settings = (new FormState())->setValues($form_state->getValue('settings'));
 
     // Call the plugin submit handler.
-    $entity->getPlugin()->submitConfigurationForm($form, $settings);
+    $block = $entity->getPlugin();
+    $block->submitConfigurationForm($form, $settings);
+    if ($block instanceof ContextAwarePluginInterface) {
+      $context_mapping = $settings->getValue('context_mapping', []);
+      $block->setContextMapping($context_mapping);
+    }
     // Update the original form values.
     $form_state->setValue('settings', $settings->getValues());
 
diff --git a/core/modules/block/src/BlockRepository.php b/core/modules/block/src/BlockRepository.php
index c11a4fe..1df8b52 100644
--- a/core/modules/block/src/BlockRepository.php
+++ b/core/modules/block/src/BlockRepository.php
@@ -10,6 +10,7 @@
 use Drupal\Core\Entity\EntityManagerInterface;
 use Drupal\Core\Plugin\Context\ContextHandlerInterface;
 use Drupal\Core\Theme\ThemeManagerInterface;
+use Drupal\Component\Plugin\ContextAwarePluginInterface;
 
 /**
  * Provides a repository for Block config entities.
@@ -76,8 +77,13 @@ public function getVisibleBlocksPerRegion(array $contexts) {
     $full = array();
     foreach ($this->blockStorage->loadByProperties(array('theme' => $this->getTheme())) as $block_id => $block) {
       /** @var \Drupal\block\BlockInterface $block */
+      $block->setContexts($contexts);
+      $block_plugin = $block->getPlugin();
+      if ($block_plugin instanceof ContextAwarePluginInterface) {
+        $this->contextHandler->applyContextMapping($block_plugin, $contexts);
+      }
       // Set the contexts on the block before checking access.
-      if ($block->setContexts($contexts)->access('view')) {
+      if ($block->access('view')) {
         $full[$block->get('region')][$block_id] = $block;
       }
     }
diff --git a/core/modules/block/src/Tests/BlockInterfaceTest.php b/core/modules/block/src/Tests/BlockInterfaceTest.php
index 3c7ecb0..cb17bf7 100644
--- a/core/modules/block/src/Tests/BlockInterfaceTest.php
+++ b/core/modules/block/src/Tests/BlockInterfaceTest.php
@@ -67,6 +67,7 @@ public function testBlockInterface() {
     $contexts = \Drupal::service("cache_contexts")->getLabels();
     unset($contexts['cache_context.theme']);
     $expected_form = array(
+      'context_mapping' => array(),
       'provider' => array(
         '#type' => 'value',
         '#value' => 'block_test',
