-
<static> get( [props] [, options])
-
Creates and returns an Attachments Query collection given the properties.
Caches query objects and reuses where possible.
Parameters:
Name |
Type |
Argument |
Description |
props |
object
|
<optional>
|
Properties
Name |
Type |
Argument |
Default |
Description |
cache |
Object
|
<optional>
|
true
|
Whether to use the query cache or not. |
order |
Object
|
<optional>
|
|
|
orderby |
Object
|
<optional>
|
|
|
include |
Object
|
<optional>
|
|
|
exclude |
Object
|
<optional>
|
|
|
s |
Object
|
<optional>
|
|
|
post_mime_type |
Object
|
<optional>
|
|
|
posts_per_page |
Object
|
<optional>
|
|
|
menu_order |
Object
|
<optional>
|
|
|
post_parent |
Object
|
<optional>
|
|
|
post_status |
Object
|
<optional>
|
|
|
author |
Object
|
<optional>
|
|
|
|
options |
Object
|
<optional>
|
|
- Source:
-
Returns:
A new Attachments Query collection.
-
Type
-
wp.media.model.Query
-
<private> _changeFilteredProps(model)
-
Parameters:
Name |
Type |
Description |
model |
Backbone.Model
|
|
- Inherited From:
-
- Source:
-
-
<private> _changeOrder()
-
Sort the collection when the order attribute changes.
- Inherited From:
-
- Source:
-
-
<private> _changeOrderby(model, orderby)
-
Set the default comparator only when the `orderby` property is set.
Parameters:
Name |
Type |
Description |
model |
Backbone.Model
|
|
orderby |
string
|
|
- Inherited From:
-
- Source:
-
-
<private> _changeQuery(model, query)
-
If the `query` property is set to true, query the server using
the `props` values, and sync the results to this collection.
Parameters:
Name |
Type |
Description |
model |
Backbone.Model
|
|
query |
Boolean
|
|
- Inherited From:
-
- Source:
-
-
<private> _requery()
-
If the collection is a query, create and mirror an Attachments Query collection.
- Inherited From:
-
- Source:
-
-
<private> _validateAllHandler(attachments, options)
-
Parameters:
- Inherited From:
-
- Source:
-
Returns:
Returns itself to allow chaining.
-
Type
-
wp.media.model.Attachments
-
<private> _validateHandler(attachment, attachments, options)
-
Parameters:
- Inherited From:
-
- Source:
-
Returns:
Returns itself to allow chaining.
-
Type
-
wp.media.model.Attachments
-
hasMore()
-
Whether there are more attachments that haven't been sync'd from the server
that match the collection's query.
- Overrides:
- Source:
-
Returns:
-
Type
-
boolean
-
initialize( [models] [, options])
-
Parameters:
Name |
Type |
Argument |
Default |
Description |
models |
array
|
<optional>
|
[]
|
Array of initial models to populate the collection. |
options |
object
|
<optional>
|
{}
|
|
- Overrides:
- Source:
-
-
mirror(The)
-
Start mirroring another attachments collection, clearing out any models already
in the collection.
Parameters:
- Inherited From:
-
- Source:
-
Returns:
Returns itself to allow chaining.
-
Type
-
wp.media.model.Attachments
-
more( [options])
-
Fetch more attachments from the server for the collection.
Parameters:
Name |
Type |
Argument |
Default |
Description |
options |
object
|
<optional>
|
{}
|
|
- Overrides:
- Source:
-
Returns:
-
Type
-
Promise
-
observe(The)
-
Start observing another attachments collection change events
and replicate them on this collection.
Parameters:
- Inherited From:
-
- Source:
-
Returns:
Returns itself to allow chaining.
-
Type
-
wp.media.model.Attachments
-
parse(resp, xhr)
-
A custom AJAX-response parser.
See trac ticket #24753
Parameters:
Name |
Type |
Description |
resp |
Object
|
Array
|
The raw response Object/Array. |
xhr |
Object
|
|
- Inherited From:
-
- Source:
-
Returns:
The array of model attributes to be added to the collection
-
Type
-
Array
-
-
If this collection is sorted by `menuOrder`, recalculates and saves
the menu order to the database.
- Inherited From:
-
- Source:
-
Returns:
-
Type
-
undefined
|
Promise
-
sync(method, model [, options])
-
Overrides Backbone.Collection.sync
Overrides wp.media.model.Attachments.sync
Parameters:
Name |
Type |
Argument |
Default |
Description |
method |
String
|
|
|
|
model |
Backbone.Model
|
|
|
|
options |
Object
|
<optional>
|
{}
|
|
- Source:
-
Returns:
-
Type
-
Promise
-
unmirror()
-
Stop mirroring another attachments collection.
- Inherited From:
-
- Source:
-
-
unobserve(The)
-
Stop replicating collection change events from another attachments collection.
Parameters:
- Inherited From:
-
- Source:
-
Returns:
Returns itself to allow chaining.
-
Type
-
wp.media.model.Attachments
-
validate(attachment, options)
-
Add or remove an attachment to the collection depending on its validity.
Parameters:
- Inherited From:
-
- Source:
-
Returns:
Returns itself to allow chaining.
-
Type
-
wp.media.model.Attachments
-
validateAll(attachments [, options])
-
Add or remove all attachments from another collection depending on each one's validity.
Parameters:
- Inherited From:
-
- Source:
-
Fires:
- wp.media.model.Attachments#event:reset
Returns:
Returns itself to allow chaining.
-
Type
-
wp.media.model.Attachments
-
validator(attachment)
-
Checks whether an attachment is valid.
Parameters:
- Inherited From:
-
- Source:
-
Returns:
-
Type
-
Boolean