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.

Screenshot - adding an image using the media library in Umami profile. Lots of unnecessary fields.

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

Screenshot - adding an image using the media library in Standard profile. Just 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
before

After
after

API changes

None.

Data model changes

None.

Comments

andrewmacpherson created an issue. See original summary.

andrewmacpherson’s picture

Screenshots of the problem.

I've got some working config. Patch coming soon.

andrewmacpherson’s picture

Status: Active » Needs review
StatusFileSize
new1.04 KB

This enables the media library form display for the image media

andrewmacpherson’s picture

Issue summary: View changes
StatusFileSize
new2.42 KB

This 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,

andrewmacpherson’s picture

StatusFileSize
new4.37 KB
new2.42 KB

Forgot the patch :-(

andrewmacpherson’s picture

andrewmacpherson’s picture

I 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.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

markconroy’s picture

Status: Needs review » Reviewed & tested by the community

This works a treat. Thanks very much @andrewmacpherson for the patch (sorry, it's taken so long to getting around to it.)

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

I 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.

raman.b’s picture

StatusFileSize
new5.52 KB
new856 bytes

Adding audio, document and video media types to allowed_media_types for basic_html and full_html text formats

raman.b’s picture

Status: Needs work » Needs review

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Patch still applies to 10.1 so running those tests.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

No failures so marking RTBC

quietone’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs manual testing, +Needs screenshots, +Novice

I 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.

akhil babu’s picture

I've tested patch #12 in a Drupal 10 (10.1x-dev) local environment and it works fine!

  • Both basic_html and full_html fields have option to upload all types of media items (Audio, Document, Image, Remote video, Video)
  • The media upload form for all media iteams are now same as the standard profile

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?

markconroy’s picture

Thanks @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.

Zsuffa Dávid’s picture

Status: Needs work » Needs review
StatusFileSize
new11.89 KB
new4.58 KB
new326.79 KB
new154.56 KB

The 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.

smustgrave’s picture

Issue summary: View changes
Status: Needs review » Needs work
Issue tags: -Needs screenshots

CI failure in #23

Added screenshots from #23 to IS.

_utsavsharma’s picture

StatusFileSize
new3.33 KB
new14.88 KB

Tried to fix CCF for #23.

Zsuffa Dávid’s picture

Status: Needs work » Needs review

Can someone tell me what can cause this test failure? Should I add langcode: true to the hidden section of the yml files, like in core.entity_view_display.media.video.default.yml?

1) Drupal\Tests\demo_umami\Functional\DemoUmamiProfileTest::testConfig
Exception: core.entity_view_display.media.audio.media_library: Drupal\Component\Diff\Engine\DiffOpAdd::__set_state(array(
   'type' => 'add',
   'orig' => false,
   'closing' =>
  array (
    0 => '  langcode: true',
  ),
))
smustgrave’s picture

Status: Needs review » Needs work

Can 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.

Zsuffa Dávid’s picture

Status: Needs work » Needs review
StatusFileSize
new10.73 KB
new6.68 KB

Ok, I think I find the cause. In the existing config the langcode line was after field_media_document: true line.
Tests passed in local dev env.

install config:

hidden:
  created: true
  langcode: true
  field_media_document: true

existing config:

hidden:
  created: true
  field_media_document: true
  langcode: true

New patch attached.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Great job figuring that out!

  • lauriii committed 4714abf9 on 10.1.x
    Issue #3097503 by andrewmacpherson, Zsuffa Dávid, raman.b, Akhil Babu,...
lauriii’s picture

Status: Reviewed & tested by the community » Fixed

Committed 4714abf and pushed to 10.1.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

quietone’s picture

Issue tags: -Needs manual testing

Testing was done in #21, removing tag