Ajax callback runs for each form in case "media_library_edit=ajax" in URL

Created on 25 August 2022, about 2 years ago
Updated 3 May 2023, over 1 year ago

Problem/Motivation

In hook "media_library_edit_form_alter" we have condition if "media_library_edit=ajax" present in URL the code will add callback "_media_library_edit_media_edit_save" for ajax for each form.
And in case of multiple media fields tree (like a media field has another media field) the "media_library_edit=ajax" parameter will go with next ajax request.
So, accordingly to the "media_library_edit_form_alter" hook behavior the next media library form will have wrong ajax callback

Steps to reproduce

Create a media field with another media field and allow to edit the first level media.
Try add/remove the media file in the second level media field through the first level media.

Proposed resolution

Add a new condition to "media_library_edit_form_alter" hook

Remaining tasks

-

User interface changes

-

API changes

-

Data model changes

πŸ› Bug report
Status

Needs work

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine slivorezka

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡«πŸ‡·France Fabsgugu

    Hello,
    The patch is not working properly.
    When I want to select a media at the second level, it closes the popin of the first level media, without saving the change.

Production build 0.71.5 2024