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: http://svn.automattic.com/wordpress/trunk@17857 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
westi 2011-05-11 16:57:00 +00:00
parent e96949c9bd
commit 374cba6192

View File

@ -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() * @uses get_user_option()
* @since 2.5.0 * @since 2.5.0
@ -1031,17 +1031,19 @@ function _edit_attachments_query_helper($where) {
* @return unknown * @return unknown
*/ */
function postbox_classes( $id, $page ) { function postbox_classes( $id, $page ) {
if ( isset( $_GET['edit'] ) && $_GET['edit'] == $id ) if ( isset( $_GET['edit'] ) && $_GET['edit'] == $id ) {
return ''; $classes = array( '' );
} elseif ( $closed = get_user_option('closedpostboxes_'.$page ) ) {
if ( $closed = get_user_option('closedpostboxes_'.$page ) ) {
if ( !is_array( $closed ) ) { if ( !is_array( $closed ) ) {
return ''; $classes = array( '' );
} }
return in_array( $id, $closed )? 'closed' : ''; $classes = in_array( $id, $closed ) ? array( 'closed' ) : array( '' );
} else { } else {
return ''; $classes = array( '' );
} }
$classes = apply_filters( "postbox_classes_{$page}_{$id}", $classes );
return implode( ' ', $classes );
} }
/** /**