#42357 closed defect (bug) (fixed)
NewMenuControl class has been removed from trunk
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.9 | Priority: | normal |
Severity: | normal | Version: | 4.9 |
Component: | Customize | Keywords: | has-patch |
Focuses: | Cc: |
Description (last modified by )
In the recent changes to src/wp-admin/js/customize-nav-menus.js
the NewMenuControl
seems to have been removed.
This seems to be the revision in which it was removed: https://core.trac.wordpress.org/browser/trunk/src/wp-admin/js/customize-nav-menus.js?rev=41768.
Considering the revision message mentions nothing about removing said class and there are no deprecation notices in the previous revision ( https://core.trac.wordpress.org/browser/trunk/src/wp-admin/js/customize-nav-menus.js?rev=41726 ) this is probably a mistake I would guess?
I felt it probably best to open a ticket since it seems weird for a class to be removed without any deprecation warnings or clear notice.
Introduced in #40104.
Change History (14)
#2
@
7 years ago
I'm almost certain this is a mistake considering the following stack overflow message by @westonruter of said revision:
https://wordpress.stackexchange.com/questions/282671/location-of-customizer-menu-panel-core-code
#3
in reply to:
↑ 1
@
7 years ago
Replying to adamsilverstein:
@herregroen Thanks for the ticket - perhaps @westonruter has a better understanding of why this was removed (or is it renamed?). Curious how you realized this, did it break something you built that uses it?
I'm working on namespacing all documentation in the admin directory and was almost done and trying to merge in the recent changes.
I got a merge conflict on this change it didn't seem right for that class to be removed.
#5
@
7 years ago
- Description modified (diff)
- Keywords needs-patch added
- Milestone changed from Awaiting Review to 4.9
- Owner set to bpayton
- Status changed from new to assigned
@bpayton We need to find a way to not remove the class to add back-compat.
This ticket was mentioned in Slack in #core-customize by westonruter. View the logs.
7 years ago
This ticket was mentioned in Slack in #core-customize by bpayton. View the logs.
7 years ago
#9
@
7 years ago
- Keywords needs-dev-note added
There are 3 references to the NewMenuControl
JS class on GitHub, but 1 is a match from core and 2 are from the feature original feature plugin so now obsolete: https://github.com/search?q=NewMenuControl+-filename%3Acustomize-nav-menus.js+language%3Ajavascript&type=Code
There are 10 possible references to the WP_Customize_New_Menu_Section
PHP class on GitHub, but all of them seem to be related to either autoloading or malware scanning: https://github.com/search?utf8=%E2%9C%93&q=WP_Customize_New_Menu_Section+-filename%3Aclass-wp-customize-nav-menus.php+-filename%3Aclass-wp-customize-new-menu-section.php+-filename%3Aclass-wp-customize-section.php+language%3Aphp&type=Code
Similarly, there are 9 possible references to WP_Customize_New_Menu_Control
but they are also either for autoloading or malware scanning: https://github.com/search?utf8=%E2%9C%93&q=WP_Customize_New_Menu_Control+-filename%3Aclass-wp-customize-control.php+-filename%3Aclass-wp-customize-new-menu-control.php+-filename%3Aclass-wp-customize-nav-menus.php+language%3Aphp&type=Code
I'm still running the ack
on the plugin and theme directories for these classes.
#10
@
7 years ago
I have a fix in progress here and have been discussing the proper course of action with @westonruter .
https://github.com/xwp/wordpress-develop/pull/295
I'll upload a patch once we've settled on what is needed.
#11
@
7 years ago
- Keywords has-patch added; needs-patch removed
- Priority changed from high to normal
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:
- Restore the class in JS but mark it as deprecated, also adding a
console.warn()
. - Introduce a new
wp.customize.Menus.createNavMenu()
API for core and plugins to use; this separates UI code from model code. - Restore the
require_once()
'ing ofclass-wp-customize-new-menu-control.php
but add a_deprecated_file()
call to its constructor. - Also mark
class-wp-customize-new-menu-section.php
as being deprecated. - In 5.0 we will move the
_deprecated_file()
call to the file header itself, and remove therequire_once()
. - A dev note will be published by @bpayton to document the new nav menu UX as well as the API canges.
- Unit tests for the nav menu JS classes will be added by @bpayton next week.
#12
@
7 years ago
I'm not sure if it's necessary to maintain back-compat for this given the lack of use; however, deprecating and fully removing in 5.0 seems appropriate. The full removal plan should be mentioned in the dev note.
The PR looks good, with a couple possible inline doc tweaks noted there.
@herregroen Thanks for the ticket - perhaps @westonruter has a better understanding of why this was removed (or is it renamed?). Curious how you realized this, did it break something you built that uses it?