function TestDifferentDisplays::prepareFormDisplay

Same name in other branches
  1. 8.9.x core/modules/media/tests/modules/media_test_source/src/Plugin/media/Source/TestDifferentDisplays.php \Drupal\media_test_source\Plugin\media\Source\TestDifferentDisplays::prepareFormDisplay()
  2. 10 core/modules/media/tests/modules/media_test_source/src/Plugin/media/Source/TestDifferentDisplays.php \Drupal\media_test_source\Plugin\media\Source\TestDifferentDisplays::prepareFormDisplay()
  3. 11.x core/modules/media/tests/modules/media_test_source/src/Plugin/media/Source/TestDifferentDisplays.php \Drupal\media_test_source\Plugin\media\Source\TestDifferentDisplays::prepareFormDisplay()

Overrides MediaSourceBase::prepareFormDisplay

File

core/modules/media/tests/modules/media_test_source/src/Plugin/media/Source/TestDifferentDisplays.php, line 35

Class

TestDifferentDisplays
Provides test media source.

Namespace

Drupal\media_test_source\Plugin\media\Source

Code

public function prepareFormDisplay(MediaTypeInterface $type, EntityFormDisplayInterface $display) {
    parent::prepareFormDisplay($type, $display);
    $source_name = $this->getSourceFieldDefinition($type)
        ->getName();
    $source_component = $display->getComponent($source_name) ?: [];
    $source_component['type'] = 'entity_reference_autocomplete_tags';
    $display->setComponent($source_name, $source_component);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.