[wp-trac] [WordPress Trac] #42075: Do not show default image on using WP_Customize_Cropped_Image_Control.

WordPress Trac noreply at wordpress.org
Mon Dec 16 04:10:54 UTC 2019


#42075: Do not show default image on using WP_Customize_Cropped_Image_Control.
--------------------------+-----------------------------
 Reporter:  Toro_Unit     |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Future Release
Component:  Customize     |     Version:  4.2
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:
--------------------------+-----------------------------
Changes (by dlh):

 * keywords:  has-patch => needs-patch
 * focuses:  administration =>
 * version:  4.8.2 => 4.2
 * milestone:  Awaiting Review => Future Release


Comment:

 If I'm following correctly, the unexpected behavior here stems from
 `setAttachmentDataAndRenderContent()`, added in [37701] for #36521.

 The function dictates that unless a control extends `UploadControl`, the
 value of the control's setting must be an ID. Otherwise, the `attachment`
 data is deleted before the control template is rendered.

 Hence, when the `default` of a setting using the
 `WP_Customize_Cropped_Image_Control` is a URL, then clicking the "Default"
 button has no visual effect because the `CroppedImageControl` extends
 `MediaControl` and so the value expected to be an ID.

 @celloexpressions suggested in ticket:36521#comment:9 that [37701] might
 have been a little overbroad:

 > deleting the attachment param based on the value may not be the safest
 approach. Probably not worth changing anything in core for at this point,
 and unlikely to affect others if they haven't reported it yet

 Perhaps there's room for the function to be more accommodating.

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


More information about the wp-trac mailing list