From 1b2d2e25874f87d1d791bc7f562e41f52fe3ada6 Mon Sep 17 00:00:00 2001
From: Dane Powell <git@danepowell.com>
Date: Tue, 24 Oct 2017 14:11:48 -0700
Subject: [PATCH] Issue #2915036 by Dane Powell: Fixed view modes not updating
 in response to new fields.

---
 core/modules/field_ui/src/Form/FieldStorageAddForm.php | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/core/modules/field_ui/src/Form/FieldStorageAddForm.php b/core/modules/field_ui/src/Form/FieldStorageAddForm.php
index e1f278796e..e5657c170c 100644
--- a/core/modules/field_ui/src/Form/FieldStorageAddForm.php
+++ b/core/modules/field_ui/src/Form/FieldStorageAddForm.php
@@ -428,7 +428,7 @@ protected function configureEntityFormDisplay($field_name, $widget_id = NULL) {
   }
 
   /**
-   * Configures the field for the default view mode.
+   * Configures the field for active view modes.
    *
    * @param string $field_name
    *   The field name.
@@ -443,6 +443,15 @@ protected function configureEntityViewDisplay($field_name, $formatter_id = NULL)
     entity_get_display($this->entityTypeId, $this->bundle, 'default')
       ->setComponent($field_name, $options)
       ->save();
+    // Allow other view modes to update their configuration in response to the
+    // new field.
+    $view_modes = $this->entityManager->getViewModes($this->entityTypeId);
+    foreach ($view_modes as $id => $view_mode) {
+      if ($view_mode['status']) {
+        entity_get_display($this->entityTypeId, $this->bundle, $id)
+          ->save();
+      }
+    }
   }
 
   /**
-- 
2.14.1

