Make WordPress Core


Ignore:
Timestamp:
04/20/2012 02:39:55 AM (13 years ago)
Author:
koopersmith
Message:

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.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/class-wp-customize.php

    r20506 r20545  
    538538        ) );
    539539
    540         $this->add_control( new WP_Customize_Image_Control( $this, 'header_image', array(
    541             'label'          => 'Header Image',
    542             'section'        => 'header',
    543             'context'        => 'custom-header',
    544             'removed'        => 'remove-header',
    545             'get_url'        => 'get_header_image',
    546             'tabs'           => array(
    547                 array( 'uploaded', __('Uploaded'), 'wp_customize_print_uploaded_headers' ),
    548                 array( 'included', __('Included'), 'wp_customize_print_included_headers' ),
    549             ),
    550         ) ) );
     540        $this->add_control( new WP_Customize_Header_Image_Control( $this ) );
    551541
    552542        /* Custom Background */
     
    760750    return $color;
    761751}
    762 
    763 function wp_customize_print_uploaded_headers() {
    764     $headers = get_uploaded_header_images();
    765 
    766     foreach ( $headers as $header ) : ?>
    767         <a href="<?php echo esc_url( $header['url'] ); ?>">
    768             <img src="<?php echo esc_url( $header['thumbnail_url'] ); ?>" />
    769         </a>
    770     <?php endforeach;
    771 }
    772 
    773 function wp_customize_print_included_headers() {
    774     global $custom_image_header;
    775     $custom_image_header->process_default_headers();
    776 
    777     foreach ( $custom_image_header->default_headers as $header ) : ?>
    778         <a href="<?php echo esc_url( $header['url'] ); ?>">
    779             <img src="<?php echo esc_url( $header['thumbnail_url'] ); ?>" />
    780         </a>
    781     <?php endforeach;
    782 }
Note: See TracChangeset for help on using the changeset viewer.