2

The Media Library experimental module in core introduces a generic media type "file", while File entity calls the same thing "document". For comparison, the other bundle names are consistent between the two: image, audio, video.

Why did Media Library in core decide to change the naming and precedence set by the File entity module in contrib? I'm trying to wrap my head around the domain model here, to ensure I'm thinking about a Media Library in the correct way. From an end-user perspective, an image and a video are both files whereas a document is neither an image or video, so the delineation in File entity aligns better with reality.

This decision affects modules in the contrib space that want to build features around the emerging Media functionality in core, so an understanding of the domain model and intended usage will help build things up correctly, instead of taking things in parallel and incorrect directions.

5

After a bit of reading around, it seems that the core Media module was never adapted/updated from the File Entity module; it was a port of the Media Entity module (which didn't have its origins in File Entity either). See Bring Media entity module to core as Media module for the full details.

The "file" media type did have its origins in a plugin named "Document", provided by the Media entity document module, which provided the same basic functionality as File Entity's "document". So there may have been some crossover in their evolutions somewhere along the line.

But even so, reading through the proposal to Add "File" MediaSource plugin, it becomes clear that there was no intention to port the "document" type over in its previous form, rather just to use it as a starting point for the generic file type. From comment 24 on that issue, in response to a previous query of I'm wondering whether file should be document instead? File seems really generic as image is also a file:

26-1: As commented with @dawehner on the sprint, the idea is that the Image handler extends this plugin, so this name is probably the most appropriate in this case. A "Document" plugin can be created also extending "File", if needed to expose specific UI improvements for documents.

  • To add on the file vs document, as you said yourself, the file plugin can handle any file just like its name suggests, you can store image files there, but you don't get any image specific features. What you then do in your site is create a Document media type with the file source and only allow, for example, pdf files. – Berdir Oct 30 '18 at 1:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.