Switch to the library tab in the media uploader
-
I’m developing a plugin that adds a tab to the media uploader to add external videos to the media library via oembed. Everything works as expected but I need to switch to the library tab after adding a new external video via the new tab. This is part of the code I’m using:
wp.media.controller.Custom = wp.media.controller.State.extend({ initialize: function(){ this.props = new Backbone.Model({ custom_data: '' }); this.props.on( 'change:custom_data', this.refresh, this ); }, refresh: function() { this.frame.toolbar.get().refresh(); }, customAction: function(){ wp.media.post( 'add-oembed', { url: this.props.get('custom_data'), post_id: wp.media.view.settings.post.id }); this.frame.content.mode('browse'); } });
The line this.frame.content.mode(‘browse’) is supposed to make the switch to the library tab, but I’m getting an error message that says: TypeError: this.collection is undefined.
Any ideas?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Switch to the library tab in the media uploader’ is closed to new replies.