Class: Attachment

wp.media.model. Attachment


new Attachment()

wp.media.model.Attachment
Source:

Extends

  • Backbone.Model

Members


<static> get

Create a new model on the static 'all' attachments collection and return it. If this function has already been called for the id, it returns the specified attachment.
Source:

Methods


<static> create(attrs)

Create a new model on the static 'all' attachments collection and return it.
Parameters:
Name Type Description
attrs Object
Source:
Returns:
Type
wp.media.model.Attachment

parse(resp)

Convert date strings into Date objects.
Parameters:
Name Type Description
resp Object The raw response object, typically returned by fetch()
Source:
Returns:
The modified response object, which is the attributes hash to be set on the model.
Type
Object

saveCompat(data, options)

This:
  • Backbone.Model
Parameters:
Name Type Description
data Object The properties to be saved.
options Object Sync options. e.g. patch, wait, success, error.
Source:
Returns:
Type
Promise

sync(method, model [, options])

Triggered when attachment details change Overrides Backbone.Model.sync
Parameters:
Name Type Argument Default Description
method string
model wp.media.model.Attachment
options Object <optional>
{}
Source:
Returns:
Type
Promise