[wp-trac] [WordPress Trac] #29211: Customizer: extract a cropped-image control from header images

WordPress Trac noreply at wordpress.org
Fri Jun 19 05:55:00 UTC 2015

#29211: Customizer: extract a cropped-image control from header images
 Reporter:  celloexpressions  |       Owner:
     Type:  enhancement       |      Status:  new
 Priority:  normal            |   Milestone:  Future Release
Component:  Customize         |     Version:  3.9
 Severity:  normal            |  Resolution:
 Keywords:  needs-patch       |     Focuses:  javascript

Comment (by celloexpressions):

 I'd say the base control should ideally save either the attachment id of
 the cropped image (if it becomes a new, separate attachment, which is
 probably best) or the direct URL to the cropped image if only one size is
 present. Then specific controls can customize that handling in their
 subclasses of the cropping control.

 Headers and site icons would both use custom subclasses - the key is to
 make the cropped image control as modular as possible so that only the
 necessary functions need to be overwritten in child controls. For example,
 the function that handles the primary action once the process in the modal
 is complete would be the most common one (typically that's `select()`, but
 we'll need a different one here since that takes it to the cropping
 state). Then child controls can change what's done with the resulting
 attachment model - whether the setting saves the URL or id or something
 else, updating any UI in the Customizer controls panel, etc. Being able to
 get all of the cropping/modal stuff for free and then only needing to
 change how it's handled when it comes back from the modal will make this
 incredibly useful for developers, including in core.

 The header control will need to be largely rewritten to leverage this, of
 course, but it'll just reuse the media modal part from the cropped control
 and handle all of the other stuff (uploaded images, etc.) in the child

Ticket URL: <https://core.trac.wordpress.org/ticket/29211#comment:15>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list