Customizer: Update `nav_menu_locations[...]` controls to remove placeholder menus from the dropdown options upon Save & Publish.

See #32814.
Fixes #33176.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33463 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2015-07-29 19:34:25 +00:00
parent 61dd2bfdde
commit a4bc3daa9e
3 changed files with 10 additions and 3 deletions

View File

@ -2492,7 +2492,7 @@
oldSection.container.remove(); oldSection.container.remove();
api.section.remove( oldCustomizeId ); api.section.remove( oldCustomizeId );
// Remove the menu to the nav menu widget template. // Update the nav_menu widget to reflect removed placeholder menu.
navMenuCount = 0; navMenuCount = 0;
api.each(function( setting ) { api.each(function( setting ) {
if ( /^nav_menu\[/.test( setting.id ) && false !== setting() ) { if ( /^nav_menu\[/.test( setting.id ) && false !== setting() ) {
@ -2504,6 +2504,13 @@
widgetTemplate.find( '.nav-menu-widget-no-menus-message:first' ).toggle( 0 === navMenuCount ); widgetTemplate.find( '.nav-menu-widget-no-menus-message:first' ).toggle( 0 === navMenuCount );
widgetTemplate.find( 'option[value=' + String( update.previous_term_id ) + ']' ).remove(); widgetTemplate.find( 'option[value=' + String( update.previous_term_id ) + ']' ).remove();
// Update the nav_menu_locations[...] controls to remove the placeholder menus from the dropdown options.
wp.customize.control.each(function( control ){
if ( /^nav_menu_locations\[/.test( control.id ) ) {
control.container.find( 'option[value=' + String( update.previous_term_id ) + ']' ).remove();
}
});
// Update nav_menu_locations to reference the new ID. // Update nav_menu_locations to reference the new ID.
api.each( function( setting ) { api.each( function( setting ) {
var wasSaved = api.state( 'saved' ).get(); var wasSaved = api.state( 'saved' ).get();

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.3-beta4-33495'; $wp_version = '4.3-beta4-33496';
/** /**
* 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.