Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-add deprecated function editAttributeFieldAttachment.getFromCache #692

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion js/build/shortcode-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ var editAttributeFieldAttachment = sui.views.editAttributeField.extend( {

this.currentSelection.add( model );

// Re-render after attachments have synced.
// Re-render after attachments have synced, and add to cache.
model.fetch();
model.on( 'sync', this._renderAll );

Expand Down Expand Up @@ -909,6 +909,24 @@ var editAttributeFieldAttachment = sui.views.editAttributeField.extend( {

},

}, {

/**
* Get the Backbone model attributes of an attachment.
*
* Prior to 0.7.0, this method was exposed as a public class
* method and used internally to get attachment details from
* the `_idCache` store.
*
* @deprecated Not used internally since 0.7.0
*/
getFromCache: function( id ) {
if ( wp.media.attachment( id ) ) {
return wp.media.attachment( id ).attributes;
}
return false;
},

});

module.exports = sui.views.editAttributeFieldAttachment = editAttributeFieldAttachment;
Expand Down
20 changes: 19 additions & 1 deletion js/src/views/edit-attribute-field-attachment.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ var editAttributeFieldAttachment = sui.views.editAttributeField.extend( {

this.currentSelection.add( model );

// Re-render after attachments have synced.
// Re-render after attachments have synced, and add to cache.
model.fetch();
model.on( 'sync', this._renderAll );

Expand Down Expand Up @@ -207,6 +207,24 @@ var editAttributeFieldAttachment = sui.views.editAttributeField.extend( {

},

}, {

/**
* Get the Backbone model attributes of an attachment.
*
* Prior to 0.7.0, this method was exposed as a public class
* method and used internally to get attachment details from
* the `_idCache` store.
*
* @deprecated Not used internally since 0.7.0
*/
getFromCache: function( id ) {
if ( wp.media.attachment( id ) ) {
return wp.media.attachment( id ).attributes;
}
return false;
},

});

module.exports = sui.views.editAttributeFieldAttachment = editAttributeFieldAttachment;
Expand Down