Ticket #32683: 32683.1.diff
| File 32683.1.diff, 2.3 KB (added by , 10 years ago) |
|---|
-
src/wp-admin/js/customize-widgets.js
2139 2139 return foundControl; 2140 2140 }; 2141 2141 2142 /* 2143 * Init linking between menu widgets and customizer menus. 2144 */ 2145 $( document ).on( 'widget-added', function( event, widgetContainer ) { 2146 if ( 0 < widgetContainer.find( '.nav-menu-widget-form-controls' ).length ) { 2147 var menuField = widgetContainer.find( '.selected-menu' ), 2148 button = widgetContainer.find( '.edit-menu' ); 2149 menuField.on( 'change', function() { 2150 if ( 0 < menuField.val() ) { 2151 button.show(); 2152 } else { 2153 button.hide(); 2154 } 2155 }); 2156 button.on( 'click', function() { 2157 var section = 'nav_menu[' + menuField.val() + ']'; 2158 wp.customize.section( section ).focus(); 2159 } ); 2160 } 2161 } ); 2162 2142 2163 /** 2143 2164 * @param {String} widgetId 2144 2165 * @returns {Object} -
src/wp-includes/widgets/class-wp-nav-menu-widget.php
137 137 </p> 138 138 <p> 139 139 <label for="<?php echo $this->get_field_id( 'nav_menu' ); ?>"><?php _e( 'Select Menu:' ); ?></label> 140 <select id="<?php echo $this->get_field_id( 'nav_menu' ); ?>" name="<?php echo $this->get_field_name( 'nav_menu' ); ?>">140 <select class="selected-menu" id="<?php echo $this->get_field_id( 'nav_menu' ); ?>" name="<?php echo $this->get_field_name( 'nav_menu' ); ?>"> 141 141 <option value="0"><?php _e( '— Select —' ); ?></option> 142 142 <?php foreach ( $menus as $menu ) : ?> 143 143 <option value="<?php echo esc_attr( $menu->term_id ); ?>" <?php selected( $nav_menu, $menu->term_id ); ?>> … … 145 145 </option> 146 146 <?php endforeach; ?> 147 147 </select> 148 <?php if ( isset( $GLOBALS['wp_customize'] ) && $GLOBALS['wp_customize'] instanceof WP_Customize_Manager ) : ?> 149 <button type="button" class="button edit-menu" style="margin-top: 12px; <?php if ( ! $nav_menu ) { echo 'display: none;'; } ?>"><?php _e( 'Edit Menu' ) ?></button> 150 <?php endif; ?> 148 151 </p> 149 152 </div> 150 153 <?php