Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- wp.media.view.Toolbar.Custom = wp.media.view.Toolbar.extend({
- initialize: function() {
- _.defaults( this.options, {
- event: 'custom_event',
- close: false,
- items: {
- custom_event: {
- text: wp.media.view.l10n.customButton,
- style: 'primary',
- priority: 80,
- requires: false,
- click: this.addAttachment
- }
- }
- });
- wp.media.view.Toolbar.prototype.initialize.apply( this, arguments );
- },
- // triggered when the button is clicked
- addAttachment: function(){
- this.controller.state().addAttachment();
- this.controller.setState( 'insert' );
- // I NEED TO TRIGGER A REFRESH OF THE ATTACHMENTS TAB HERE
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement