We have applied the patch of https://www.drupal.org/node/2534724. The patch in the issue works but changes the JQuery which highlighting an other bug:

If we use a media in a custom form, the field doesn't work. We see only the attach button and it doesn't work. After search, we find the problem comes of the function theme_media_element where the #id in injected two times in the markup. So, the JQuery doesn't find correctly the element on fields create with form api.

We did a patch to add a prefix on the id's wrapper, this fixes the problem.

Comments

Calystod created an issue. See original summary.

clairedesbois@gmail.com’s picture

StatusFileSize
new458 bytes
clairedesbois@gmail.com’s picture

clairedesbois@gmail.com’s picture

Status: Active » Needs review
cornifex’s picture

Status: Needs review » Reviewed & tested by the community

Tested the patch in #2 and works like a charm.

heatherwoz’s picture

eelkeblok’s picture

Status: Reviewed & tested by the community » Needs work
StatusFileSize
new458 bytes

Thanks for figuring this out, saved me a ton of debugging, I'm sure. The patch works, but I would suggest to use a dash instead of an underscore for the wrapper-suffix. Attached is an updated version of the patch. I suppose this will also needs some test coverage, right?

damienmckenna’s picture

Status: Needs work » Needs review
damienmckenna’s picture

Status: Needs review » Reviewed & tested by the community

The patch in #7 solved the problem for me, both using the Seven and Shiny admin themes. Thanks!

dmsmidt’s picture

Another +1

chris matthews’s picture

Status: Reviewed & tested by the community » Closed (outdated)

Recent versions of media have resolved most of peoples concerns and is compatible with entity translation, multilingual and various advanced configurations. Due to the high volume of inactive and most often irrelevant issues we are Closing this as (outdated). If for whatever reason this issue is important to you AND you still have issues after checking the media recipe documentation, then let us know and we will review your concerns.

Otherwise, see the recipe documentation for how to configure media and for troubleshooting tips OR refer to the media_dev distribution if you want to see a working media setup.

As mentioned, feel free to make some noise in this issue if you still feel it is important to you or someone else.

Thanks,

Media team

damienmckenna’s picture

Title: Media field doesn't work with form API. » Media field doesn't work with form API
Status: Closed (outdated) » Needs work

Reopening this as it affects the admin side of the module, not the front-end output.

Putting it back to "needs work" as we need to clearly document the steps to reproduce the problem.

FWIW I ran into this problem on a site which used a file field in a custom block's config form.