Changeset 33094
- Timestamp:
- 07/06/2015 07:12:48 PM (9 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/js/customize-nav-menus.js
r33077 r33094 2546 2546 */ 2547 2547 function displayNavMenuName( name ) { 2548 name = name || ''; 2548 2549 name = $( '<div>' ).text( name ).html(); // Emulate esc_html() which is used in wp-admin/nav-menus.php. 2549 2550 name = $.trim( name ); -
trunk/src/wp-includes/class-wp-customize-nav-menus.php
r33089 r33094 434 434 ) ); 435 435 436 // @todo if ( ! $menus ) : make a "default" menu 437 if ( $menus ) { 438 $choices = array( '0' => __( '— Select —' ) ); 439 foreach ( $menus as $menu ) { 440 $choices[ $menu->term_id ] = wp_html_excerpt( $menu->name, 40, '…' ); 436 $choices = array( '0' => __( '— Select —' ) ); 437 foreach ( $menus as $menu ) { 438 $choices[ $menu->term_id ] = wp_html_excerpt( $menu->name, 40, '…' ); 439 } 440 441 foreach ( $locations as $location => $description ) { 442 $setting_id = "nav_menu_locations[{$location}]"; 443 444 $setting = $this->manager->get_setting( $setting_id ); 445 if ( $setting ) { 446 $setting->transport = 'postMessage'; 447 remove_filter( "customize_sanitize_{$setting_id}", 'absint' ); 448 add_filter( "customize_sanitize_{$setting_id}", array( $this, 'intval_base10' ) ); 449 } else { 450 $this->manager->add_setting( $setting_id, array( 451 'sanitize_callback' => array( $this, 'intval_base10' ), 452 'theme_supports' => 'menus', 453 'type' => 'theme_mod', 454 'transport' => 'postMessage', 455 ) ); 441 456 } 442 457 443 foreach ( $locations as $location => $description ) { 444 $setting_id = "nav_menu_locations[{$location}]"; 445 446 $setting = $this->manager->get_setting( $setting_id ); 447 if ( $setting ) { 448 $setting->transport = 'postMessage'; 449 remove_filter( "customize_sanitize_{$setting_id}", 'absint' ); 450 add_filter( "customize_sanitize_{$setting_id}", array( $this, 'intval_base10' ) ); 451 } else { 452 $this->manager->add_setting( $setting_id, array( 453 'sanitize_callback' => array( $this, 'intval_base10' ), 454 'theme_supports' => 'menus', 455 'type' => 'theme_mod', 456 'transport' => 'postMessage', 457 ) ); 458 } 459 460 $this->manager->add_control( new WP_Customize_Nav_Menu_Location_Control( $this->manager, $setting_id, array( 461 'label' => $description, 462 'location_id' => $location, 463 'section' => 'menu_locations', 464 'choices' => $choices, 465 ) ) ); 466 } 458 $this->manager->add_control( new WP_Customize_Nav_Menu_Location_Control( $this->manager, $setting_id, array( 459 'label' => $description, 460 'location_id' => $location, 461 'section' => 'menu_locations', 462 'choices' => $choices, 463 ) ) ); 467 464 } 468 465
Note: See TracChangeset
for help on using the changeset viewer.