[wp-trac] [WordPress Trac] #42357: NewMenuControl class has been removed from trunk

WordPress Trac noreply at wordpress.org
Sat Oct 28 00:10:14 UTC 2017


#42357: NewMenuControl class has been removed from trunk
--------------------------------------+-----------------------
 Reporter:  herregroen                |       Owner:  bpayton
     Type:  defect (bug)              |      Status:  assigned
 Priority:  normal                    |   Milestone:  4.9
Component:  Customize                 |     Version:  trunk
 Severity:  normal                    |  Resolution:
 Keywords:  needs-dev-note has-patch  |     Focuses:
--------------------------------------+-----------------------
Changes (by westonruter):

 * keywords:  needs-patch needs-dev-note => needs-dev-note has-patch
 * priority:  high => normal


Comment:

 I finished grepping the theme and plugin directories and there are no
 results outside of the original Menu Customizer plugin where these were
 first introduced:

 {{{
 WordPress-Plugin-Directory-Slurper/plugins/menu-customizer/class-wp-
 customize-menus.php:505:WP_Customize_New_Menu_Section
 WordPress-Plugin-Directory-Slurper/plugins/menu-customizer/class-wp-
 customize-new-menu-section.php:14:WP_Customize_New_Menu_Section
 WordPress-Plugin-Directory-Slurper/plugins/menu-customizer/menu-
 customizer.js:809:WP_Customize_New_Menu_Section
 WordPress-Plugin-Directory-Slurper/plugins/menu-customizer/menu-
 customizer.js:2134:NewMenuControl
 WordPress-Plugin-Directory-Slurper/plugins/menu-customizer/menu-
 customizer.js:2142:NewMenuControl
 WordPress-Plugin-Directory-Slurper/plugins/menu-customizer/menu-
 customizer.js:2234:NewMenuControl
 }}}

 So clearly there little to none in terms of plugins that directly
 interface with these APIs. The reference to
 `wp.customize.Menus.NewMenuControl.prototype.submit` in the WPSE answer
 was just advising to refer to the source for a plugin to copy/adapt for
 their own needs, not to actually call it themselves.

 So what we'll do is this:

 1. Restore the class in JS but mark it as deprecated, also adding a
 `console.warn()`.
 2. Introduce a new `wp.customize.Menus.createNavMenu()` API for core and
 plugins to use; this separates UI code from model code.
 3. Restore the `require_once()`'ing of `class-wp-customize-new-menu-
 control.php` but add a `_deprecated_file()` call to its constructor.
 4. Also mark `class-wp-customize-new-menu-section.php` as being
 deprecated.
 5. In 5.0 we will move the `_deprecated_file()` call to the file header
 itself, and remove the `require_once()`.
 6. A dev note will be published by @bpayton to document the new nav menu
 UX as well as the API canges.
 7. Unit tests for the nav menu JS classes will be added by @bpayton next
 week.

 See https://github.com/xwp/wordpress-develop/pull/295

--
Ticket URL: <https://core.trac.wordpress.org/ticket/42357#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list