mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-16 19:46:21 +00:00
Add two properties to media.model.Attachments.propmap
: include
and exclude
, which are aliases for post__in
and post__not_in
.
This allows you to instantiate a library that includes and/or excludes specific attachments by passing a single ID or an array of IDs. Example usage: {{{ wp.media({frame: 'post', library: {include: [414, 415]}}).open() wp.media({frame: 'post', library: {include: 414}}).open() wp.media({frame: 'post', library: {exclude: [414, 415]}}).open() wp.media({frame: 'post', library: {exclude: 414}}).open() }}} Fixes #26587. Built from https://develop.svn.wordpress.org/trunk@29759 git-svn-id: http://core.svn.wordpress.org/trunk@29531 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
2f328cc4c1
commit
e3eaed1c78
@ -1164,7 +1164,9 @@ window.wp = window.wp || {};
|
|||||||
'perPage': 'posts_per_page',
|
'perPage': 'posts_per_page',
|
||||||
'menuOrder': 'menu_order',
|
'menuOrder': 'menu_order',
|
||||||
'uploadedTo': 'post_parent',
|
'uploadedTo': 'post_parent',
|
||||||
'status': 'post_status'
|
'status': 'post_status',
|
||||||
|
'include': 'post__in',
|
||||||
|
'exclude': 'post__not_in'
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* @static
|
* @static
|
||||||
@ -1211,6 +1213,12 @@ window.wp = window.wp || {};
|
|||||||
props.orderby = defaults.orderby;
|
props.orderby = defaults.orderby;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_.each( [ 'include', 'exclude' ], function( prop ) {
|
||||||
|
if ( props[ prop ] && ! _.isArray( props[ prop ] ) ) {
|
||||||
|
props[ prop ] = [ props[ prop ] ];
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
// Generate the query `args` object.
|
// Generate the query `args` object.
|
||||||
// Correct any differing property names.
|
// Correct any differing property names.
|
||||||
_.each( props, function( value, prop ) {
|
_.each( props, function( value, prop ) {
|
||||||
|
2
wp-includes/js/media-models.min.js
vendored
2
wp-includes/js/media-models.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user