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: http://core.svn.wordpress.org/trunk@21692 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Daryl Koopersmith 2012-08-31 20:44:02 +00:00
parent da9864c82a
commit b9bbe5bb99

View File

@ -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: {} });
/**
* ========================================================================