Make WordPress Core

Changeset 17857


Ignore:
Timestamp:
05/11/2011 04:57:00 PM (14 years ago)
Author:
westi
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/post.php

    r17856 r17857  
    10221022
    10231023/**
    1024  * {@internal Missing Short Description}}
     1024 * Returns the list of classes to be used by a metabox
    10251025 *
    10261026 * @uses get_user_option()
     
    10321032 */
    10331033function postbox_classes( $id, $page ) {
    1034     if ( isset( $_GET['edit'] ) && $_GET['edit'] == $id )
    1035         return '';
    1036 
    1037     if ( $closed = get_user_option('closedpostboxes_'.$page ) ) {
     1034    if ( isset( $_GET['edit'] ) && $_GET['edit'] == $id ) {
     1035        $classes = array( '' );
     1036    } elseif ( $closed = get_user_option('closedpostboxes_'.$page ) ) {
    10381037        if ( !is_array( $closed ) ) {
    1039             return '';
    1040         }
    1041         return in_array( $id, $closed )? 'closed' : '';
     1038            $classes = array( '' );
     1039        }
     1040        $classes =  in_array( $id, $closed ) ? array( 'closed' ) : array( '' );
    10421041    } else {
    1043         return '';
    1044     }
     1042        $classes = array( '' );
     1043    }
     1044
     1045    $classes = apply_filters( "postbox_classes_{$page}_{$id}", $classes );
     1046    return implode( ' ', $classes );
    10451047}
    10461048
Note: See TracChangeset for help on using the changeset viewer.