- 🇺🇸United States maxstarkenburg Washington, DC
Following. I also found myself confused by this (and am making a video walk-through for a client, so honestly wasn't sure which button recommend (after testing, I'm going to recommend "Save and select", since "Save and insert" is ambiguous about whether it actually did anything (though it does indeed upload them too, just doesn't redirect anywhere))).
- 🇺🇸United States nessthehero
I also encountered this issue but decided to mitigate it by removing the "Save and insert" button action and renaming the "Save and select" action to "Save Media".
I used a custom module with a form alter hook.
function HOOK_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) { if ($form_id === 'media_library_add_form_upload') { if (isset($_GET['media_library_opener_id']) && $_GET['media_library_opener_id'] === 'media_library.opener.bulk_upload') { if (isset($form['actions'])) { $form['actions']['save_select']['#value'] = new TranslatableMarkup('Save Media'); unset($form['actions']['save_insert']); } } } }
This only affects the bulk upload form from the media overview screen, and not any individual upload field found on a node edit form. Hopefully this helps someone.
- 🇺🇸United States tobby
Here is an updated version of that hook that follows some Drupal best practices (not using $_GET, etc):
function HOOK_form_FORM_ID_alter(array &$form, FormStateInterface $form_state): void { // Use the request stack service to access the query parameters. $current_request = \Drupal::request(); $media_library_opener_id = $current_request->query->get('media_library_opener_id'); if ($media_library_opener_id === 'media_library.opener.bulk_upload') { if (isset($form['actions']['save_insert'])) { // Remove the 'save_insert' action button from the form. unset($form['actions']['save_insert']); } } }
In this case, FORM_ID is `media_library_add_form_upload` but my need was `media_library_add_form_dropzonejs` (but this is the post that gave me the solution I needed), so your FORM_ID may vary.