function MediaSourceTestBase::hideMediaTypeFieldWidget
Same name in other branches
- 9 core/modules/media/tests/src/FunctionalJavascript/MediaSourceTestBase.php \Drupal\Tests\media\FunctionalJavascript\MediaSourceTestBase::hideMediaTypeFieldWidget()
- 10 core/modules/media/tests/src/FunctionalJavascript/MediaSourceTestBase.php \Drupal\Tests\media\FunctionalJavascript\MediaSourceTestBase::hideMediaTypeFieldWidget()
- 11.x core/modules/media/tests/src/FunctionalJavascript/MediaSourceTestBase.php \Drupal\Tests\media\FunctionalJavascript\MediaSourceTestBase::hideMediaTypeFieldWidget()
Hides a widget in the default form display config.
Parameters
string $field_name: The field name.
string $media_type_id: The media type config entity ID.
3 calls to MediaSourceTestBase::hideMediaTypeFieldWidget()
- MediaSourceFileTest::testMediaFileSource in core/
modules/ media/ tests/ src/ FunctionalJavascript/ MediaSourceFileTest.php - Tests the file media source.
- MediaSourceImageTest::testMediaImageSource in core/
modules/ media/ tests/ src/ FunctionalJavascript/ MediaSourceImageTest.php - Tests the image media source.
- MediaSourceOEmbedVideoTest::testMediaOEmbedVideoSource in core/
modules/ media/ tests/ src/ FunctionalJavascript/ MediaSourceOEmbedVideoTest.php - Tests the oembed media source.
File
-
core/
modules/ media/ tests/ src/ FunctionalJavascript/ MediaSourceTestBase.php, line 95
Class
- MediaSourceTestBase
- Base class for media source tests.
Namespace
Drupal\Tests\media\FunctionalJavascriptCode
protected function hideMediaTypeFieldWidget($field_name, $media_type_id) {
/** @var \Drupal\Core\Entity\EntityDisplayRepositoryInterface $display_repository */
$display_repository = \Drupal::service('entity_display.repository');
/** @var \Drupal\Core\Entity\Display\EntityFormDisplayInterface $entity_form_display */
$entity_form_display = $display_repository->getFormDisplay('media', $media_type_id, 'default');
if ($entity_form_display->getComponent($field_name)) {
$entity_form_display->removeComponent($field_name)
->save();
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.