diff --git a/core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php b/core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php
index faa6d0d..fcceaaa 100644
--- a/core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php
+++ b/core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php
@@ -319,7 +319,7 @@ public function getPluginCollections() {
     $configurations = [];
     foreach ($this->getComponents() as $field_name => $configuration) {
       if (!empty($configuration['type']) && ($field_definition = $this->getFieldDefinition($field_name))) {
-        $configurations[$configuration['type']] = $configuration + [
+        $configurations[$field_name] = $configuration + [
           'field_definition' => $field_definition,
           'form_mode' => $this->mode,
         ];
diff --git a/core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php b/core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php
index 74b15b6..88b6bba 100644
--- a/core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php
+++ b/core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php
@@ -290,7 +290,7 @@ public function getPluginCollections() {
     $configurations = [];
     foreach ($this->getComponents() as $field_name => $configuration) {
       if (!empty($configuration['type']) && ($field_definition = $this->getFieldDefinition($field_name))) {
-        $configurations[$configuration['type']] = $configuration + [
+        $configurations[$field_name] = $configuration + [
           'field_definition' => $field_definition,
           'view_mode' => $this->originalMode,
         ];
diff --git a/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldDynamicDependenciesFormatter.php b/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldDynamicDependenciesFormatter.php
new file mode 100644
index 0000000..da9e272
--- /dev/null
+++ b/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldDynamicDependenciesFormatter.php
@@ -0,0 +1,75 @@
+<?php
+
+namespace Drupal\field_test\Plugin\Field\FieldFormatter;
+
+use Drupal\Core\Field\FormatterBase;
+use Drupal\Core\Field\FieldItemListInterface;
+use Drupal\Core\Form\FormStateInterface;
+
+/**
+ * Plugin implementation of the 'field_test_dynamic_dependencies' formatter.
+ *
+ * @FieldFormatter(
+ *   id = "field_test_dynamic_dependencies",
+ *   label = @Translation("Dynamic dependencies test"),
+ *   field_types = {
+ *     "test_field",
+ *   },
+ *   weight = 0
+ * )
+ */
+class TestFieldDynamicDependenciesFormatter extends FormatterBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function defaultSettings() {
+    return [
+      'dependent_module' => NULL,
+    ] + parent::defaultSettings();
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function settingsForm(array $form, FormStateInterface $form_state) {
+    $element['dependent_module'] = [
+      '#title' => t('Module'),
+      '#type' => 'textfield',
+      '#default_value' => $this->getSetting('dependent_module'),
+    ];
+    return $element;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function settingsSummary() {
+    $summary = [];
+    $summary[] = t('@setting: @value', ['@setting' => 'dependent_module', '@value' => $this->getSetting('dependent_module')]);
+    return $summary;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function viewElements(FieldItemListInterface $items, $langcode) {
+    $elements = [];
+
+    foreach ($items as $delta => $item) {
+      $elements[$delta] = ['#markup' => 'test'];
+    }
+
+    return $elements;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function calculateDependencies() {
+    $dependencies = parent::calculateDependencies();
+    $dependencies['module'][] = $this->getSetting('dependent_module');
+    return $dependencies;
+  }
+
+}
diff --git a/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldWidget/TestFieldWidgetDynamicDependencies.php b/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldWidget/TestFieldWidgetDynamicDependencies.php
new file mode 100644
index 0000000..1aa216b
--- /dev/null
+++ b/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldWidget/TestFieldWidgetDynamicDependencies.php
@@ -0,0 +1,81 @@
+<?php
+
+namespace Drupal\field_test\Plugin\Field\FieldWidget;
+
+use Drupal\Core\Field\FieldItemListInterface;
+use Drupal\Core\Field\WidgetBase;
+use Drupal\Core\Form\FormStateInterface;
+use Symfony\Component\Validator\ConstraintViolationInterface;
+
+/**
+ * Plugin implementation of the 'test_field_widget' widget.
+ *
+ * @FieldWidget(
+ *   id = "test_field_widget_dynamic_dependencies",
+ *   label = @Translation("Test widget with dynamic dependencies"),
+ *   field_types = {
+ *     "test_field",
+ *   },
+ *   weight = 0
+ * )
+ */
+class TestFieldWidgetDynamicDependencies extends WidgetBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function defaultSettings() {
+    return [
+      'dependent_module' => NULL,
+    ] + parent::defaultSettings();
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function settingsForm(array $form, FormStateInterface $form_state) {
+    $element['dependent_module'] = [
+      '#title' => t('Module'),
+      '#type' => 'textfield',
+      '#default_value' => $this->getSetting('dependent_module'),
+    ];
+    return $element;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function settingsSummary() {
+    $summary = [];
+    $summary[] = t('@setting: @value', ['@setting' => 'dependent_module', '@value' => $this->getSetting('dependent_module')]);
+    return $summary;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
+    $element += [
+      '#type' => 'textfield',
+      '#default_value' => isset($items[$delta]->value) ? $items[$delta]->value : '',
+    ];
+    return ['value' => $element];
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function errorElement(array $element, ConstraintViolationInterface $violation, array $form, FormStateInterface $form_state) {
+    return $element['value'];
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function calculateDependencies() {
+    $dependencies = parent::calculateDependencies();
+    $dependencies['module'][] = $this->getSetting('dependent_module');
+    return $dependencies;
+  }
+
+}
diff --git a/core/modules/field_ui/src/Tests/ManageDisplayTest.php b/core/modules/field_ui/src/Tests/ManageDisplayTest.php
index 7ba011e..3ce547c 100644
--- a/core/modules/field_ui/src/Tests/ManageDisplayTest.php
+++ b/core/modules/field_ui/src/Tests/ManageDisplayTest.php
@@ -92,6 +92,7 @@ public function testFormatterUI() {
       'field_no_settings',
       'field_empty_test',
       'field_empty_setting',
+      'field_test_dynamic_dependencies',
       'field_test_default',
       'field_test_multiple',
       'field_test_with_prepare_view',
@@ -252,6 +253,7 @@ public function testWidgetUI() {
     }, $result);
     $expected_options = [
       'test_field_widget',
+      'test_field_widget_dynamic_dependencies',
       'test_field_widget_multiple',
     ];
     $this->assertEqual($options, $expected_options, 'The expected widget ordering is respected.');
@@ -313,8 +315,17 @@ public function testWidgetUI() {
     $this->drupalGet($manage_display);
 
     // Checks if the select elements contain the specified options.
-    $this->assertFieldSelectOptions('fields[field_test][type]', ['test_field_widget', 'test_field_widget_multiple']);
-    $this->assertFieldSelectOptions('fields[field_onewidgetfield][type]', ['test_field_widget']);
+    $expected_options_multiple = [
+      'test_field_widget',
+      'test_field_widget_dynamic_dependencies',
+      'test_field_widget_multiple',
+    ];
+    $this->assertFieldSelectOptions('fields[field_test][type]', $expected_options_multiple);
+    $expected_options_single = [
+      'test_field_widget',
+      'test_field_widget_dynamic_dependencies',
+    ];
+    $this->assertFieldSelectOptions('fields[field_onewidgetfield][type]', $expected_options_single);
 
     // Ensure that fields can be hidden directly by changing the region.
     $this->assertFieldByName('fields[field_test][region]', 'content');
diff --git a/core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php b/core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php
index 4a0e533..08447ca 100644
--- a/core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php
+++ b/core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php
@@ -270,6 +270,67 @@ public function testFieldComponent() {
   }
 
   /**
+   * Tests the dependencies of field components within an entity display object.
+   */
+  public function testMultipleFieldComponentDependencies() {
+    $first_field_name = 'test_field';
+    // Create a field storage and a field.
+    $first_field_storage = FieldStorageConfig::create([
+      'field_name' => $first_field_name,
+      'entity_type' => 'entity_test',
+      'type' => 'test_field'
+    ]);
+    $first_field_storage->save();
+    $first_field = FieldConfig::create([
+      'field_storage' => $first_field_storage,
+      'bundle' => 'entity_test',
+    ]);
+    $first_field->save();
+
+    $second_field_name = 'test_field_2';
+    // Create a field storage and a field.
+    $second_field_storage = FieldStorageConfig::create([
+      'field_name' => $second_field_name,
+      'entity_type' => 'entity_test',
+      'type' => 'test_field'
+    ]);
+    $second_field_storage->save();
+    $second_field = FieldConfig::create([
+      'field_storage' => $second_field_storage,
+      'bundle' => 'entity_test',
+    ]);
+    $second_field->save();
+
+    $display = EntityViewDisplay::create([
+      'targetEntityType' => 'entity_test',
+      'bundle' => 'entity_test',
+      'mode' => 'default',
+    ]);
+
+    // Check that providing no options results in default values being used.
+    $display->setComponent($first_field_name, [
+      'type' => 'field_test_dynamic_dependencies',
+      'weight' => 0,
+      'settings' => [
+        // An arbitrary module that should not already be a dependency.
+        'dependent_module' => 'action',
+      ],
+    ]);
+
+    $display->setComponent($second_field_name, [
+      'type' => 'field_test_dynamic_dependencies',
+      'weight' => 0,
+      'settings' => [
+        // Another arbitrary module that should not already be a dependency.
+        'dependent_module' => 'aggregrator',
+      ],
+    ]);
+
+    $dependencies = $display->calculateDependencies()->getDependencies();
+    $this->assertArraySubset(['action', 'aggregrator'], $dependencies['module']);
+  }
+
+  /**
    * Tests the behavior of a field component for a base field.
    */
   public function testBaseFieldComponent() {
diff --git a/core/modules/field_ui/tests/src/Kernel/EntityFormDisplayTest.php b/core/modules/field_ui/tests/src/Kernel/EntityFormDisplayTest.php
index 09d2a20..53cde5e 100644
--- a/core/modules/field_ui/tests/src/Kernel/EntityFormDisplayTest.php
+++ b/core/modules/field_ui/tests/src/Kernel/EntityFormDisplayTest.php
@@ -116,6 +116,67 @@ public function testFieldComponent() {
   }
 
   /**
+   * Tests the dependencies of field components within an entity display object.
+   */
+  public function testMultipleFieldComponentDependencies() {
+    $first_field_name = 'test_field';
+    // Create a field storage and a field.
+    $first_field_storage = FieldStorageConfig::create([
+      'field_name' => $first_field_name,
+      'entity_type' => 'entity_test',
+      'type' => 'test_field'
+    ]);
+    $first_field_storage->save();
+    $first_field = FieldConfig::create([
+      'field_storage' => $first_field_storage,
+      'bundle' => 'entity_test',
+    ]);
+    $first_field->save();
+
+    $second_field_name = 'test_field_2';
+    // Create a field storage and a field.
+    $second_field_storage = FieldStorageConfig::create([
+      'field_name' => $second_field_name,
+      'entity_type' => 'entity_test',
+      'type' => 'test_field'
+    ]);
+    $second_field_storage->save();
+    $second_field = FieldConfig::create([
+      'field_storage' => $second_field_storage,
+      'bundle' => 'entity_test',
+    ]);
+    $second_field->save();
+
+    $form_display = EntityFormDisplay::create([
+      'targetEntityType' => 'entity_test',
+      'bundle' => 'entity_test',
+      'mode' => 'default',
+    ]);
+
+    // Check that providing no options results in default values being used.
+    $form_display->setComponent($first_field_name, [
+      'type' => 'test_field_widget_dynamic_dependencies',
+      'weight' => 0,
+      'settings' => [
+        // An arbitrary module that should not already be a dependency.
+        'dependent_module' => 'action',
+      ],
+    ]);
+
+    $form_display->setComponent($second_field_name, [
+      'type' => 'test_field_widget_dynamic_dependencies',
+      'weight' => 0,
+      'settings' => [
+        // Another arbitrary module that should not already be a dependency.
+        'dependent_module' => 'aggregrator',
+      ],
+    ]);
+
+    $dependencies = $form_display->calculateDependencies()->getDependencies();
+    $this->assertArraySubset(['action', 'aggregrator'], $dependencies['module']);
+  }
+
+  /**
    * Tests the behavior of a field component for a base field.
    */
   public function testBaseFieldComponent() {
