Loading core/modules/media_library/src/Plugin/Field/FieldWidget/MediaLibraryWidget.php +2 −1 Original line number Diff line number Diff line Loading @@ -305,7 +305,8 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen $element += [ '#type' => 'fieldset', '#cardinality' => $this->fieldDefinition->getFieldStorageDefinition()->getCardinality(), '#target_bundles' => $settings['target_bundles'] ?? FALSE, // If no target bundles are specified, all target bundles are allowed. '#target_bundles' => $settings['target_bundles'] ?? [], '#attributes' => [ 'id' => $wrapper_id, 'class' => ['js-media-library-widget'], Loading core/modules/media_library/tests/src/FunctionalJavascript/EntityReferenceWidgetTest.php +6 −1 Original line number Diff line number Diff line Loading @@ -140,7 +140,12 @@ public function testWidget() { $this->assertTrue($menu->hasLink('Type Three')); $this->assertTrue($menu->hasLink('Type Four')); $this->assertTrue($menu->hasLink('Type Five')); $assert_session->elementExists('css', '.ui-dialog-titlebar-close')->click(); // Insert media to test validation with null target_bundles. $this->switchToMediaType('One'); $this->assertNotEmpty($assert_session->waitForText('Showing Type One media.')); $this->selectMediaItem(0); $this->pressInsertSelected('Added one media item.'); // Assert that the media type menu is not available when only 1 type is // configured for the field. Loading Loading
core/modules/media_library/src/Plugin/Field/FieldWidget/MediaLibraryWidget.php +2 −1 Original line number Diff line number Diff line Loading @@ -305,7 +305,8 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen $element += [ '#type' => 'fieldset', '#cardinality' => $this->fieldDefinition->getFieldStorageDefinition()->getCardinality(), '#target_bundles' => $settings['target_bundles'] ?? FALSE, // If no target bundles are specified, all target bundles are allowed. '#target_bundles' => $settings['target_bundles'] ?? [], '#attributes' => [ 'id' => $wrapper_id, 'class' => ['js-media-library-widget'], Loading
core/modules/media_library/tests/src/FunctionalJavascript/EntityReferenceWidgetTest.php +6 −1 Original line number Diff line number Diff line Loading @@ -140,7 +140,12 @@ public function testWidget() { $this->assertTrue($menu->hasLink('Type Three')); $this->assertTrue($menu->hasLink('Type Four')); $this->assertTrue($menu->hasLink('Type Five')); $assert_session->elementExists('css', '.ui-dialog-titlebar-close')->click(); // Insert media to test validation with null target_bundles. $this->switchToMediaType('One'); $this->assertNotEmpty($assert_session->waitForText('Showing Type One media.')); $this->selectMediaItem(0); $this->pressInsertSelected('Added one media item.'); // Assert that the media type menu is not available when only 1 type is // configured for the field. Loading