diff --git a/core/lib/Drupal/Core/Block/BlockBase.php b/core/lib/Drupal/Core/Block/BlockBase.php
index fe5c12e..04b842e 100644
--- a/core/lib/Drupal/Core/Block/BlockBase.php
+++ b/core/lib/Drupal/Core/Block/BlockBase.php
@@ -152,7 +152,7 @@ protected function blockAccess(AccountInterface $account) {
    *
    * @see \Drupal\Core\Block\BlockBase::blockForm()
    */
-  public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
+  public function buildConfigurationForm(array $form, FormStateInterface $form_state, array $build_context_definitions = []) {
     $definition = $this->getPluginDefinition();
     $form['provider'] = array(
       '#type' => 'value',
@@ -178,8 +178,11 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta
       '#return_value' => BlockInterface::BLOCK_LABEL_VISIBLE,
     );
 
-    // Add context mapping UI form elements.
-    $contexts = $form_state->getTemporaryValue('gathered_contexts') ?: [];
+    // Add context mapping UI form elements. The 'gathered_contexts' key in the
+    // form state is legacy integration with \Drupal\block\BlockForm that has
+    // been replaced with
+    // \Drupal\Core\Block\BlockPluginInterface::buildConfigurationForm().
+    $contexts = array_merge($form_state->getTemporaryValue('gathered_contexts') ?: [], $build_context_definitions);
     $form['context_mapping'] = $this->addContextAssignmentElement($this, $contexts);
     // Add plugin-specific settings for this block type.
     $form += $this->blockForm($form, $form_state);
diff --git a/core/lib/Drupal/Core/Block/BlockPluginInterface.php b/core/lib/Drupal/Core/Block/BlockPluginInterface.php
index cd6811a..3c89885 100644
--- a/core/lib/Drupal/Core/Block/BlockPluginInterface.php
+++ b/core/lib/Drupal/Core/Block/BlockPluginInterface.php
@@ -153,4 +153,19 @@ public function blockSubmit($form, FormStateInterface $form_state);
    */
   public function getMachineNameSuggestion();
 
+  /**
+   * Builds the plugin's configuration form.
+   *
+   * {@inheritdoc}
+   *
+   * @param mixed[] $form
+   *   The plugin's configuration form as a render array.
+   * @param \Drupal\Core\Form\FormStateInterface $form_state
+   *   The state of the plugin's configuration form.
+   * @param \Drupal\Core\Plugin\Context\ContextInterface[] $build_context_definitions
+   *   The definitions of the contexts that will be available when building this
+   *   block.
+   */
+  public function buildConfigurationForm(array $form, FormStateInterface $form_state, array $build_context_definitions = []);
+
 }
diff --git a/core/lib/Drupal/Core/Condition/ConditionInterface.php b/core/lib/Drupal/Core/Condition/ConditionInterface.php
index fd1b374..31b035c 100644
--- a/core/lib/Drupal/Core/Condition/ConditionInterface.php
+++ b/core/lib/Drupal/Core/Condition/ConditionInterface.php
@@ -12,6 +12,7 @@
 use Drupal\Core\Cache\CacheableDependencyInterface;
 use Drupal\Core\Executable\ExecutableInterface;
 use Drupal\Core\Executable\ExecutableManagerInterface;
+use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Plugin\PluginFormInterface;
 
 /**
@@ -78,4 +79,19 @@ public function summary();
    */
   public function setExecutableManager(ExecutableManagerInterface $executableManager);
 
+  /**
+   * Builds the plugin's configuration form.
+   *
+   * {@inheritdoc}
+   *
+   * @param mixed[] $form
+   *   The plugin's configuration form as a render array.
+   * @param \Drupal\Core\Form\FormStateInterface $form_state
+   *   The state of the plugin's configuration form.
+   * @param \Drupal\Core\Plugin\Context\ContextInterface[] $evaluation_context_definitions
+   *   The definitions of the contexts that will be available when evaluating
+   *   this condition.
+   */
+  public function buildConfigurationForm(array $form, FormStateInterface $form_state, array $evaluation_context_definitions = []);
+
 }
diff --git a/core/lib/Drupal/Core/Condition/ConditionPluginBase.php b/core/lib/Drupal/Core/Condition/ConditionPluginBase.php
index 5237d0d..6d60096 100644
--- a/core/lib/Drupal/Core/Condition/ConditionPluginBase.php
+++ b/core/lib/Drupal/Core/Condition/ConditionPluginBase.php
@@ -51,8 +51,11 @@ public function isNegated() {
   /**
    * {@inheritdoc}
    */
-  public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
-    $contexts = $form_state->getTemporaryValue('gathered_contexts') ?: [];
+  public function buildConfigurationForm(array $form, FormStateInterface $form_state, array $evaluation_context_definitions = []) {
+    // The 'gathered_contexts' key in the form state is legacy functionality
+    // that has been replaced with
+    // \Drupal\Core\Condition\ConditionInterface::buildConfigurationForm().
+    $contexts = array_merge($form_state->getTemporaryValue('gathered_contexts') ?: [], $evaluation_context_definitions);
     $form['context_mapping'] = $this->addContextAssignmentElement($this, $contexts);
     $form['negate'] = array(
       '#type' => 'checkbox',
diff --git a/core/modules/block/src/BlockForm.php b/core/modules/block/src/BlockForm.php
index 50e4d38..12bcfea 100644
--- a/core/modules/block/src/BlockForm.php
+++ b/core/modules/block/src/BlockForm.php
@@ -121,11 +121,13 @@ public function form(array $form, FormStateInterface $form_state) {
     $form_state->set('block_theme', $theme);
 
     // Store the gathered contexts in the form state for other objects to use
-    // during form building.
+    // during form building. This is legacy integration with
+    // \Drupal\Core\Block\BlockBase that has been replaced by
+    // \Drupal\Core\Block\BlockPluginInterface::buildConfigurationForm().
     $form_state->setTemporaryValue('gathered_contexts', $this->contextRepository->getAvailableContexts());
 
     $form['#tree'] = TRUE;
-    $form['settings'] = $entity->getPlugin()->buildConfigurationForm(array(), $form_state);
+    $form['settings'] = $entity->getPlugin()->buildConfigurationForm(array(), $form_state, $this->contextRepository->getAvailableContexts());
     $form['visibility'] = $this->buildVisibilityInterface([], $form_state);
 
     // If creating a new block, calculate a safe default machine name.
diff --git a/core/modules/views/src/Plugin/Block/ViewsBlockBase.php b/core/modules/views/src/Plugin/Block/ViewsBlockBase.php
index 4f8bcce..d4a314a 100644
--- a/core/modules/views/src/Plugin/Block/ViewsBlockBase.php
+++ b/core/modules/views/src/Plugin/Block/ViewsBlockBase.php
@@ -113,8 +113,8 @@ public function defaultConfiguration() {
   /**
    * {@inheritdoc}
    */
-  public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
-    $form = parent::buildConfigurationForm($form, $form_state);
+  public function buildConfigurationForm(array $form, FormStateInterface $form_state, array $build_context_definitions = []) {
+    $form = parent::buildConfigurationForm($form, $form_state, $build_context_definitions);
 
     // Set the default label to '' so the views internal title is used.
     $form['label']['#default_value'] = '';
