Add an option to the photos upload form to add multiple existing media images to an album.

It looks like this module is planning to include functionality to select multiple media entities with the Form API, but it might not be done yet.
https://www.drupal.org/project/media_library_form_element

Currently it is possible to add existing media - one at a time - from:
/photos/image/add

Comments

Nathaniel created an issue. See original summary.

jhmnieuwenhuis’s picture

It looks like there is a patch available now :

https://www.drupal.org/project/media_library_form_element/issues/3128183

Regards,
Hans

nathaniel’s picture

Status: Postponed » Active

  • Nathaniel committed cec0c2d on 8.x-5.x
    Issue #3123526 by Nathaniel: Allow adding multiple existing media images...
nathaniel’s picture

Nice, looks like that will work.

jhmnieuwenhuis’s picture

Tested it., works excellent !!

Thanks.

Hans

jhmnieuwenhuis’s picture

StatusFileSize
new171.59 KB
new169.42 KB

One minor issue.
Not sure if it is this module or drupal ..

When adding multiple media, i can choose grid or table view.
Table view works fine.
Grid view is not really a grid, but only one column. Also only the last media on each page has a checkbox.
It works you can select the required media, but it does not look good.

See attached table.png and grid.png.

Regards,
Hans

nathaniel’s picture

StatusFileSize
new337.54 KB

Hmm, grid and table view both look okay on my end with "Bartik". I wonder if it could be a theme or CSS issue? You can try opening an issue for the other module if needed, or maybe try switching themes to see if that is the issue.

The "Remove" buttons didn't seem to work for me, not sure what that is about yet.

jhmnieuwenhuis’s picture

nightlife2008’s picture

Hey everyone, just to chime in on this issue...

I'm the developer and maintainer of the Media Library Form Element module, which I developed to support two in-house modules, one for Paragraphs, the other for Layout Builder.

It is used to set background images etc on elements.

The scope of this module is to enable developers to use a plain Form API element to select a Media entity reference as is it supported by normal Entity reference / Autocomplete elements, rather than to rely on "file_managed" when everything is already in the Media Library...

The functionality of this module is thus limited to the selection of one or multiple references from the Media Library. The problem here mainly lies in the _display_ of the element when used in other themes or contexts than an Admin theme or admin-oriented page (a module settings form for ex.).

The same issue exists with the normal Media Library module when used in combination with Layout Builder. This is normal as the content editing experience of Drupal is not meant for a frontend theme, unless the theme explicitly supports the required form element styles etc.

The fact that the Media Library is largely "unthemed" in common frontend themes is/was normal, until we decided to build content in the frontend with Layout Builder etc. A supporting module "Media library theme reset" popped up to address this situation in some kind of sensible way.

I suggest you install the module as well and report back with your results. The Media Library in the modal in Bartik for example, should have a similar styling than in Seven or Claro (depending on your backend theme setting).

I hope you can resolve your situation swiftly but I'm sorry I won't be able to help from my side by changing anything in the Media Library Form Element module.

greets,
Kim

jhmnieuwenhuis’s picture

HI,

installing module "Media library theme reset" solved the issue.

Great, Thanks

nightlife2008’s picture

Status: Active » Reviewed & tested by the community

Great news!

nathaniel’s picture

Status: Reviewed & tested by the community » Fixed

Great, thanks Kim for the feedback and solution!
https://www.drupal.org/project/media_library_theme_reset

Side note: Looks like an alternative option might be to alter the code and make /node/{node}/photos use the admin theme.

nightlife2008’s picture

FYI: There was a new bugfix for the multiple values issue: https://www.drupal.org/project/media_library_form_element/releases/8.x-1...

Status: Fixed » Closed (fixed)

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