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

git-svn-id: https://develop.svn.wordpress.org/trunk@23092 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Daryl Koopersmith 2012-12-06 05:06:49 +00:00
parent 21f933625f
commit a4f2112fd3
3 changed files with 16 additions and 3 deletions

View File

@ -32,7 +32,7 @@
}
// Create the media frame.
frame = wp.media({
frame = wp.media.frames.customBackground = wp.media({
// Set the title of the modal.
title: $el.data('choose'),

View File

@ -18,8 +18,14 @@
var $el = $(this);
event.preventDefault();
// If the media frame already exists, reopen it.
if ( frame ) {
frame.open();
return;
}
// Create the media frame.
frame = wp.media({
frame = wp.media.frames.customHeader = wp.media({
// Set the title of the modal.
title: $el.data('choose'),

View File

@ -34,7 +34,7 @@ window.wp = window.wp || {};
return frame;
};
_.extend( media, { model: {}, view: {}, controller: {} });
_.extend( media, { model: {}, view: {}, controller: {}, frames: {} });
// Link any localized strings.
l10n = media.model.l10n = typeof _wpMediaModelsL10n === 'undefined' ? {} : _wpMediaModelsL10n;
@ -216,6 +216,13 @@ window.wp = window.wp || {};
* ========================================================================
*/
/**
* wp.media.attachment
*/
media.attachment = function( id ) {
return Attachment.get( id );
};
/**
* wp.media.model.Attachment
*/