Change record status: 
Project: 
Introduced in branch: 
8.5.x
Introduced in version: 
8.5.0
Description: 

\Drupal\media\MediaSourceInterface got two new methods, ::prepareViewDisplay(MediaTypeInterface $type, EntityViewDisplayInterface $display) and ::prepareFormDisplay(MediaTypeInterface $type, EntityFormDisplayInterface $display).
Both provide the source plugins with the ability to configure how their fields should be displayed in the view and form display.

\Drupal\media\MediaSourceBase implements the new methods and sets the source field to its default widget/formatter settings.

For example, if \Drupal\media\Plugin\media\Source\Image wanted to specify a formatter for its source field different from the field defaults, it could implement something like:

  /**
   * {@inheritdoc}
   */
  public function prepareViewDisplay(MediaTypeInterface $type, EntityViewDisplayInterface $display) {
    $display->setComponent($this->getSourceFieldDefinition($type)->getName(), [
      'type' => 'image_url',
      'settings' => [
        'image_style' => 'thumbnail',
      ],
    ]);
  }

Which would set the source field to be displayed using the image_url formatter.

Impacts: 
Module developers
Updates Done (doc team, etc.)
Online documentation: 
Not done
Theming guide: 
Not done
Module developer documentation: 
Not done
Examples project: 
Not done
Coder Review: 
Not done
Coder Upgrade: 
Not done
Other: 
Other updates done