Closed (fixed)
Project:
D7 Media
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
10 Jan 2017 at 16:45 UTC
Updated:
11 Mar 2017 at 06:44 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
dsnopekHere's a patch. I keep wondering if there is a way to make it less convoluted... But it works!
Comment #4
dsnopekWeird. Let's try that again
Comment #6
dsnopekHrm. Well, the patch applies fine locally. I'm not sure what's going on with the testbot that it's different.
Comment #7
dsnopekHere's a patch that combines this patch with the one on #2534724: Browser window opens twice for field image because they conflict. We need this for Panopoly. However, I'm going to mark this patch as hidden, since the one on #2 is the one that should actually get review (until #2534724 is merged at least, then I can reroll this patch to be against that).
Comment #10
joseph.olstadHi @dsnopek, thanks for your feedback.
I noticed your reference to #2534724: Browser window opens twice for field image
so I kicked the test bot on patch #105 , it no longer passes testing.
However I haven't noticed the described issue, are you sure that patch is still needed on an unpatched rc3?
Comment #11
joseph.olstadfor #2534724: Browser window opens twice for field image
#original_id was comming up undefined , see the job log for the other issue.
as for your this issue patch #2 , fails on assert 'Media file field widget adds element-specific settings.'
not sure what to make of this.
Comment #12
joseph.olstad@dsnopek , does this patch help?
https://www.drupal.org/node/2841331#comment-11856204
#2841331: Media browser opens under FPP overlay, inoperative
Comment #13
joseph.olstadpatch doesn't pass tests, not sure yet if this is a problem with the tests or the patch.
Comment #14
dsnopek@joseph.olstad: Yes, I think that patch would fix the problem. However, I'm not sure it's the right solution!
That patch is changing the CSS selector in JavaScript to use a wildcard in order to catch the 'id' with any numbers appended to it (like '--1', '--2', etc), which could catch more elements than intended. Imagine a content type with a media field on it, and then an FPP with a media field of the same name loaded in a CTools modal -- the Javascript that's intending to reload the media field in the FPP would also reload the media field on the page below because the wildcard would catch both.
While my patch is weird and confusing and I wish it were simpler, it does target exactly the elements it's intending to target (ie. only those that are reloaded via AJAX)!
Comment #15
dsnopekMy patch doesn't work right for fields with multiple values. I tried for quite a while to fix it for that situation but couldn't get it working in both situations. :-(
However, the less precise fix from #2841331-3: Media browser opens under FPP overlay, inoperative does work, so I'm just gonna roll with that. Even if it's imprecise, the cases where it'd get things wrong are probably super uncommon, where as the current bug is very common.
Since #2841331: Media browser opens under FPP overlay, inoperative is closed, I'm going to re-attach the patch here, but it's written by ankurj NOT me, so that's who should get the commit credit if this is committed.
Comment #16
sonfd+1 for #15
Comment #17
saniyat commented#15 working fine with field collection.
Comment #18
steven jones commentedOn our project we're doing some interesting handling of the ajax page state, and specifically how IDs are guaranteed to be unique.
What that means for us is that the way that the ID is built up and used in media module isn't stable at all.
However, I'd argue that because media is essentially using
drupal_html_idto generate an ID (it's just the attribute on a form element) the ID isn't stable for media module with a plain Drupal core either.I'd suggest just changing to use a class based upon the element ID. This should ensure 'enough' uniqueness, but because it's a class Drupal won't try and rename randomly later on in the process.
Patch attached that does just that.
The JavaScript was just using the selector straight from the PHP side, so no changes were needed there.
Comment #20
steven jones commentedTry and fix that test.
Comment #22
joseph.olstadcommitted latest patch by dsnopek to 7.x-2.x dev branch,
Thanks