Ticket #42364: 42364.2.diff
File 42364.2.diff, 8.1 KB (added by , 5 years ago) |
---|
-
src/js/_enqueues/wp/customize/nav-menus.js
3027 3027 } 3028 3028 } ); 3029 3029 3030 api.Menus.NewMenuControl = api.Control.extend(/** @lends wp.customize.Menus.NewMenuControl.prototype */{3031 3032 /**3033 * wp.customize.Menus.NewMenuControl3034 *3035 * Customizer control for creating new menus and handling deletion of existing menus.3036 * Note that 'new_menu' must match the WP_Customize_New_Menu_Control::$type.3037 *3038 * @constructs wp.customize.Menus.NewMenuControl3039 * @augments wp.customize.Control3040 *3041 * @deprecated 4.9.0 This class is no longer used due to new menu creation UX.3042 */3043 initialize: function() {3044 if ( 'undefined' !== typeof console && console.warn ) {3045 console.warn( '[DEPRECATED] wp.customize.NewMenuControl will be removed. Please use wp.customize.Menus.createNavMenu() instead.' );3046 }3047 api.Control.prototype.initialize.apply( this, arguments );3048 },3049 3050 /**3051 * Set up the control.3052 *3053 * @deprecated 4.9.03054 */3055 ready: function() {3056 this._bindHandlers();3057 },3058 3059 _bindHandlers: function() {3060 var self = this,3061 name = $( '#customize-control-new_menu_name input' ),3062 submit = $( '#create-new-menu-submit' );3063 name.on( 'keydown', function( event ) {3064 if ( 13 === event.which ) { // Enter.3065 self.submit();3066 }3067 } );3068 submit.on( 'click', function( event ) {3069 self.submit();3070 event.stopPropagation();3071 event.preventDefault();3072 } );3073 },3074 3075 /**3076 * Create the new menu with the name supplied.3077 *3078 * @deprecated 4.9.03079 */3080 submit: function() {3081 3082 var control = this,3083 container = control.container.closest( '.accordion-section-new-menu' ),3084 nameInput = container.find( '.menu-name-field' ).first(),3085 name = nameInput.val(),3086 menuSection;3087 3088 if ( ! name ) {3089 nameInput.addClass( 'invalid' );3090 nameInput.focus();3091 return;3092 }3093 3094 menuSection = api.Menus.createNavMenu( name );3095 3096 // Clear name field.3097 nameInput.val( '' );3098 nameInput.removeClass( 'invalid' );3099 3100 wp.a11y.speak( api.Menus.data.l10n.menuAdded );3101 3102 // Focus on the new menu section.3103 menuSection.focus();3104 }3105 });3106 3107 3030 /** 3108 3031 * Extends wp.customize.controlConstructor with control constructor for 3109 3032 * menu_location, menu_item, nav_menu, and new_menu. … … 3113 3036 nav_menu_item: api.Menus.MenuItemControl, 3114 3037 nav_menu: api.Menus.MenuControl, 3115 3038 nav_menu_name: api.Menus.MenuNameControl, 3116 new_menu: api.Menus.NewMenuControl, // @todo Remove in a future release. See #42364.3117 3039 nav_menu_locations: api.Menus.MenuLocationsControl, 3118 3040 nav_menu_auto_add: api.Menus.MenuAutoAddControl 3119 3041 }); -
src/wp-includes/class-wp-customize-manager.php
317 317 require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-name-control.php' ); 318 318 require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-locations-control.php' ); 319 319 require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-auto-add-control.php' ); 320 require_once( ABSPATH . WPINC . '/customize/class-wp-customize-new-menu-control.php' ); // @todo Remove in a future release. See #42364.321 320 322 321 require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menus-panel.php' ); 323 322 … … 325 324 require_once( ABSPATH . WPINC . '/customize/class-wp-customize-themes-section.php' ); 326 325 require_once( ABSPATH . WPINC . '/customize/class-wp-customize-sidebar-section.php' ); 327 326 require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-section.php' ); 328 require_once( ABSPATH . WPINC . '/customize/class-wp-customize-new-menu-section.php' ); // @todo Remove in a future release. See #42364.329 327 330 328 require_once( ABSPATH . WPINC . '/customize/class-wp-customize-custom-css-setting.php' ); 331 329 require_once( ABSPATH . WPINC . '/customize/class-wp-customize-filter-setting.php' ); -
src/wp-includes/class-wp-customize-section.php
383 383 384 384 /** WP_Customize_Nav_Menu_Section class */ 385 385 require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-section.php' ); 386 387 /**388 * WP_Customize_New_Menu_Section class389 *390 * As this file is deprecated, it will trigger a deprecation notice if instantiated. In a subsequent391 * release, the require_once() here will be removed and _deprecated_file() will be called if file is392 * required at all.393 *394 * @deprecated 4.9.0 This file is no longer used due to new menu creation UX.395 */396 require_once( ABSPATH . WPINC . '/customize/class-wp-customize-new-menu-section.php' ); -
src/wp-includes/customize/class-wp-customize-new-menu-control.php
8 8 * @deprecated 4.9.0 This file is no longer used as of the menu creation UX introduced in #40104. 9 9 */ 10 10 11 _deprecated_file( basename( __FILE__ ), '4.9.0' ); 12 11 13 /** 12 14 * Customize control class for new menus. 13 15 * … … 30 32 * Constructor. 31 33 * 32 34 * @since 4.9.0 35 * @deprecated 4.9.0 33 36 * 34 37 * @param WP_Customize_Manager $manager Manager. 35 38 * @param string $id ID. 36 39 * @param array $args Args. 37 40 */ 38 41 public function __construct( WP_Customize_Manager $manager, $id, array $args = array() ) { 39 _deprecated_f ile( basename( __FILE__ ), '4.9.0' ); // @todo Move this outside of class, and remove its require_once() from class-wp-customize-control.php. See #42364.42 _deprecated_function( __METHOD__, '4.9.0' ); 40 43 parent::__construct( $manager, $id, $args ); 41 44 } 42 45 … … 44 47 * Render the control's content. 45 48 * 46 49 * @since 4.3.0 50 * @deprecated 4.9.0 47 51 */ 48 52 public function render_content() { 53 _deprecated_function( __METHOD__, '4.9.0' ); 49 54 ?> 50 55 <button type="button" class="button button-primary" id="create-new-menu-submit"><?php _e( 'Create Menu' ); ?></button> 51 56 <span class="spinner"></span> -
src/wp-includes/customize/class-wp-customize-new-menu-section.php
8 8 * @deprecated 4.9.0 This file is no longer used as of the menu creation UX introduced in #40104. 9 9 */ 10 10 11 _deprecated_file( basename( __FILE__ ), '4.9.0' ); 12 11 13 /** 12 14 * Customize Menu Section Class 13 15 * … … 32 34 * Any supplied $args override class property defaults. 33 35 * 34 36 * @since 4.9.0 37 * @deprecated 4.9.0 35 38 * 36 39 * @param WP_Customize_Manager $manager Customizer bootstrap instance. 37 40 * @param string $id An specific ID of the section. 38 41 * @param array $args Section arguments. 39 42 */ 40 43 public function __construct( WP_Customize_Manager $manager, $id, array $args = array() ) { 41 _deprecated_f ile( basename( __FILE__ ), '4.9.0' ); // @todo Move this outside of class, and remove its require_once() from class-wp-customize-section.php. See #42364.44 _deprecated_function( __METHOD__, '4.9.0' ); 42 45 parent::__construct( $manager, $id, $args ); 43 46 } 44 47 … … 46 49 * Render the section, and the controls that have been added to it. 47 50 * 48 51 * @since 4.3.0 52 * @deprecated 4.9.0 49 53 */ 50 54 protected function render() { 55 _deprecated_function( __METHOD__, '4.9.0' ); 51 56 ?> 52 57 <li id="accordion-section-<?php echo esc_attr( $this->id ); ?>" class="accordion-section-new-menu"> 53 58 <button type="button" class="button add-new-menu-item add-menu-toggle" aria-expanded="false">