WordPress.org

Make WordPress Core


Ignore:
Timestamp:
03/15/2012 04:14:05 AM (8 years ago)
Author:
koopersmith
Message:

Theme Customizer: First pass for upload controls, using background image as an example. Add a wrapper for Plupload that allows for custom upload UIs. see #19910.

wp.Uploader is a wrapper that provides a simple way to upload an attachment (using the wp_ajax_upload_attachment handler). It is intentionally decoupled from the UI. When an upload succeeds, it will receive the attachment information (id, url, meta, etc) as a JSON response. If the upload fails, the wrapper handles both WordPress and plupload errors through a single handler.

As todos, we should add drag classes for the uploader dropzone and account for the rough 100mb filesize limit in most browsers. The UI for the customizer upload controls could be improved as well.

File:
1 edited

Legend:

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

    r20136 r20179  
    7070                wp_enqueue_script( 'farbtastic' );
    7171                wp_enqueue_style( 'farbtastic' );
     72                break;
     73            case 'upload':
     74                wp_enqueue_script( 'wp-plupload' );
    7275                break;
    7376        }
     
    395398                <?php
    396399                break;
     400            case 'upload':
     401                ?>
     402                <label><?php echo esc_html( $this->label ); ?><br/>
     403                    <input type="hidden" value="<?php echo esc_attr( $this->value() ); ?>" <?php $this->name(); ?> />
     404                    <a href="#" class="button-secondary upload"><?php _e( 'Upload' ); ?></a>
     405                    <a href="#" class="remove"><?php _e( 'Remove' ); ?></a>
     406                </label>
     407                <?php
     408                break;
    397409            default:
    398410                do_action( 'customize_render_control-' . $this->control, $this );
Note: See TracChangeset for help on using the changeset viewer.