Changeset 41237 for trunk/src/wp-includes/class-wp-customize-nav-menus.php
- Timestamp:
- 08/09/2017 09:03:16 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-customize-nav-menus.php
r41205 r41237 28 28 29 29 /** 30 * Previewed Menus.31 * 32 * @since 4. 3.030 * Original nav menu locations before the theme was switched. 31 * 32 * @since 4.9.0 33 33 * @var array 34 34 */ 35 p ublic $previewed_menus;35 protected $original_nav_menu_locations; 36 36 37 37 /** … … 43 43 */ 44 44 public function __construct( $manager ) { 45 $this-> previewed_menus = array();46 $this-> manager = $manager;45 $this->manager = $manager; 46 $this->original_nav_menu_locations = get_nav_menu_locations(); 47 47 48 48 // See https://github.com/xwp/wp-customize-snapshots/blob/962586659688a5b1fd9ae93618b7ce2d4e7a421c/php/class-customize-snapshot-manager.php#L469-L499 … … 583 583 } 584 584 585 // Attempt to re-map the nav menu location assignments when previewing a theme switch. 586 $mapped_nav_menu_locations = array(); 587 if ( ! $this->manager->is_theme_active() ) { 588 $mapped_nav_menu_locations = wp_map_nav_menu_locations( get_nav_menu_locations(), $this->original_nav_menu_locations ); 589 } 590 585 591 foreach ( $locations as $location => $description ) { 586 592 $setting_id = "nav_menu_locations[{$location}]"; … … 599 605 'default' => 0, 600 606 ) ); 607 } 608 609 // Override the assigned nav menu location if mapped during previewed theme switch. 610 if ( isset( $mapped_nav_menu_locations[ $location ] ) ) { 611 $this->manager->set_post_value( $setting_id, $mapped_nav_menu_locations[ $location ] ); 601 612 } 602 613
Note: See TracChangeset
for help on using the changeset viewer.