WordPress.org

Make WordPress Core

Ticket #31643: 31634.2.diff

File 31634.2.diff, 1.3 KB (added by iamfriendly, 6 years ago)

Refreshed the patch and added docs

  • wp-admin/widgets.php

    diff --git wp-admin/widgets.php wp-admin/widgets.php
    index 69b3161..d4be88a 100644
    if ( $sidebars_count > 1 ) { 
    420420<?php
    421421
    422422foreach ( $theme_sidebars as $sidebar => $registered_sidebar ) {
    423         $wrap_class = 'widgets-holder-wrap';
    424         if ( !empty( $registered_sidebar['class'] ) )
    425                 $wrap_class .= ' sidebar-' . $registered_sidebar['class'];
     423        $wrap_class = array(
     424                'widgets-holder-wrap'
     425        );
     426        if ( ! empty( $registered_sidebar['class'] ) ) {
     427                $wrap_class[] = ' sidebar-' . $registered_sidebar['class'];
     428        }
     429
     430        if ( $i > 0 ) {
     431                $wrap_class[] = 'closed';
     432        }
    426433
    427         if ( $i > 0 )
    428                 $wrap_class .= ' closed';
     434        /**
     435         * Filters the classes of the div tag which wraps the widget controls.
     436         *
     437         * @since 4.4.0
     438         *
     439         * @param array  $wrap_class An array of classes to add to the wrapping div.
     440         * @param int    $i A counter for the number of sidebars.
     441         * @param array  $theme_sidebars An array of the sidebars available in the current theme.
     442         * @param string $sidebar ID slug of the sidebar.
     443         * @param array  $registered_sidebar An associative array of details about the sidebar i.e. class, name, ID .
     444         */
     445        $wrap_class = join( ' ', apply_filters( 'registered_sidebar_wrap_class', $wrap_class, $i, $theme_sidebars, $sidebar, $registered_sidebar ) );
    429446
    430447        if ( $split && $i == $split ) {
    431448                ?>