The wonderful world of Backbone.js and WP (of which I know barely anything).
I think the problem is you are just calling the same default media.view
, instead I believe you need to initialize a new one.
For example:
/**
* Replace the media-toolbar with our own
*/
var myDrop = media.view.AttachmentsBrowser;
media.view.AttachmentsBrowser = media.view.AttachmentsBrowser.extend({
createToolbar: function() {
media.model.Query.defaultArgs.filterSource="filter-media-taxonomies";
myDrop.prototype.createToolbar.apply(this,arguments);
this.toolbar.set( key, new media.view.AttachmentFilters[key]({
controller: this.controller,
model: this.collection.props,
priority: -80
}).render() );
}
});
Would give you something like below (I did not do any thorough error checking but it does work).
You should also consider doing this with media.view.AttachmentFilters
and anything custom with regards to window.wp.media;
.