Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. wp.media.view.Toolbar.Custom = wp.media.view.Toolbar.extend({
  2. initialize: function() {
  3. _.defaults( this.options, {
  4. event: 'custom_event',
  5. close: false,
  6. items: {
  7. custom_event: {
  8. text: wp.media.view.l10n.customButton,
  9. style: 'primary',
  10. priority: 80,
  11. requires: false,
  12. click: this.addAttachment
  13. }
  14. }
  15. });
  16.  
  17. wp.media.view.Toolbar.prototype.initialize.apply( this, arguments );
  18. },
  19.  
  20. // triggered when the button is clicked
  21. addAttachment: function(){
  22. this.controller.state().addAttachment();
  23. this.controller.setState( 'insert' );
  24. // I NEED TO TRIGGER A REFRESH OF THE ATTACHMENTS TAB HERE
  25. }
  26. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement