Make WordPress Core

Ticket #42364: 42364-refreshed.patch

File 42364-refreshed.patch, 8.5 KB (added by jrf, 5 years ago)

Renewed patch.

  • src/js/_enqueues/wp/customize/nav-menus.js

    From 6d1fa3af2eea37db521f8569e5d92c02bebee2b8 Mon Sep 17 00:00:00 2001
    From: jrfnl <jrfnl@users.noreply.github.com>
    Date: Sun, 6 Oct 2019 03:03:21 +0200
    Subject: [PATCH] 42364: Follow up patch
    
    ---
     src/js/_enqueues/wp/customize/nav-menus.js    | 78 -------------------
     .../class-wp-customize-manager.php            |  2 -
     .../class-wp-customize-section.php            | 11 ---
     .../class-wp-customize-new-menu-control.php   |  5 +-
     .../class-wp-customize-new-menu-section.php   |  5 +-
     5 files changed, 8 insertions(+), 93 deletions(-)
    
    diff --git a/src/js/_enqueues/wp/customize/nav-menus.js b/src/js/_enqueues/wp/customize/nav-menus.js
    index e92104aa14..19f0d2060f 100644
    a b  
    30273027                }
    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
    31093032         * menu_location, menu_item, nav_menu, and new_menu.
     
    31133036                nav_menu_item: api.Menus.MenuItemControl,
    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
    31193041        });
  • 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 d1cde4ae43..d7d5e0d773 100644
    a b final class WP_Customize_Manager { 
    317317                require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-name-control.php' );
    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' );
    323322
    final class WP_Customize_Manager { 
    325324                require_once( ABSPATH . WPINC . '/customize/class-wp-customize-themes-section.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' );
    331329                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 26313a7401..57cc8d3bff 100644
    a b require_once( ABSPATH . WPINC . '/customize/class-wp-customize-sidebar-section.p 
    383383
    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' );
  • 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
    index ecd164c7cb..8c123f6dbf 100644
    a b  
    88 * @deprecated 4.9.0 This file is no longer used as of the menu creation UX introduced in #40104.
    99 */
    1010
     11_deprecated_file( basename( __FILE__ ), '4.9.0' );
     12
    1113/**
    1214 * Customize control class for new menus.
    1315 *
    class WP_Customize_New_Menu_Control extends WP_Customize_Control { 
    3638         * @param array                $args    Args.
    3739         */
    3840        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.
     41                _deprecated_function( __METHOD__, '4.9.0' );
    4042                parent::__construct( $manager, $id, $args );
    4143        }
    4244
    class WP_Customize_New_Menu_Control extends WP_Customize_Control { 
    4648         * @since 4.3.0
    4749         */
    4850        public function render_content() {
     51                _deprecated_function( __METHOD__, '4.9.0' );
    4952                ?>
    5053                <button type="button" class="button button-primary" id="create-new-menu-submit"><?php _e( 'Create Menu' ); ?></button>
    5154                <span class="spinner"></span>
  • 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
    index 28d9015c9f..dfe2e48cf2 100644
    a b  
    88 * @deprecated 4.9.0 This file is no longer used as of the menu creation UX introduced in #40104.
    99 */
    1010
     11_deprecated_file( basename( __FILE__ ), '4.9.0' );
     12
    1113/**
    1214 * Customize Menu Section Class
    1315 *
    class WP_Customize_New_Menu_Section extends WP_Customize_Section { 
    3840         * @param array                $args    Section arguments.
    3941         */
    4042        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.
     43                _deprecated_function( __METHOD__, '4.9.0' );
    4244                parent::__construct( $manager, $id, $args );
    4345        }
    4446
    class WP_Customize_New_Menu_Section extends WP_Customize_Section { 
    4850         * @since 4.3.0
    4951         */
    5052        protected function render() {
     53                _deprecated_function( __METHOD__, '4.9.0' );
    5154                ?>
    5255                <li id="accordion-section-<?php echo esc_attr( $this->id ); ?>" class="accordion-section-new-menu">
    5356                        <button type="button" class="button add-new-menu-item add-menu-toggle" aria-expanded="false">