diff -u b/core/modules/entity/lib/Drupal/entity/Plugin/Core/Entity/EntityDisplay.php b/core/modules/entity/lib/Drupal/entity/Plugin/Core/Entity/EntityDisplay.php --- b/core/modules/entity/lib/Drupal/entity/Plugin/Core/Entity/EntityDisplay.php +++ b/core/modules/entity/lib/Drupal/entity/Plugin/Core/Entity/EntityDisplay.php @@ -12,8 +12,8 @@ use Drupal\Core\Annotation\Translation; /** - * Configuration encapsulator that provides all the data needed by block-driven - * controllers to render an entity. + * Configuration entity that contains display options for all components of a + * rendered entity in a given view mode.. * * @Plugin( * id = "entity_display", diff -u b/core/modules/entity/lib/Drupal/entity/Tests/EntityDisplayTest.php b/core/modules/entity/lib/Drupal/entity/Tests/EntityDisplayTest.php --- b/core/modules/entity/lib/Drupal/entity/Tests/EntityDisplayTest.php +++ b/core/modules/entity/lib/Drupal/entity/Tests/EntityDisplayTest.php @@ -27,7 +27,7 @@ protected function setUp() { parent::setUp(); - $this->enableModules(array('system', 'field')); + $this->enableModules(array('system', 'entity', 'field')); } /** diff -u b/core/modules/field/field.install b/core/modules/field/field.install --- b/core/modules/field/field.install +++ b/core/modules/field/field.install @@ -460,7 +460,8 @@ // Set options in the display. $new_options = array('visible' => $display_options['visible']); - // The display object only stores the weight for 'visible' extra fields. + // The display object only stores the weight for 'visible' extra + // fields. if ($display_options['visible']) { $new_options['weight'] = $display_options['weight']; } diff -u b/core/modules/user/user.install b/core/modules/user/user.install --- b/core/modules/user/user.install +++ b/core/modules/user/user.install @@ -431,34 +431,32 @@ ), 'weight' => -1, ), - 'display' => array( - 'default' => array( - 'label' => 'hidden', - 'type' => 'image', - 'settings' => array( - 'image_style' => 'thumbnail', - 'image_link' => 'content', - ), - ), - 'compact' => array( - 'label' => 'hidden', - 'type' => 'image', - 'settings' => array( - 'image_style' => 'thumbnail', - 'image_link' => 'content', - ), - ), - ), ); field_create_instance($instance); - // Remove 'summary' pseudo-field from compact view mode on the User entity. - $bundle_settings = field_bundle_settings('user', 'user'); - $bundle_settings['extra_fields']['display']['member_for']['compact'] = array( - 'visible' => FALSE, - 'weight' => 10, - ); - field_bundle_settings('user', 'user', $bundle_settings); + // Assign display settings for the 'default' and 'compact' view modes. + entity_get_display('user', 'user', 'default') + ->setComponent('user_picture', array( + 'label' => 'hidden', + 'type' => 'image', + 'settings' => array( + 'image_style' => 'thumbnail', + 'image_link' => 'content', + ), + )) + ->save(); + entity_get_display('user', 'user', 'compact') + ->setComponent('user_picture', array( + 'label' => 'hidden', + 'type' => 'image', + 'settings' => array( + 'image_style' => 'thumbnail', + 'image_link' => 'content', + ), + )) + // Additionally, hide 'summary' pseudo-field from compact view mode.. + ->removeComponent('member_for') + ->save(); } /**