mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-22 08:11:52 +01:00
Media JS: When adding a view to a media workflow, add a shorthand for registering a view constructor with no options. see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@21821 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
b514f391cd
commit
3ebb9b4538
@ -31,13 +31,13 @@
|
||||
this.modal = new media.view.Modal({ controller: this });
|
||||
|
||||
// Add default views.
|
||||
this.add( 'library', {
|
||||
view: media.view.Workspace
|
||||
});
|
||||
this.add( 'library', media.view.Workspace );
|
||||
},
|
||||
|
||||
|
||||
// Accepts an `id` and `options` for a view. Options is an object that
|
||||
// Accepts an `id` and `options` for a view.
|
||||
//
|
||||
// `options` is either a `Backbone.View` constructor or an object that
|
||||
// contains two keys: the `view` key is a `Backbone.View` constructor,
|
||||
// and the `options` key are the options to be passed when the view is
|
||||
// initialized.
|
||||
@ -45,6 +45,8 @@
|
||||
// Triggers the `add` and `add:VIEW_ID` events.
|
||||
add: function( id, options ) {
|
||||
this.remove( id );
|
||||
if ( _.isFunction( options ) )
|
||||
options = { view: options };
|
||||
this._pending[ id ] = options;
|
||||
this.trigger( 'add add:' + id, options );
|
||||
return this;
|
||||
|
Loading…
Reference in New Issue
Block a user