Skip to content

Commit

Permalink
Add possibility to set a class in the media modal in MediaUploadButto…
Browse files Browse the repository at this point in the history
…n component.
  • Loading branch information
jorgefilipecosta committed Jan 2, 2018
1 parent 365b932 commit 99728d6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion blocks/media-upload-button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const slimImageObject = ( img ) => {
};

class MediaUploadButton extends Component {
constructor( { multiple = false, type, gallery = false, title = __( 'Select or Upload Media' ) } ) {
constructor( { multiple = false, type, gallery = false, title = __( 'Select or Upload Media' ), modalClass } ) {
super( ...arguments );
this.openModal = this.openModal.bind( this );
this.onSelect = this.onSelect.bind( this );
Expand Down Expand Up @@ -89,6 +89,10 @@ class MediaUploadButton extends Component {
this.frame = wp.media( frameConfig );
}

if ( modalClass ) {
this.frame.$el.addClass( modalClass );
}

// When an image is selected in the media frame...
this.frame.on( 'select', this.onSelect );
this.frame.on( 'update', this.onUpdate );
Expand Down

0 comments on commit 99728d6

Please sign in to comment.