WordPress.org

Make WordPress Core

Changeset 46637


Ignore:
Timestamp:
11/03/2019 04:46:55 PM (6 weeks ago)
Author:
desrosj
Message:

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.

Location:
trunk/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/wp/customize/nav-menus.js

    r46401 r46637  
    30283028    } );
    30293029
    3030     api.Menus.NewMenuControl = api.Control.extend(/** @lends wp.customize.Menus.NewMenuControl.prototype */{
    3031 
    3032         /**
    3033          * wp.customize.Menus.NewMenuControl
    3034          *
    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.NewMenuControl
    3039          * @augments   wp.customize.Control
    3040          *
    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.0
    3054          */
    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.0
    3079          */
    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 
    31073030    /**
    31083031     * Extends wp.customize.controlConstructor with control constructor for
     
    31143037        nav_menu: api.Menus.MenuControl,
    31153038        nav_menu_name: api.Menus.MenuNameControl,
    3116         new_menu: api.Menus.NewMenuControl, // @todo Remove in a future release. See #42364.
    31173039        nav_menu_locations: api.Menus.MenuLocationsControl,
    31183040        nav_menu_auto_add: api.Menus.MenuAutoAddControl
  • trunk/src/wp-includes/class-wp-customize-manager.php

    r46548 r46637  
    318318        require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-locations-control.php' );
    319319        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.
    321320
    322321        require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menus-panel.php' );
     
    326325        require_once( ABSPATH . WPINC . '/customize/class-wp-customize-sidebar-section.php' );
    327326        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.
    329327
    330328        require_once( ABSPATH . WPINC . '/customize/class-wp-customize-custom-css-setting.php' );
  • trunk/src/wp-includes/class-wp-customize-section.php

    r46133 r46637  
    384384/** WP_Customize_Nav_Menu_Section class */
    385385require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-section.php' );
    386 
    387 /**
    388  * WP_Customize_New_Menu_Section class
    389  *
    390  * As this file is deprecated, it will trigger a deprecation notice if instantiated. In a subsequent
    391  * release, the require_once() here will be removed and _deprecated_file() will be called if file is
    392  * 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' );
  • trunk/src/wp-includes/customize/class-wp-customize-new-menu-control.php

    r44228 r46637  
    88 * @deprecated 4.9.0 This file is no longer used as of the menu creation UX introduced in #40104.
    99 */
     10
     11_deprecated_file( basename( __FILE__ ), '4.9.0' );
    1012
    1113/**
     
    3133     *
    3234     * @since 4.9.0
     35     * @deprecated 4.9.0
    3336     *
    3437     * @param WP_Customize_Manager $manager Manager.
     
    3740     */
    3841    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, and remove its require_once() from class-wp-customize-control.php. See #42364.
     42        _deprecated_function( __METHOD__, '4.9.0' );
    4043        parent::__construct( $manager, $id, $args );
    4144    }
     
    4548     *
    4649     * @since 4.3.0
     50     * @deprecated 4.9.0
    4751     */
    4852    public function render_content() {
     53        _deprecated_function( __METHOD__, '4.9.0' );
    4954        ?>
    5055        <button type="button" class="button button-primary" id="create-new-menu-submit"><?php _e( 'Create Menu' ); ?></button>
  • trunk/src/wp-includes/customize/class-wp-customize-new-menu-section.php

    r44228 r46637  
    88 * @deprecated 4.9.0 This file is no longer used as of the menu creation UX introduced in #40104.
    99 */
     10
     11_deprecated_file( basename( __FILE__ ), '4.9.0' );
    1012
    1113/**
     
    3335     *
    3436     * @since 4.9.0
     37     * @deprecated 4.9.0
    3538     *
    3639     * @param WP_Customize_Manager $manager Customizer bootstrap instance.
     
    3942     */
    4043    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, and remove its require_once() from class-wp-customize-section.php. See #42364.
     44        _deprecated_function( __METHOD__, '4.9.0' );
    4245        parent::__construct( $manager, $id, $args );
    4346    }
     
    4750     *
    4851     * @since 4.3.0
     52     * @deprecated 4.9.0
    4953     */
    5054    protected function render() {
     55        _deprecated_function( __METHOD__, '4.9.0' );
    5156        ?>
    5257        <li id="accordion-section-<?php echo esc_attr( $this->id ); ?>" class="accordion-section-new-menu">
Note: See TracChangeset for help on using the changeset viewer.