Problem/Motivation
When uploading a new image file via the media library widget, the next step of the dialog shows ALL the fields available on that media type.

This differs from Standard profile, where users only see the alt text field.

It's because Umami hasn't enabled the media library form displays, like Standard profile has.
So far the image media type is the only one enabled on media entityreference fields in Umami. The problem does affect the other media types to though, if you enable them for a field. Since we are considering showcasing other media types in Umami, those will need the media library form display too.
Proposed resolution
Enable the media library form displays, like Standard profile does.
- For image media, hide all fields except field_media_image
- For all other media types, hide all fields
Remaining tasks
Manual testing using Umami, listing the steps taken.
New before and after screenshots, in the issue summary
Add media library form displays to Umami's install config.
- DONE - core.entity_form_display.media.audio.media_library.yml
- DONE - core.entity_form_display.media.document.media_library.yml
- DONE - core.entity_form_display.media.image.media_library.yml
- DONE - core.entity_form_display.media.remote_video.media_library.yml
- DONE - core.entity_form_display.media.video.media_library.yml
User interface changes
Make adding media via the media library widget dialog nicer
Before

After

API changes
None.
Data model changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #28 | interdiff-3097503-25-28.txt | 6.68 KB | Zsuffa Dávid |
| #28 | 3097503-28.patch | 10.73 KB | Zsuffa Dávid |
| #25 | 3097503-25.patch | 14.88 KB | _utsavsharma |
| #25 | interdiff_23-25.txt | 3.33 KB | _utsavsharma |
| #23 | media-grid-AFTER.png | 154.56 KB | Zsuffa Dávid |
Comments
Comment #2
andrewmacpherson commentedScreenshots of the problem.
I've got some working config. Patch coming soon.
Comment #3
andrewmacpherson commentedThis enables the media library form display for the image media
Comment #4
andrewmacpherson commentedThis patch adds media library form displays for the remaining media bungles.
Note, I'm just trying to address the form displays here, for the UI for creating new media entities via the media library widget.
I've noticed some other issues which happen because the media library view displays aren't being used either. Those can be treated as a separate issue I think,
Comment #5
andrewmacpherson commentedForgot the patch :-(
Comment #6
andrewmacpherson commentedComment #7
andrewmacpherson commentedI noticed that the media name field is enabled on the default form display for images. At first I thought that was something else to make consistent with Standard profile, but it looks like that was intentional in #2954378: Use Media images in Umami demo.
So if the name field is enabled on the default form display, should it also be enabled on the media library form display? I have no opinion.
Comment #10
markconroy commentedThis works a treat. Thanks very much @andrewmacpherson for the patch (sorry, it's taken so long to getting around to it.)
Comment #11
alexpottI think we need to edit the text format to enable video, audio, document etc in the media library. Otherwise it is really confusing as to where it has gone if you upload such things to your site. I'd expected all media types to be allowed in full_html and basic_html - atm it is just image and remote video.
Comment #12
raman.b commentedAdding audio, document and video media types to
allowed_media_typesfor basic_html and full_html text formatsComment #13
raman.b commentedComment #18
smustgrave commentedPatch still applies to 10.1 so running those tests.
Comment #19
smustgrave commentedNo failures so marking RTBC
Comment #20
quietone commentedI don't see anything in the changes to let me know this is being tested by automated tests. Let's get some manual testing to confirm that all the media types are working as expected and that the display matches what is in media. Adding tags.
Both are suitable as a Novice task.
Comment #21
akhil babuI've tested patch #12 in a Drupal 10 (10.1x-dev) local environment and it works fine!
But there are still some differences in the 'Grid view' of media library items when comparing with standard profile. Screenshots below. I checked the umami issue queue but didnt find a related issue. Maybe we can raise a new issue for that?
Comment #22
markconroy commentedThanks @Akhil Babu for this testing.
This looks like it's soooo close to being ready. let's get this final piece implemented to give us parity with Standard profile and then get this merged. Well done everyone, we're nearly there.
Comment #23
Zsuffa Dávid commentedThe difference between the grid view of umami and the default profile is caused by the missing "Media library" view mode of the media types.
Extended patch #12 to include these configs. Attached screenshots of media library grid before/after.
Comment #24
smustgrave commentedCI failure in #23
Added screenshots from #23 to IS.
Comment #25
_utsavsharma commentedTried to fix CCF for #23.
Comment #26
Zsuffa Dávid commentedCan someone tell me what can cause this test failure? Should I add
langcode: trueto the hidden section of the yml files, like incore.entity_view_display.media.video.default.yml?Comment #27
smustgrave commentedCan give it a shot. Would see how existing config handles the langcode and update the yml file where needed.
Will keep this one on my radar so I can review again.
Comment #28
Zsuffa Dávid commentedOk, I think I find the cause. In the existing config the langcode line was after
field_media_document: trueline.Tests passed in local dev env.
install config:
existing config:
New patch attached.
Comment #29
smustgrave commentedGreat job figuring that out!
Comment #31
lauriiiCommitted 4714abf and pushed to 10.1.x. Thanks!
Comment #33
quietone commentedTesting was done in #21, removing tag