Customize: Revert part of [38859] which caused sections to get deactivated in the customizer.

See #37128.

Built from https://develop.svn.wordpress.org/trunk@38862


git-svn-id: http://core.svn.wordpress.org/trunk@38805 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2016-10-21 16:17:41 +00:00
parent e099b4d947
commit 2e173f9e44
2 changed files with 7 additions and 29 deletions

View File

@ -2505,15 +2505,12 @@ final class WP_Customize_Manager {
* Helper function to compare two objects by priority, ensuring sort stability via instance_number. * Helper function to compare two objects by priority, ensuring sort stability via instance_number.
* *
* @since 3.4.0 * @since 3.4.0
* @deprecated 4.7.0 Use wp_list_sort()
* *
* @param WP_Customize_Panel|WP_Customize_Section|WP_Customize_Control $a Object A. * @param WP_Customize_Panel|WP_Customize_Section|WP_Customize_Control $a Object A.
* @param WP_Customize_Panel|WP_Customize_Section|WP_Customize_Control $b Object B. * @param WP_Customize_Panel|WP_Customize_Section|WP_Customize_Control $b Object B.
* @return int * @return int
*/ */
protected function _cmp_priority( $a, $b ) { protected function _cmp_priority( $a, $b ) {
_deprecated_function( __METHOD__, '4.7.0', 'wp_list_sort' );
if ( $a->priority === $b->priority ) { if ( $a->priority === $b->priority ) {
return $a->instance_number - $b->instance_number; return $a->instance_number - $b->instance_number;
} else { } else {
@ -2533,10 +2530,7 @@ final class WP_Customize_Manager {
public function prepare_controls() { public function prepare_controls() {
$controls = array(); $controls = array();
$this->controls = wp_list_sort( $this->controls, array( uasort( $this->controls, array( $this, '_cmp_priority' ) );
'priority' => 'ASC',
'instance_number' => 'ASC',
) );
foreach ( $this->controls as $id => $control ) { foreach ( $this->controls as $id => $control ) {
if ( ! isset( $this->sections[ $control->section ] ) || ! $control->check_capabilities() ) { if ( ! isset( $this->sections[ $control->section ] ) || ! $control->check_capabilities() ) {
@ -2549,10 +2543,7 @@ final class WP_Customize_Manager {
$this->controls = $controls; $this->controls = $controls;
// Prepare sections. // Prepare sections.
$this->sections = wp_list_sort( $this->sections, array( uasort( $this->sections, array( $this, '_cmp_priority' ) );
'priority' => 'ASC',
'instance_number' => 'ASC',
) );
$sections = array(); $sections = array();
foreach ( $this->sections as $section ) { foreach ( $this->sections as $section ) {
@ -2560,11 +2551,7 @@ final class WP_Customize_Manager {
continue; continue;
} }
usort( $section->controls, array( $this, '_cmp_priority' ) );
$section->controls = wp_list_sort( $section->controls, array(
'priority' => 'ASC',
'instance_number' => 'ASC',
) );
if ( ! $section->panel ) { if ( ! $section->panel ) {
// Top-level section. // Top-level section.
@ -2579,10 +2566,7 @@ final class WP_Customize_Manager {
$this->sections = $sections; $this->sections = $sections;
// Prepare panels. // Prepare panels.
$this->panels = wp_list_sort( $this->panels, array( uasort( $this->panels, array( $this, '_cmp_priority' ) );
'priority' => 'ASC',
'instance_number' => 'ASC',
) );
$panels = array(); $panels = array();
foreach ( $this->panels as $panel ) { foreach ( $this->panels as $panel ) {
@ -2590,20 +2574,14 @@ final class WP_Customize_Manager {
continue; continue;
} }
$panel->sections = wp_list_sort( $panel->sections, array( uasort( $panel->sections, array( $this, '_cmp_priority' ) );
'priority' => 'ASC',
'instance_number' => 'ASC',
) );
$panels[ $panel->id ] = $panel; $panels[ $panel->id ] = $panel;
} }
$this->panels = $panels; $this->panels = $panels;
// Sort panels and top-level sections together. // Sort panels and top-level sections together.
$this->containers = array_merge( $this->panels, $this->sections ); $this->containers = array_merge( $this->panels, $this->sections );
$this->containers = wp_list_sort( $this->containers, array( uasort( $this->containers, array( $this, '_cmp_priority' ) );
'priority' => 'ASC',
'instance_number' => 'ASC',
) );
} }
/** /**

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.7-alpha-38861'; $wp_version = '4.7-alpha-38862';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.