Uh oh!
There was an error while loading. Please reload this page.
Define $formfield when mediaHandler fires instead of closure - #382
Closed
augustuswm wants to merge 1 commit into
Closed
Define $formfield when mediaHandler fires instead of closure#382augustuswm wants to merge 1 commit into
augustuswm wants to merge 1 commit into
Conversation
cmb.mediaHandlers.* are redefined on the first click of each “file” or “file_list” on the page. Each time .list and .single are redefined the local variables for the current “file” and “file_list” are closed over. This breaks the handlers for any previously clicked “files” and “file_lists”. Variables have been moved into the handlers themselves rather than rewriting the handlers. In reference to :CMB2#250, CMB2#296
augustuswm
commented
Aug 6, 2015
Author
Following up to see if there is anything I can do to assist in getting either this fix added or implementing a fix for the issues in another way. |
jtsternberg
commented
Aug 6, 2015
Member
@augustuswm sounds like you have a good handle on a possible solution. Would you be willing to submit a PR? |
jtsternberg
commented
Aug 6, 2015
Member
Wow, that's embarrassing.. just realized this IS a PR. ha ha.. I think I have it sorted though. |
jtsternberg added a commit
that referenced
this pull request
Aug 6, 2015
jtsternberg
commented
Aug 6, 2015
Member
These commits should take care of the issue: 6db15bd...730ef08 (note: I gave you props since you reported and submitted a fix) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
cmb.mediaHandlers.* are redefined on the first click of each “file” or “file_list” on the page. Each time .list and .single are redefined the local variables for the current “file” and “file_list” are closed over. This breaks the handlers for any previously clicked “files” and “file_lists”. Variables have been moved into the handlers themselves rather than rewriting the handlers.
It might be more elegant to define new handlers for each "file" or "file_list" that still use the closure over $formfield in particular as opposed to the approach here.
In reference to issues: #250, #296