diff --git a/core/modules/media/images/icons/generic.png b/core/modules/media/images/icons/generic.png index 2050a78a4f..13090d8d0d 100644 --- a/core/modules/media/images/icons/generic.png +++ b/core/modules/media/images/icons/generic.png @@ -1,3 +1,4 @@ -PNG +PNG  - IHDRYfIDATx@@}7J0@YwwwwwwU9fM/, 4hРA4hРA 4hРA 4hРA Z,+h]~˽YX/6@G5$:deDT4z 󦤇Eh; mj` _;> ,E]%e{EH\$Хb]Zt77؇թEs3d K-Z jkULR1ךgoٱ}]SB(>N-mwRA.=!sm4O"Dه=uckw̕ӎI--BtChР5Nvze]{JCo6Og$>tq.ޔ43b\h4hР[)In :5O,s.$z z ]k6t6d35Z7~zӖ]Klо< !A 4hРA 4hРA 4hРA 4M+FEIENDB` \ No newline at end of file + IHDRYdIDATx0@ޠ(333333,[D߉y$hР 4hI4hРA 4hРA 4hРAkۀ}6 ņ訆Dllр6\C!{ޒvHmG5AQ Q_.4" +3Y3׋20zBf֐i"3s]Γ@*⋹vi"h>N-z\[%eY*hi=7bM`7[\GD s}v۷ou=%RAђ{'|ˣD{*44hРAVoّ#]к<-kAjMuˣX./~4hйFVg*W+VͷV}}ۧ+2Ft*B}8Ճ[7v\gOL9I|hQo# ZjWE+ٻUzy:#񡋋/̤#DРANI4Et4hOǀˀ-}keks!#Ѡ7ȵǎ^n#;xk#8quW7#պ˓@` 4hРA 4hРA 4hРA 4hР7 +F*IENDB` \ No newline at end of file diff --git a/core/modules/media/src/Plugin/media/Source/File.php b/core/modules/media/src/Plugin/media/Source/File.php index 909cb4e900..b3ab119f63 100644 --- a/core/modules/media/src/Plugin/media/Source/File.php +++ b/core/modules/media/src/Plugin/media/Source/File.php @@ -23,27 +23,9 @@ class File extends MediaSourceBase { /** - * Key for MIME type metadata attribute. - * - * @var string - */ - const METADATA_ATTRIBUTE_MIME = 'mime'; - - /** - * Key for size metadata attribute. - * - * @var string - */ - const METADATA_ATTRIBUTE_SIZE = 'size'; - - /** * {@inheritdoc} */ public function getMetadataAttributes() { - return [ - static::METADATA_ATTRIBUTE_MIME => $this->t('MIME type'), - static::METADATA_ATTRIBUTE_SIZE => $this->t('Size'), - ]; } /** @@ -63,13 +45,6 @@ public function getMetadata(MediaInterface $media, $attribute_name) { case 'thumbnail_uri': return $this->getThumbnail($file) ?: parent::getMetadata($media, $attribute_name); - case static::METADATA_ATTRIBUTE_MIME: - return $file->getMimeType() ?: NULL; - - case static::METADATA_ATTRIBUTE_SIZE: - $size = $file->getSize(); - return is_numeric($size) ? $size : NULL; - default: return parent::getMetadata($media, $attribute_name); } diff --git a/core/modules/media/tests/src/FunctionalJavascript/MediaSourceFileTest.php b/core/modules/media/tests/src/FunctionalJavascript/MediaSourceFileTest.php index a2883ed522..7dd03efc87 100644 --- a/core/modules/media/tests/src/FunctionalJavascript/MediaSourceFileTest.php +++ b/core/modules/media/tests/src/FunctionalJavascript/MediaSourceFileTest.php @@ -18,33 +18,16 @@ class MediaSourceFileTest extends MediaSourceTestBase { public function testMediaFileSource() { $media_type_id = 'test_media_file_type'; $source_field_id = 'field_media_file'; - $provided_fields = [ - File::METADATA_ATTRIBUTE_MIME, - File::METADATA_ATTRIBUTE_SIZE, - ]; $session = $this->getSession(); $page = $session->getPage(); $assert_session = $this->assertSession(); - $this->doTestCreateMediaType($media_type_id, 'file', $provided_fields); - - // Create a custom field for the media type to store the MIME metadata - // attributes. - $fields = [ - 'field_string_mime' => 'string', - 'field_string_size' => 'string', - ]; - $this->createMediaTypeFields($fields, $media_type_id); + $this->doTestCreateMediaType($media_type_id, 'file'); // Hide the name field widget to test default name generation. $this->hideMediaTypeFieldWidget('name', $media_type_id); - $this->drupalGet("admin/structure/media/manage/{$media_type_id}"); - $page->selectFieldOption("field_map[mime]", 'field_string_mime'); - $page->selectFieldOption("field_map[size]", 'field_string_size'); - $page->pressButton('Save'); - // Create a media item. $this->drupalGet("media/add/{$media_type_id}"); $page->attachFileToField("files[{$source_field_id}_0]", \Drupal::root() . '/sites/README.txt'); @@ -56,11 +39,9 @@ public function testMediaFileSource() { // Make sure the thumbnail is displayed. $assert_session->elementAttributeContains('css', '.image-style-thumbnail', 'src', 'generic.png'); - // Load the media and check that all fields are properly populated. + // Load the media and check if the label was properly populated. $media = Media::load(1); $this->assertEquals('README.txt', $media->label()); - $this->assertEquals('text/plain', $media->get('field_string_mime')->value); - $this->assertEquals(filesize(\Drupal::root() . '/sites/README.txt'), $media->get('field_string_size')->value); // Test the MIME type icon. $icon_base = \Drupal::config('media.settings')->get('icon_base_uri'); diff --git a/core/profiles/standard/config/optional/media.type.file.yml b/core/profiles/standard/config/optional/media.type.file.yml index f0d239a1ba..0fc270a083 100644 --- a/core/profiles/standard/config/optional/media.type.file.yml +++ b/core/profiles/standard/config/optional/media.type.file.yml @@ -8,7 +8,7 @@ label: File description: "Use local files for reusable media." source: file queue_thumbnail_downloads: false -new_revision: false +new_revision: true source_configuration: source_field: field_media_file field_map: { }