Make WordPress Core

Changeset 23092


Ignore:
Timestamp:
12/06/2012 05:06:49 AM (14 years ago)
Author:
koopersmith
Message:

Add a canonical location for media frames, an alias to fetch attachments, and frame caching to custom header. fixes #22775.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/js/custom-background.js

    r23024 r23092  
    3333
    3434                        // Create the media frame.
    35                         frame = wp.media({
     35                        frame = wp.media.frames.customBackground = wp.media({
    3636                                // Set the title of the modal.
    3737                                title: $el.data('choose'),
  • trunk/wp-admin/js/custom-header.js

    r23024 r23092  
    1919                        event.preventDefault();
    2020
     21                        // If the media frame already exists, reopen it.
     22                        if ( frame ) {
     23                                frame.open();
     24                                return;
     25                        }
     26
    2127                        // Create the media frame.
    22                         frame = wp.media({
     28                        frame = wp.media.frames.customHeader = wp.media({
    2329                                // Set the title of the modal.
    2430                                title: $el.data('choose'),
  • trunk/wp-includes/js/media-models.js

    r23057 r23092  
    3535        };
    3636
    37         _.extend( media, { model: {}, view: {}, controller: {} });
     37        _.extend( media, { model: {}, view: {}, controller: {}, frames: {} });
    3838
    3939        // Link any localized strings.
     
    217217         */
    218218
     219         /**
     220          * wp.media.attachment
     221          */
     222         media.attachment = function( id ) {
     223                return Attachment.get( id );
     224         };
     225
    219226        /**
    220227         * wp.media.model.Attachment
Note: See TracChangeset for help on using the changeset viewer.