Customizer: Collapse any expanded panel/sections before expanding other panel/sections.

Fix removes need for workaround introduced in [33488] for direct link from nav menu widget to the customizer widgets panel. The todo is now implemented.

Cherry-picks [33837] onto 4.3 branch.
Props celloexpressions, westonruter.
Fixes #33396 for 4.3.

Built from https://develop.svn.wordpress.org/branches/4.3@33942


git-svn-id: http://core.svn.wordpress.org/branches/4.3@33911 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2015-09-07 06:20:23 +00:00
parent 00342ece4a
commit 758d53b709
3 changed files with 7 additions and 5 deletions

View File

@ -657,6 +657,9 @@
completeCallback: expand
});
} else {
api.panel.each( function( panel ) {
panel.collapse();
});
expand();
}
@ -1266,7 +1269,7 @@
// Collapse any sibling sections/panels
api.section.each( function ( section ) {
if ( ! section.panel() ) {
if ( panel.id !== section.panel() ) {
section.collapse( { duration: 0 } );
}
});

File diff suppressed because one or more lines are too long

View File

@ -1574,8 +1574,7 @@ class WP_Widget_Tag_Cloud extends WP_Widget {
<p class="nav-menu-widget-no-menus-message" <?php if ( ! empty( $menus ) ) { echo ' style="display:none" '; } ?>>
<?php
if ( isset( $GLOBALS['wp_customize'] ) && $GLOBALS['wp_customize'] instanceof WP_Customize_Manager ) {
// @todo When expanding a panel, the JS should be smart enough to collapse any existing panels and sections.
$url = 'javascript: wp.customize.section.each(function( section ){ section.collapse(); }); wp.customize.panel( "nav_menus" ).focus();';
$url = 'javascript: wp.customize.panel( "nav_menus" ).focus();';
} else {
$url = admin_url( 'nav-menus.php' );
}