Media library: Unify headers between view modes.

Includes back compat for `views_upload` links. These look a little awkward, but do not appear to be commonly used. Also prevents the view mode links from being dropped on smaller screens so a user doesn't get "stuck" in the list view.

This is different from other list tables, but aligns well with other uploaded content management screens (themes, plugins).

props pento, helen.
fixes #28946.

Built from https://develop.svn.wordpress.org/trunk@29625


git-svn-id: http://core.svn.wordpress.org/trunk@29399 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Helen Hou-Sandí
2014-08-26 15:58:15 +00:00
parent 227089cb07
commit 9e8b9a78ca
13 changed files with 173 additions and 166 deletions

View File

@@ -1032,6 +1032,8 @@ function wp_edit_attachments_query( $q = false ) {
$states .= ',private';
$q['post_status'] = isset( $q['status'] ) && 'trash' == $q['status'] ? 'trash' : $states;
$q['post_status'] = isset( $q['attachment-filter'] ) && 'trash' == $q['attachment-filter'] ? 'trash' : $states;
$media_per_page = (int) get_user_option( 'upload_per_page' );
if ( empty( $media_per_page ) || $media_per_page < 1 )
$media_per_page = 20;
@@ -1051,8 +1053,16 @@ function wp_edit_attachments_query( $q = false ) {
if ( isset($q['post_mime_type']) && !array_intersect( (array) $q['post_mime_type'], array_keys($post_mime_types) ) )
unset($q['post_mime_type']);
if ( isset($q['detached']) )
foreach( array_keys( $post_mime_types ) as $type ) {
if ( isset( $q['attachment-filter'] ) && "post_mime_type:$type" == $q['attachment-filter'] ) {
$q['post_mime_type'] = $type;
break;
}
}
if ( isset( $q['detached'] ) || ( isset( $q['attachment-filter'] ) && 'detached' == $q['attachment-filter'] ) ) {
$q['post_parent'] = 0;
}
wp( $q );