diff --git src/js/media/models/attachments.js src/js/media/models/attachments.js
index 42b05d7546..8c9ec72922 100644
|
|
|
var Attachments = Backbone.Collection.extend(/** @lends wp.media.model.Attachmen |
| 212 | 212 | this.observers.push( attachments ); |
| 213 | 213 | |
| 214 | 214 | attachments.on( 'add change remove', this._validateHandler, this ); |
| | 215 | attachments.on( 'add', this._addToTotalAttachments, this ); |
| | 216 | attachments.on( 'remove', this._removeFromTotalAttachments, this ); |
| 215 | 217 | attachments.on( 'reset', this._validateAllHandler, this ); |
| 216 | 218 | this.validateAll( attachments ); |
| 217 | 219 | return this; |
| … |
… |
var Attachments = Backbone.Collection.extend(/** @lends wp.media.model.Attachmen |
| 236 | 238 | |
| 237 | 239 | return this; |
| 238 | 240 | }, |
| | 241 | /** |
| | 242 | * Update total attachment count when items are added to a collection. |
| | 243 | * |
| | 244 | * @access private |
| | 245 | * |
| | 246 | * @since 5.8.0 |
| | 247 | * |
| | 248 | * @param {wp.media.model.Attachments} attachment |
| | 249 | * @param {wp.media.model.Attachments} attachments |
| | 250 | * @param {Object} options |
| | 251 | * |
| | 252 | * @return {wp.media.model.Attachments} Returns itself to allow chaining. |
| | 253 | */ |
| | 254 | _removeFromTotalAttachments: function( attachment, attachments, options ) { |
| | 255 | if ( this.mirroring ) { |
| | 256 | this.mirroring.totalAttachments = this.mirroring.totalAttachments - 1; |
| | 257 | } |
| | 258 | }, |
| | 259 | /** |
| | 260 | * Update total attachment count when items are added to a collection. |
| | 261 | * |
| | 262 | * @access private |
| | 263 | * |
| | 264 | * @since 5.8.0 |
| | 265 | * |
| | 266 | * @param {wp.media.model.Attachments} attachment |
| | 267 | * @param {wp.media.model.Attachments} attachments |
| | 268 | * @param {Object} options |
| | 269 | * |
| | 270 | * @return {wp.media.model.Attachments} Returns itself to allow chaining. |
| | 271 | */ |
| | 272 | _addToTotalAttachments: function( attachment, attachments, options ) { |
| | 273 | if ( this.mirroring ) { |
| | 274 | this.mirroring.totalAttachments = this.mirroring.totalAttachments + 1; |
| | 275 | } |
| | 276 | }, |
| 239 | 277 | /** |
| 240 | 278 | * @access private |
| 241 | 279 | * |