mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-01 21:21:24 +01:00
Customize: Formally deprecate unused Customizer classes.
The `WP_Customize_New_Menu_Control` and `WP_Customize_New_Menu_Section` PHP classes and `wp.customize.Menus.NewMenuControl` JS class were deprecated in 4.9 through [42034] with the intention of removing them in 5.0. Since more time has passed than originally intended, this change leaves `WP_Customize_New_Menu_Control` and `WP_Customize_New_Menu_Section` to prevent any potential backwards compatibility issues, and formally deprecates them. The `wp.customize.Menus.NewMenuControl` JS class is removed. Props weston.ruter, matthias-reuter, jrf. Fixes #42364. Built from https://develop.svn.wordpress.org/trunk@46637 git-svn-id: http://core.svn.wordpress.org/trunk@46437 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
be164bf6f4
commit
583e49d95f
@ -3027,83 +3027,6 @@
|
||||
}
|
||||
} );
|
||||
|
||||
api.Menus.NewMenuControl = api.Control.extend(/** @lends wp.customize.Menus.NewMenuControl.prototype */{
|
||||
|
||||
/**
|
||||
* wp.customize.Menus.NewMenuControl
|
||||
*
|
||||
* Customizer control for creating new menus and handling deletion of existing menus.
|
||||
* Note that 'new_menu' must match the WP_Customize_New_Menu_Control::$type.
|
||||
*
|
||||
* @constructs wp.customize.Menus.NewMenuControl
|
||||
* @augments wp.customize.Control
|
||||
*
|
||||
* @deprecated 4.9.0 This class is no longer used due to new menu creation UX.
|
||||
*/
|
||||
initialize: function() {
|
||||
if ( 'undefined' !== typeof console && console.warn ) {
|
||||
console.warn( '[DEPRECATED] wp.customize.NewMenuControl will be removed. Please use wp.customize.Menus.createNavMenu() instead.' );
|
||||
}
|
||||
api.Control.prototype.initialize.apply( this, arguments );
|
||||
},
|
||||
|
||||
/**
|
||||
* Set up the control.
|
||||
*
|
||||
* @deprecated 4.9.0
|
||||
*/
|
||||
ready: function() {
|
||||
this._bindHandlers();
|
||||
},
|
||||
|
||||
_bindHandlers: function() {
|
||||
var self = this,
|
||||
name = $( '#customize-control-new_menu_name input' ),
|
||||
submit = $( '#create-new-menu-submit' );
|
||||
name.on( 'keydown', function( event ) {
|
||||
if ( 13 === event.which ) { // Enter.
|
||||
self.submit();
|
||||
}
|
||||
} );
|
||||
submit.on( 'click', function( event ) {
|
||||
self.submit();
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
} );
|
||||
},
|
||||
|
||||
/**
|
||||
* Create the new menu with the name supplied.
|
||||
*
|
||||
* @deprecated 4.9.0
|
||||
*/
|
||||
submit: function() {
|
||||
|
||||
var control = this,
|
||||
container = control.container.closest( '.accordion-section-new-menu' ),
|
||||
nameInput = container.find( '.menu-name-field' ).first(),
|
||||
name = nameInput.val(),
|
||||
menuSection;
|
||||
|
||||
if ( ! name ) {
|
||||
nameInput.addClass( 'invalid' );
|
||||
nameInput.focus();
|
||||
return;
|
||||
}
|
||||
|
||||
menuSection = api.Menus.createNavMenu( name );
|
||||
|
||||
// Clear name field.
|
||||
nameInput.val( '' );
|
||||
nameInput.removeClass( 'invalid' );
|
||||
|
||||
wp.a11y.speak( api.Menus.data.l10n.menuAdded );
|
||||
|
||||
// Focus on the new menu section.
|
||||
menuSection.focus();
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Extends wp.customize.controlConstructor with control constructor for
|
||||
* menu_location, menu_item, nav_menu, and new_menu.
|
||||
@ -3113,7 +3036,6 @@
|
||||
nav_menu_item: api.Menus.MenuItemControl,
|
||||
nav_menu: api.Menus.MenuControl,
|
||||
nav_menu_name: api.Menus.MenuNameControl,
|
||||
new_menu: api.Menus.NewMenuControl, // @todo Remove in a future release. See #42364.
|
||||
nav_menu_locations: api.Menus.MenuLocationsControl,
|
||||
nav_menu_auto_add: api.Menus.MenuAutoAddControl
|
||||
});
|
||||
|
2
wp-admin/js/customize-nav-menus.min.js
vendored
2
wp-admin/js/customize-nav-menus.min.js
vendored
File diff suppressed because one or more lines are too long
@ -317,7 +317,6 @@ final class WP_Customize_Manager {
|
||||
require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-name-control.php' );
|
||||
require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-locations-control.php' );
|
||||
require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-auto-add-control.php' );
|
||||
require_once( ABSPATH . WPINC . '/customize/class-wp-customize-new-menu-control.php' ); // @todo Remove in a future release. See #42364.
|
||||
|
||||
require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menus-panel.php' );
|
||||
|
||||
@ -325,7 +324,6 @@ final class WP_Customize_Manager {
|
||||
require_once( ABSPATH . WPINC . '/customize/class-wp-customize-themes-section.php' );
|
||||
require_once( ABSPATH . WPINC . '/customize/class-wp-customize-sidebar-section.php' );
|
||||
require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-section.php' );
|
||||
require_once( ABSPATH . WPINC . '/customize/class-wp-customize-new-menu-section.php' ); // @todo Remove in a future release. See #42364.
|
||||
|
||||
require_once( ABSPATH . WPINC . '/customize/class-wp-customize-custom-css-setting.php' );
|
||||
require_once( ABSPATH . WPINC . '/customize/class-wp-customize-filter-setting.php' );
|
||||
|
@ -383,14 +383,3 @@ require_once( ABSPATH . WPINC . '/customize/class-wp-customize-sidebar-section.p
|
||||
|
||||
/** WP_Customize_Nav_Menu_Section class */
|
||||
require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-section.php' );
|
||||
|
||||
/**
|
||||
* WP_Customize_New_Menu_Section class
|
||||
*
|
||||
* As this file is deprecated, it will trigger a deprecation notice if instantiated. In a subsequent
|
||||
* release, the require_once() here will be removed and _deprecated_file() will be called if file is
|
||||
* required at all.
|
||||
*
|
||||
* @deprecated 4.9.0 This file is no longer used due to new menu creation UX.
|
||||
*/
|
||||
require_once( ABSPATH . WPINC . '/customize/class-wp-customize-new-menu-section.php' );
|
||||
|
@ -8,6 +8,8 @@
|
||||
* @deprecated 4.9.0 This file is no longer used as of the menu creation UX introduced in #40104.
|
||||
*/
|
||||
|
||||
_deprecated_file( basename( __FILE__ ), '4.9.0' );
|
||||
|
||||
/**
|
||||
* Customize control class for new menus.
|
||||
*
|
||||
@ -30,13 +32,14 @@ class WP_Customize_New_Menu_Control extends WP_Customize_Control {
|
||||
* Constructor.
|
||||
*
|
||||
* @since 4.9.0
|
||||
* @deprecated 4.9.0
|
||||
*
|
||||
* @param WP_Customize_Manager $manager Manager.
|
||||
* @param string $id ID.
|
||||
* @param array $args Args.
|
||||
*/
|
||||
public function __construct( WP_Customize_Manager $manager, $id, array $args = array() ) {
|
||||
_deprecated_file( basename( __FILE__ ), '4.9.0' ); // @todo Move this outside of class, and remove its require_once() from class-wp-customize-control.php. See #42364.
|
||||
_deprecated_function( __METHOD__, '4.9.0' );
|
||||
parent::__construct( $manager, $id, $args );
|
||||
}
|
||||
|
||||
@ -44,8 +47,10 @@ class WP_Customize_New_Menu_Control extends WP_Customize_Control {
|
||||
* Render the control's content.
|
||||
*
|
||||
* @since 4.3.0
|
||||
* @deprecated 4.9.0
|
||||
*/
|
||||
public function render_content() {
|
||||
_deprecated_function( __METHOD__, '4.9.0' );
|
||||
?>
|
||||
<button type="button" class="button button-primary" id="create-new-menu-submit"><?php _e( 'Create Menu' ); ?></button>
|
||||
<span class="spinner"></span>
|
||||
|
@ -8,6 +8,8 @@
|
||||
* @deprecated 4.9.0 This file is no longer used as of the menu creation UX introduced in #40104.
|
||||
*/
|
||||
|
||||
_deprecated_file( basename( __FILE__ ), '4.9.0' );
|
||||
|
||||
/**
|
||||
* Customize Menu Section Class
|
||||
*
|
||||
@ -32,13 +34,14 @@ class WP_Customize_New_Menu_Section extends WP_Customize_Section {
|
||||
* Any supplied $args override class property defaults.
|
||||
*
|
||||
* @since 4.9.0
|
||||
* @deprecated 4.9.0
|
||||
*
|
||||
* @param WP_Customize_Manager $manager Customizer bootstrap instance.
|
||||
* @param string $id An specific ID of the section.
|
||||
* @param array $args Section arguments.
|
||||
*/
|
||||
public function __construct( WP_Customize_Manager $manager, $id, array $args = array() ) {
|
||||
_deprecated_file( basename( __FILE__ ), '4.9.0' ); // @todo Move this outside of class, and remove its require_once() from class-wp-customize-section.php. See #42364.
|
||||
_deprecated_function( __METHOD__, '4.9.0' );
|
||||
parent::__construct( $manager, $id, $args );
|
||||
}
|
||||
|
||||
@ -46,8 +49,10 @@ class WP_Customize_New_Menu_Section extends WP_Customize_Section {
|
||||
* Render the section, and the controls that have been added to it.
|
||||
*
|
||||
* @since 4.3.0
|
||||
* @deprecated 4.9.0
|
||||
*/
|
||||
protected function render() {
|
||||
_deprecated_function( __METHOD__, '4.9.0' );
|
||||
?>
|
||||
<li id="accordion-section-<?php echo esc_attr( $this->id ); ?>" class="accordion-section-new-menu">
|
||||
<button type="button" class="button add-new-menu-item add-menu-toggle" aria-expanded="false">
|
||||
|
@ -13,7 +13,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.4-alpha-46636';
|
||||
$wp_version = '5.4-alpha-46637';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user