From 29ffaab1b2b19d29df9d9e3a6aa445add75bc0a7 Mon Sep 17 00:00:00 2001 From: Peter Westwood Date: Wed, 11 May 2011 16:57:00 +0000 Subject: [PATCH] Add a filter in postbox_classes on the classes being returned so you can add ones to your metabox easily if you want. See #17323 git-svn-id: https://develop.svn.wordpress.org/trunk@17857 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/includes/post.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php index 28c8da60c9..8ac0756546 100644 --- a/wp-admin/includes/post.php +++ b/wp-admin/includes/post.php @@ -1021,7 +1021,7 @@ function _edit_attachments_query_helper($where) { } /** - * {@internal Missing Short Description}} + * Returns the list of classes to be used by a metabox * * @uses get_user_option() * @since 2.5.0 @@ -1031,17 +1031,19 @@ function _edit_attachments_query_helper($where) { * @return unknown */ function postbox_classes( $id, $page ) { - if ( isset( $_GET['edit'] ) && $_GET['edit'] == $id ) - return ''; - - if ( $closed = get_user_option('closedpostboxes_'.$page ) ) { + if ( isset( $_GET['edit'] ) && $_GET['edit'] == $id ) { + $classes = array( '' ); + } elseif ( $closed = get_user_option('closedpostboxes_'.$page ) ) { if ( !is_array( $closed ) ) { - return ''; + $classes = array( '' ); } - return in_array( $id, $closed )? 'closed' : ''; + $classes = in_array( $id, $closed ) ? array( 'closed' ) : array( '' ); } else { - return ''; + $classes = array( '' ); } + + $classes = apply_filters( "postbox_classes_{$page}_{$id}", $classes ); + return implode( ' ', $classes ); } /**