Docs: Improve documentation for postbox_classes().

Rename `$page` and `$id` variables to `$screen_id` and `$box_id` for clarity.

Props sharifkiberu, DrewAPicture.
Fixes #45179.
Built from https://develop.svn.wordpress.org/trunk@45083


git-svn-id: http://core.svn.wordpress.org/trunk@44892 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2019-04-01 12:47:51 +00:00
parent 2f5b5baa07
commit 733ec3da48
2 changed files with 12 additions and 12 deletions

View File

@ -1291,34 +1291,34 @@ function wp_edit_attachments_query( $q = false ) {
*
* @since 2.5.0
*
* @param string $id
* @param string $page
* @return string
* @param string $box_id Meta box ID (used in the 'id' attribute for the meta box).
* @param string $screen_id The screen on which the meta box is shown.
* @return string Space-separated string of class names.
*/
function postbox_classes( $id, $page ) {
if ( isset( $_GET['edit'] ) && $_GET['edit'] == $id ) {
function postbox_classes( $box_id, $screen_id ) {
if ( isset( $_GET['edit'] ) && $_GET['edit'] == $box_id ) {
$classes = array( '' );
} elseif ( $closed = get_user_option( 'closedpostboxes_' . $page ) ) {
} elseif ( $closed = get_user_option( 'closedpostboxes_' . $screen_id ) ) {
if ( ! is_array( $closed ) ) {
$classes = array( '' );
} else {
$classes = in_array( $id, $closed ) ? array( 'closed' ) : array( '' );
$classes = in_array( $box_id, $closed ) ? array( 'closed' ) : array( '' );
}
} else {
$classes = array( '' );
}
/**
* Filters the postbox classes for a specific screen and screen ID combo.
* Filters the postbox classes for a specific screen and box ID combo.
*
* The dynamic portions of the hook name, `$page` and `$id`, refer to
* the screen and screen ID, respectively.
* The dynamic portions of the hook name, `$screen_id` and `$box_id`, refer to
* the screen ID and meta box ID, respectively.
*
* @since 3.2.0
*
* @param string[] $classes An array of postbox classes.
*/
$classes = apply_filters( "postbox_classes_{$page}_{$id}", $classes );
$classes = apply_filters( "postbox_classes_{$screen_id}_{$box_id}", $classes );
return implode( ' ', $classes );
}

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.2-beta1-45082';
$wp_version = '5.2-beta1-45083';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.