Background
I have a multiple-value entity reference field with target type = media. It is used for "document" media, so mostly pdf files.
I am using the "Media library" widget shipped with core. With this widget, items appear in a grid with thumbnail, and can be reordered with drag + drop.
Problems
Most of the pdf files don't have a useful thumbnail, so they all look the same.
Due to the grid display, the title of each document is not fully visible.
The grid drag + drop reorder is less intuitive than a tabledrag, especially if the thumbnails all look the same, and sometimes even the visible part of the title is the same.
Once a media entity is added to the list, there is no link to edit this media entity from the node / host entity form.
Questions
Is there a table version of the media library widget?
Is there a way to show an edit link with each item? Either to edit the media in a form on a new page, or in a popup.
What I tried
Widget settings?
-> The widget does not have any settings.
Configure the display of documents in "Core | Media library" view mode?
-> Items still displayed in a grid.
-> The only field that looks well in a grid mode is the thumbnail. Text fields look weird.
References
Poor soul who asked the same in drupal.org, with no success: https://www.drupal.org/forum/support/module-development-and-code-questions/2020-06-29/how-set-media-library-widget-to
MediaLibraryWidget
. It was enough to overrideformElement()
andpreRenderWidget()
to do some custom modifications. I replaced the 'selection' with a'#theme' => 'table'
with tabledrag, similar totemplate_preprocess_field_multiple_value_form()
. I might publish this, and then post an answer.