Make WordPress Core

Ticket #44641: 44641.diff

File 44641.diff, 1.5 KB (added by donmhico, 5 years ago)
  • src/js/media/views/button.js

    diff --git src/js/media/views/button.js src/js/media/views/button.js
    index 8f1af79d85..a2d1a15e59 100644
    var Button = wp.media.View.extend(/** @lends wp.media.view.Button.prototype */{ 
    2424                disabled: false
    2525        },
    2626
    27         initialize: function() {
     27        initialize: function( view, button_options ) {
    2828                /**
    2929                 * Create a model with the provided `defaults`.
    3030                 *
    var Button = wp.media.View.extend(/** @lends wp.media.view.Button.prototype */{ 
    3232                 */
    3333                this.model = new Backbone.Model( this.defaults );
    3434
     35                if ( ! _.isUndefined( button_options ) ) {
     36                        this.options = _.defaults( button_options, this.options );
     37                }
     38
    3539                // If any of the `options` have a key from `defaults`, apply its
    3640                // value to the `model` and remove it from the `options object.
    3741                _.each( this.defaults, function( def, key ) {
  • src/js/media/views/toolbar.js

    diff --git src/js/media/views/toolbar.js src/js/media/views/toolbar.js
    index 258d12697a..8477e3f508 100644
    Toolbar = View.extend(/** @lends wp.media.view.Toolbar.prototype */{ 
    8989                } else {
    9090                        if ( ! ( view instanceof Backbone.View ) ) {
    9191                                view.classes = [ 'media-button-' + id ].concat( view.classes || [] );
    92                                 view = new wp.media.view.Button( view ).render();
     92                                view = new wp.media.view.Button( view, this.controller.options.button ).render();
    9393                        }
    9494
    9595                        view.controller = view.controller || this.controller;