Make WordPress Core

Changeset 45083


Ignore:
Timestamp:
04/01/2019 12:46:04 PM (6 years ago)
Author:
SergeyBiryukov
Message:

Docs: Improve documentation for postbox_classes().

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

Props sharifkiberu, DrewAPicture.
Fixes #45179.

File:
1 edited

Legend:

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

    r44959 r45083  
    12921292 * @since 2.5.0
    12931293 *
    1294  * @param string $id
    1295  * @param string $page
    1296  * @return string
    1297  */
    1298 function postbox_classes( $id, $page ) {
    1299     if ( isset( $_GET['edit'] ) && $_GET['edit'] == $id ) {
     1294 * @param string $box_id    Meta box ID (used in the 'id' attribute for the meta box).
     1295 * @param string $screen_id The screen on which the meta box is shown.
     1296 * @return string Space-separated string of class names.
     1297 */
     1298function postbox_classes( $box_id, $screen_id ) {
     1299    if ( isset( $_GET['edit'] ) && $_GET['edit'] == $box_id ) {
    13001300        $classes = array( '' );
    1301     } elseif ( $closed = get_user_option( 'closedpostboxes_' . $page ) ) {
     1301    } elseif ( $closed = get_user_option( 'closedpostboxes_' . $screen_id ) ) {
    13021302        if ( ! is_array( $closed ) ) {
    13031303            $classes = array( '' );
    13041304        } else {
    1305             $classes = in_array( $id, $closed ) ? array( 'closed' ) : array( '' );
     1305            $classes = in_array( $box_id, $closed ) ? array( 'closed' ) : array( '' );
    13061306        }
    13071307    } else {
     
    13101310
    13111311    /**
    1312      * Filters the postbox classes for a specific screen and screen ID combo.
    1313      *
    1314      * The dynamic portions of the hook name, `$page` and `$id`, refer to
    1315      * the screen and screen ID, respectively.
     1312     * Filters the postbox classes for a specific screen and box ID combo.
     1313     *
     1314     * The dynamic portions of the hook name, `$screen_id` and `$box_id`, refer to
     1315     * the screen ID and meta box ID, respectively.
    13161316     *
    13171317     * @since 3.2.0
     
    13191319     * @param string[] $classes An array of postbox classes.
    13201320     */
    1321     $classes = apply_filters( "postbox_classes_{$page}_{$id}", $classes );
     1321    $classes = apply_filters( "postbox_classes_{$screen_id}_{$box_id}", $classes );
    13221322    return implode( ' ', $classes );
    13231323}
Note: See TracChangeset for help on using the changeset viewer.