Changeset 38810 for trunk/src/wp-includes/class-wp-customize-nav-menus.php
- Timestamp:
- 10/18/2016 08:04:36 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-customize-nav-menus.php
r38794 r38810 49 49 $this->manager = $manager; 50 50 51 // Skip useless hooks when the user can't manage nav menus anyway. 51 // See https://github.com/xwp/wp-customize-snapshots/blob/962586659688a5b1fd9ae93618b7ce2d4e7a421c/php/class-customize-snapshot-manager.php#L469-L499 52 add_action( 'customize_register', array( $this, 'customize_register' ), 11 ); 53 add_filter( 'customize_dynamic_setting_args', array( $this, 'filter_dynamic_setting_args' ), 10, 2 ); 54 add_filter( 'customize_dynamic_setting_class', array( $this, 'filter_dynamic_setting_class' ), 10, 3 ); 55 56 // Skip remaining hooks when the user can't manage nav menus anyway. 52 57 if ( ! current_user_can( 'edit_theme_options' ) ) { 53 58 return; … … 59 64 add_action( 'wp_ajax_customize-nav-menus-insert-auto-draft', array( $this, 'ajax_insert_auto_draft_post' ) ); 60 65 add_action( 'customize_controls_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); 61 add_action( 'customize_register', array( $this, 'customize_register' ), 11 );62 add_filter( 'customize_dynamic_setting_args', array( $this, 'filter_dynamic_setting_args' ), 10, 2 );63 add_filter( 'customize_dynamic_setting_class', array( $this, 'filter_dynamic_setting_class' ), 10, 3 );64 66 add_action( 'customize_controls_print_footer_scripts', array( $this, 'print_templates' ) ); 65 67 add_action( 'customize_controls_print_footer_scripts', array( $this, 'available_items_template' ) ); … … 487 489 public function customize_register() { 488 490 491 /* 492 * Preview settings for nav menus early so that the sections and controls will be added properly. 493 * See https://github.com/xwp/wp-customize-snapshots/blob/962586659688a5b1fd9ae93618b7ce2d4e7a421c/php/class-customize-snapshot-manager.php#L506-L543 494 */ 495 $nav_menus_setting_ids = array(); 496 foreach ( array_keys( $this->manager->unsanitized_post_values() ) as $setting_id ) { 497 if ( preg_match( '/^(nav_menu_locations|nav_menu|nav_menu_item)\[/', $setting_id ) ) { 498 $nav_menus_setting_ids[] = $setting_id; 499 } 500 } 501 foreach ( $nav_menus_setting_ids as $setting_id ) { 502 $setting = $this->manager->get_setting( $setting_id ); 503 if ( $setting ) { 504 $setting->preview(); 505 } 506 } 507 489 508 // Require JS-rendered control types. 490 509 $this->manager->register_panel_type( 'WP_Customize_Nav_Menus_Panel' );
Note: See TracChangeset
for help on using the changeset viewer.