Ticket #42364: 42364.diff
File 42364.diff, 8.5 KB (added by , 7 years ago) |
---|
-
src/wp-admin/js/customize-nav-menus.js
diff --git a/src/wp-admin/js/customize-nav-menus.js b/src/wp-admin/js/customize-nav-menus.js index db846baaf2..029c011dc1 100644
a b 3024 3024 } 3025 3025 } ); 3026 3026 3027 api.Menus.NewMenuControl = api.Control.extend(/** @lends wp.customize.Menus.NewMenuControl.prototype */{3028 3029 /**3030 * wp.customize.Menus.NewMenuControl3031 *3032 * Customizer control for creating new menus and handling deletion of existing menus.3033 * Note that 'new_menu' must match the WP_Customize_New_Menu_Control::$type.3034 *3035 * @constructs wp.customize.Menus.NewMenuControl3036 * @augments wp.customize.Control3037 *3038 * @deprecated 4.9.0 This class is no longer used due to new menu creation UX.3039 */3040 initialize: function() {3041 if ( 'undefined' !== typeof console && console.warn ) {3042 console.warn( '[DEPRECATED] wp.customize.NewMenuControl will be removed. Please use wp.customize.Menus.createNavMenu() instead.' );3043 }3044 api.Control.prototype.initialize.apply( this, arguments );3045 },3046 3047 /**3048 * Set up the control.3049 *3050 * @deprecated 4.9.03051 */3052 ready: function() {3053 this._bindHandlers();3054 },3055 3056 _bindHandlers: function() {3057 var self = this,3058 name = $( '#customize-control-new_menu_name input' ),3059 submit = $( '#create-new-menu-submit' );3060 name.on( 'keydown', function( event ) {3061 if ( 13 === event.which ) { // Enter.3062 self.submit();3063 }3064 } );3065 submit.on( 'click', function( event ) {3066 self.submit();3067 event.stopPropagation();3068 event.preventDefault();3069 } );3070 },3071 3072 /**3073 * Create the new menu with the name supplied.3074 *3075 * @deprecated 4.9.03076 */3077 submit: function() {3078 3079 var control = this,3080 container = control.container.closest( '.accordion-section-new-menu' ),3081 nameInput = container.find( '.menu-name-field' ).first(),3082 name = nameInput.val(),3083 menuSection;3084 3085 if ( ! name ) {3086 nameInput.addClass( 'invalid' );3087 nameInput.focus();3088 return;3089 }3090 3091 menuSection = api.Menus.createNavMenu( name );3092 3093 // Clear name field.3094 nameInput.val( '' );3095 nameInput.removeClass( 'invalid' );3096 3097 wp.a11y.speak( api.Menus.data.l10n.menuAdded );3098 3099 // Focus on the new menu section.3100 menuSection.focus();3101 }3102 });3103 3104 3027 /** 3105 3028 * Extends wp.customize.controlConstructor with control constructor for 3106 3029 * menu_location, menu_item, nav_menu, and new_menu. -
src/wp-includes/class-wp-customize-manager.php
diff --git a/src/wp-includes/class-wp-customize-manager.php b/src/wp-includes/class-wp-customize-manager.php index db21cb35d9..e317789405 100644
a b final class WP_Customize_Manager { 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 5.0. See #42364.321 320 322 321 require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menus-panel.php' ); 323 322 … … final class WP_Customize_Manager { 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 5.0. 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
diff --git a/src/wp-includes/class-wp-customize-section.php b/src/wp-includes/class-wp-customize-section.php index 6a7b812f2d..8b2c5789bc 100644
a b require_once( ABSPATH . WPINC . '/customize/class-wp-customize-sidebar-section.p 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' ); -
deleted file src/wp-includes/customize/class-wp-customize-new-menu-control.php
diff --git a/src/wp-includes/customize/class-wp-customize-new-menu-control.php b/src/wp-includes/customize/class-wp-customize-new-menu-control.php deleted file mode 100644 index 9925b59bff..0000000000
+ - 1 <?php2 /**3 * Customize API: WP_Customize_New_Menu_Control class4 *5 * @package WordPress6 * @subpackage Customize7 * @since 4.4.08 * @deprecated 4.9.0 This file is no longer used as of the menu creation UX introduced in #40104.9 */10 11 /**12 * Customize control class for new menus.13 *14 * @since 4.3.015 * @deprecated 4.9.0 This class is no longer used as of the menu creation UX introduced in #40104.16 *17 * @see WP_Customize_Control18 */19 class WP_Customize_New_Menu_Control extends WP_Customize_Control {20 21 /**22 * Control type.23 *24 * @since 4.3.025 * @var string26 */27 public $type = 'new_menu';28 29 /**30 * Constructor.31 *32 * @since 4.9.033 *34 * @param WP_Customize_Manager $manager Manager.35 * @param string $id ID.36 * @param array $args Args.37 */38 public function __construct( WP_Customize_Manager $manager, $id, array $args = array() ) {39 _deprecated_file( basename( __FILE__ ), '4.9.0' ); // @todo Move this outside of class in 5.0, and remove its require_once() from class-wp-customize-control.php. See #42364.40 parent::__construct( $manager, $id, $args );41 }42 43 /**44 * Render the control's content.45 *46 * @since 4.3.047 */48 public function render_content() {49 ?>50 <button type="button" class="button button-primary" id="create-new-menu-submit"><?php _e( 'Create Menu' ); ?></button>51 <span class="spinner"></span>52 <?php53 }54 } -
deleted file src/wp-includes/customize/class-wp-customize-new-menu-section.php
diff --git a/src/wp-includes/customize/class-wp-customize-new-menu-section.php b/src/wp-includes/customize/class-wp-customize-new-menu-section.php deleted file mode 100644 index e0b9b0c5ad..0000000000
+ - 1 <?php2 /**3 * Customize API: WP_Customize_New_Menu_Section class4 *5 * @package WordPress6 * @subpackage Customize7 * @since 4.4.08 * @deprecated 4.9.0 This file is no longer used as of the menu creation UX introduced in #40104.9 */10 11 /**12 * Customize Menu Section Class13 *14 * @since 4.3.015 * @deprecated 4.9.0 This class is no longer used as of the menu creation UX introduced in #40104.16 *17 * @see WP_Customize_Section18 */19 class WP_Customize_New_Menu_Section extends WP_Customize_Section {20 21 /**22 * Control type.23 *24 * @since 4.3.025 * @var string26 */27 public $type = 'new_menu';28 29 /**30 * Constructor.31 *32 * Any supplied $args override class property defaults.33 *34 * @since 4.9.035 *36 * @param WP_Customize_Manager $manager Customizer bootstrap instance.37 * @param string $id An specific ID of the section.38 * @param array $args Section arguments.39 */40 public function __construct( WP_Customize_Manager $manager, $id, array $args = array() ) {41 _deprecated_file( basename( __FILE__ ), '4.9.0' ); // @todo Move this outside of class in 5.0, and remove its require_once() from class-wp-customize-section.php. See #42364.42 parent::__construct( $manager, $id, $args );43 }44 45 /**46 * Render the section, and the controls that have been added to it.47 *48 * @since 4.3.049 */50 protected function render() {51 ?>52 <li id="accordion-section-<?php echo esc_attr( $this->id ); ?>" class="accordion-section-new-menu">53 <button type="button" class="button add-new-menu-item add-menu-toggle" aria-expanded="false">54 <?php echo esc_html( $this->title ); ?>55 </button>56 <ul class="new-menu-section-content"></ul>57 </li>58 <?php59 }60 }