Changeset 35581
- Timestamp:
- 11/09/2015 01:18:32 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/js/customize-nav-menus.js
r35302 r35581 2455 2455 api.Menus.applySavedData = function( data ) { 2456 2456 2457 var insertedMenuIdMapping = {} ;2457 var insertedMenuIdMapping = {}, insertedMenuItemIdMapping = {}; 2458 2458 2459 2459 _( data.nav_menu_updates ).each(function( update ) { … … 2586 2586 } ); 2587 2587 2588 // Build up mapping of nav_menu_item placeholder IDs to inserted IDs. 2589 _( data.nav_menu_item_updates ).each(function( update ) { 2590 if ( update.previous_post_id ) { 2591 insertedMenuItemIdMapping[ update.previous_post_id ] = update.post_id; 2592 } 2593 }); 2594 2588 2595 _( data.nav_menu_item_updates ).each(function( update ) { 2589 2596 var oldCustomizeId, newCustomizeId, oldSetting, newSetting, settingValue, oldControl, newControl; … … 2610 2617 } 2611 2618 settingValue = _.clone( settingValue ); 2619 2620 // If the parent menu item was also inserted, update the menu_item_parent to the new ID. 2621 if ( settingValue.menu_item_parent < 0 ) { 2622 if ( ! insertedMenuItemIdMapping[ settingValue.menu_item_parent ] ) { 2623 throw new Error( 'inserted ID for menu_item_parent not available' ); 2624 } 2625 settingValue.menu_item_parent = insertedMenuItemIdMapping[ settingValue.menu_item_parent ]; 2626 } 2612 2627 2613 2628 // If the menu was also inserted, then make sure it uses the new menu ID for nav_menu_term_id.
Note: See TracChangeset
for help on using the changeset viewer.