Theme Customizer: Improve image picker control. see #19910.

Overhauled image pickers:
* Add support for drag and drop uploads to image controls.
* Improve the 'uploaded' tab in image controls: automatically add images uploaded during the current session, hide the tab when no uploaded images exist.
* Move the header image control to the WP_Customize_Header_Image_Control class. Remove wp_customize_print_uploaded_headers() and wp_customize_print_uploaded_headers() functions.
* Abstract the dropdown functionality from the color picker to the .dropdown class.
* In wp.Uploader, unset element keys if passed an empty jQuery collection.



git-svn-id: https://develop.svn.wordpress.org/trunk@20545 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Daryl Koopersmith
2012-04-20 02:39:55 +00:00
parent a791550056
commit e2bbb75ba5
5 changed files with 268 additions and 171 deletions
+1 -32
View File
@@ -537,17 +537,7 @@ final class WP_Customize {
'theme_supports' => 'custom-header',
) );
$this->add_control( new WP_Customize_Image_Control( $this, 'header_image', array(
'label' => 'Header Image',
'section' => 'header',
'context' => 'custom-header',
'removed' => 'remove-header',
'get_url' => 'get_header_image',
'tabs' => array(
array( 'uploaded', __('Uploaded'), 'wp_customize_print_uploaded_headers' ),
array( 'included', __('Included'), 'wp_customize_print_included_headers' ),
),
) ) );
$this->add_control( new WP_Customize_Header_Image_Control( $this ) );
/* Custom Background */
@@ -758,25 +748,4 @@ function sanitize_hexcolor( $color ) {
return $color;
return $color;
}
function wp_customize_print_uploaded_headers() {
$headers = get_uploaded_header_images();
foreach ( $headers as $header ) : ?>
<a href="<?php echo esc_url( $header['url'] ); ?>">
<img src="<?php echo esc_url( $header['thumbnail_url'] ); ?>" />
</a>
<?php endforeach;
}
function wp_customize_print_included_headers() {
global $custom_image_header;
$custom_image_header->process_default_headers();
foreach ( $custom_image_header->default_headers as $header ) : ?>
<a href="<?php echo esc_url( $header['url'] ); ?>">
<img src="<?php echo esc_url( $header['thumbnail_url'] ); ?>" />
</a>
<?php endforeach;
}