You are here

public function MediaSourceBase::prepareFormDisplay in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/media/src/MediaSourceBase.php \Drupal\media\MediaSourceBase::prepareFormDisplay()
  2. 9 core/modules/media/src/MediaSourceBase.php \Drupal\media\MediaSourceBase::prepareFormDisplay()
1 call to MediaSourceBase::prepareFormDisplay()
TestDifferentDisplays::prepareFormDisplay in core/modules/media/tests/modules/media_test_source/src/Plugin/media/Source/TestDifferentDisplays.php
Prepares the media type fields for this source in the form display.
3 methods override MediaSourceBase::prepareFormDisplay()
OEmbed::prepareFormDisplay in core/modules/media/src/Plugin/media/Source/OEmbed.php
Prepares the media type fields for this source in the form display.
TestDifferentDisplays::prepareFormDisplay in core/modules/media/tests/modules/media_test_source/src/Plugin/media/Source/TestDifferentDisplays.php
Prepares the media type fields for this source in the form display.
TestWithHiddenSourceField::prepareFormDisplay in core/modules/media/tests/modules/media_test_source/src/Plugin/media/Source/TestWithHiddenSourceField.php
Prepares the media type fields for this source in the form display.

File

core/modules/media/src/MediaSourceBase.php, line 354

Class

MediaSourceBase
Base implementation of media source plugin.

Namespace

Drupal\media

Code

public function prepareFormDisplay(MediaTypeInterface $type, EntityFormDisplayInterface $display) {

  // Make sure the source field is placed just after the "name" basefield.
  $name_component = $display
    ->getComponent('name');
  $source_field_weight = $name_component && isset($name_component['weight']) ? $name_component['weight'] + 5 : -50;
  $display
    ->setComponent($this
    ->getSourceFieldDefinition($type)
    ->getName(), [
    'weight' => $source_field_weight,
  ]);
}