[wp-trac] [WordPress Trac] #36521: Setting media control value through JavaScript API does not update control template

WordPress Trac noreply at wordpress.org
Sat Apr 23 06:31:37 UTC 2016


#36521: Setting media control value through JavaScript API does not update control
template
-------------------------------+-------------------------
 Reporter:  TimothyBlynJacobs  |       Owner:
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  4.6
Component:  Customize          |     Version:  4.2
 Severity:  normal             |  Resolution:
 Keywords:  has-patch          |     Focuses:  javascript
-------------------------------+-------------------------

Comment (by westonruter):

 @TimothyBlynJacobs I found a couple more scenarios that meant further
 iteration on your patch.

 First of all, the control needed to handle the scenario for when it is
 dynamically instantiated with JS without passing the `attachmentData` as a
 param up front.

 Secondly, I noticed that there were Ajax calls being made to get the
 attachment data with a URL being supplied as the attachment ID. Turns out
 the `BackgroundImage` control, as a subclass of `UploadControl`, uses the
 URL of the attachment as the value, and it also manually sets the
 attachment data before rendering. So in its case, we can just assume the
 attachment data is already set.

 Please give it a try.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/36521#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list