Add wp.media(), a function to create a default media workflow.
This will be the main entry point for basic media development, and should hopefully help less experienced developers wrangle the new media APIs. If you would like to see the new UI, navigate to the post editor and run the following in your browser's Javascript console: wp.media(); Well, that certainly feels a lot nicer to type. see #21390. git-svn-id: https://develop.svn.wordpress.org/trunk@21692 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
436bf0016f
commit
44b205c027
@ -2,8 +2,24 @@ if ( typeof wp === 'undefined' )
|
||||
var wp = {};
|
||||
|
||||
(function($){
|
||||
var media = wp.media = { model: {}, view: {}, controller: {} },
|
||||
Attachment, Attachments, Query;
|
||||
var Attachment, Attachments, Query;
|
||||
|
||||
/**
|
||||
* wp.media( attributes )
|
||||
*
|
||||
* Handles the default media experience. Automatically creates
|
||||
* and opens a media workflow, and returns the result.
|
||||
* Does nothing if the controllers do not exist.
|
||||
*
|
||||
* @param {object} attributes The properties passed to the main media controller.
|
||||
* @return {object} A media workflow.
|
||||
*/
|
||||
media = wp.media = function( attributes ) {
|
||||
if ( media.controller.Workflow )
|
||||
return new media.controller.Workflow( attributes ).render();
|
||||
};
|
||||
|
||||
_.extend( media, { model: {}, view: {}, controller: {} });
|
||||
|
||||
/**
|
||||
* ========================================================================
|
||||
|
Loading…
Reference in New Issue
Block a user