diff --git a/core/modules/media_library/src/Form/FileUploadForm.php b/core/modules/media_library/src/Form/FileUploadForm.php index df3e84286d..dfd2f01ed8 100644 --- a/core/modules/media_library/src/Form/FileUploadForm.php +++ b/core/modules/media_library/src/Form/FileUploadForm.php @@ -142,7 +142,7 @@ protected function buildInputElement(array $form, FormStateInterface $form_state $file_upload_help = [ '#theme' => 'file_upload_help', - '#upload_validators' => $form['upload']['#upload_validators'], + '#upload_validators' => $form['container']['upload']['#upload_validators'], '#cardinality' => $slots, ]; diff --git a/core/modules/media_library/tests/src/Kernel/MediaLibraryAddFormTest.php b/core/modules/media_library/tests/src/Kernel/MediaLibraryAddFormTest.php index 0d180bb880..833ede9a65 100644 --- a/core/modules/media_library/tests/src/Kernel/MediaLibraryAddFormTest.php +++ b/core/modules/media_library/tests/src/Kernel/MediaLibraryAddFormTest.php @@ -87,7 +87,7 @@ public function testMediaTypeAddForm() { ])); // Assert the media library UI only contains the add form for the image // media type. - $this->assertSame('managed_file', $this->buildLibraryUi('image')['content']['form']['upload']['#type']); + $this->assertSame('managed_file', $this->buildLibraryUi('image')['content']['form']['container']['upload']['#type']); $this->assertEmpty($this->buildLibraryUi('remote_video')['content']['form']); // Create a user that has access to create both media types. @@ -97,7 +97,7 @@ public function testMediaTypeAddForm() { ])); // Assert the media library UI only contains the add form for both media // types. - $this->assertSame('managed_file', $this->buildLibraryUi('image')['content']['form']['upload']['#type']); + $this->assertSame('managed_file', $this->buildLibraryUi('image')['content']['form']['container']['upload']['#type']); $this->assertSame('url', $this->buildLibraryUi('remote_video')['content']['form']['container']['url']['#type']); }