protected function MediaLibraryWidgetTest::buildWidgetForm in Drupal 9
Same name and namespace in other branches
- 8 core/modules/media_library/tests/src/Kernel/MediaLibraryWidgetTest.php \Drupal\Tests\media_library\Kernel\MediaLibraryWidgetTest::buildWidgetForm()
Build the media library widget form.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity to build the form for.
Return value
array A built form array of the media library widget.
2 calls to MediaLibraryWidgetTest::buildWidgetForm()
- MediaLibraryWidgetTest::testRevisionableWidgetAccess in core/
modules/ media_library/ tests/ src/ Kernel/ MediaLibraryWidgetTest.php - Test the media library widget access with a revisionable entity type.
- MediaLibraryWidgetTest::testWidgetAccess in core/
modules/ media_library/ tests/ src/ Kernel/ MediaLibraryWidgetTest.php - Test the media library widget access.
File
- core/
modules/ media_library/ tests/ src/ Kernel/ MediaLibraryWidgetTest.php, line 147
Class
- MediaLibraryWidgetTest
- Tests the media library widget.
Namespace
Drupal\Tests\media_library\KernelCode
protected function buildWidgetForm($entity) {
$form = [
'#parents' => [],
];
return $this->container
->get('plugin.manager.field.widget')
->createInstance('media_library_widget', [
'field_definition' => $this->baseField,
'settings' => [],
'third_party_settings' => [],
])
->formElement($entity->media, 0, [
'#description' => '',
], $form, new FormState());
}