Skip to content

Commit

Permalink
Media: Fix broken media modal following [57688]
Browse files Browse the repository at this point in the history
Fix undefined TypeError overlooked in [57688].

Props antpb, swissspidy, joedolson.
Fixes #58973.

git-svn-id: https://develop.svn.wordpress.org/trunk@57691 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
joedolson committed Feb 21, 2024
1 parent 84ce628 commit bf2d401
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/js/media/controllers/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,16 @@ var State = Backbone.Model.extend(/** @lends wp.media.controller.State.prototype
_menu: function() {
var menu = this.frame.menu,
mode = this.get('menu'),
actionMenuItems = this.frame.menu.get('views'),
actionMenuLength = actionMenuItems ? actionMenuItems.views.get().length : 0,
actionMenuItems,
actionMenuLength,
view;

// Show action menu only if it is active and has more than one default element.
this.frame.$el.toggleClass( 'hide-menu', ! mode || actionMenuLength < 2 );
if ( this.frame.menu ) {
actionMenuItems = this.frame.menu.get('views'),
actionMenuLength = actionMenuItems ? actionMenuItems.views.get().length : 0,
// Show action menu only if it is active and has more than one default element.
this.frame.$el.toggleClass( 'hide-menu', ! mode || actionMenuLength < 2 );
}
if ( ! mode ) {
return;
}
Expand Down

0 comments on commit bf2d401

Please sign in to comment.