#32576 closed feature request (fixed)
Add Menu management to the Customizer
Reported by: | celloexpressions | Owned by: | |
---|---|---|---|
Milestone: | 4.3 | Priority: | normal |
Severity: | normal | Version: | 4.3 |
Component: | Customize | Keywords: | |
Focuses: | javascript | Cc: |
Description
Merge the Menu Customizer plugin, per the proposal and tentative approval in the 6/3 dev chat.
Until merge, issues are being tracked on GitHub. Everything on the 1.0 milestone should be fixed before merge. Everything on the "Core Merge" milestone should be fixed in the core merge patch. Unfortunately we've realized that the remaining larger issues require core patches, which @westonrtuer and @adamsilverstein are working on.
In the meantime, here's a tentative merge plan for the code:
- class-wp-customize-menus.php -> wp-includes/class-wp-customize-menus.php
- customize-menus-preview.js -> Not sure, @westonruter?
- customize-menus-preview.css -> Not sure, @westonruter? Might want to name it as just customize-preview.css to more logically add stuff there in the future, since there's so little here.
- menu-customize-controls.php -> split into wp-includes/class-wp-customize-control|section|panel.php, adding the custom menu objects after all of the existing main objects and subclasses.
- menu-customizer.css -> wp-admin/css/customize-menus.css
- menu-customizer.js -> wp-admin/js/customize-menus.js
- menu-customizer.php -> add menus bootstrap to wp-includes/class-wp-customize-manager.php::__construct()
The actual file-moving and patching should wait until the last minute and be merged with the required core patches for settings refactoring, drag & drop, Twenty Fifteen compatibility, and link updating. We'll do a hard freeze on the GitHub repo once we're ready to patch-ify the plugin, likely mid-week this week.
Also cc @valendesigns, @voldemortensen, @designsimply, @folletto, @ocean90 since many of you may not follow this component.
Attachments (10)
Change History (45)
@celloexpressions — 3 months ago
comment:1 @celloexpressions — 3 months ago
The easiest of the four non-plugin-merging core patches required is 32576.link-updates.diff, which handles the admin bar and "Manage in Customize" link on nav-menus.php. Note that all of the "Appearance" links in the admin bar now deep-link to the Customizer. I suggest condensing those to a single top-level "Customize" link in a future release (probably 4.4), and putting something more useful in this valuable place.
Additional needed patches will be:
- Twenty Fifteen compatibility fix
- Drag & Drop submenus core patch
- Settings refactoring core patch (adds a filter I believe)
- Unit tests, if not included in the main plugin-merging part
- Plugin-merging patch, which does what I described above in terms of merging the files in
Eventually these will all be combined into one massive patch for committing, but I'd like to keep them as distinct as we can until we're ready to prepare that.
comment:2 @slackbot — 3 months ago
This ticket was mentioned in Slack in #core-customize by celloexpressions. View the logs.
comment:3 @celloexpressions — 3 months ago
See also https://core.trac.wordpress.org/ticket/28138#comment:3 for something we should fix before/on merge. Could use a new patch that takes exactly what Menu Customizer does, as I believe it changed somewhat.
comment:4 @westonruter — 3 months ago
In 32744:
comment:5 @westonruter — 3 months ago
Opened #32628 for the change needed to wp.ajax.post.
comment:6 @westonruter — 3 months ago
Opened #32629 for introduction of pre_get_term filter.
comment:7 @westonruter — 3 months ago
Opened #32630 with patch for has_nav_menu filter.
comment:8 @westonruter — 3 months ago
Opened #32631 with patch to ensure that wp_get_nav_menu_items filter will apply even when the menu has no initial items.
comment:9 @westonruter — 3 months ago
Opened #32632 with patch to update wp_setup_nav_menu_item() so that it will not clobber supplied $menu_item properties that are empty.
comment:10 @westonruter — 3 months ago
Opened #32633 with patch to allow wpNavMenu to have its sortable items selector to be configured.
@westonruter — 3 months ago
Additional Core changes needed for Menu Customizer from https://github.com/xwp/wordpress-develop/pull/91/files
comment:11 @azaozz — 3 months ago
32576.menu-customizer-core-misc.diff looks good.
comment:12 @ocean90 — 3 months ago
In 32763:
comment:13 @ocean90 — 3 months ago
In 32806:
comment:14 @folletto — 3 months ago
Awesome! :)
comment:15 @ocean90 — 3 months ago
In 32807:
comment:16 @ocean90 — 3 months ago
- Component changed from Menus to Customize
@greenshady — 3 months ago
comment:17 follow-up: ↓ 20 @greenshady — 3 months ago
With one of my themes that has a hidden menu by default, the menu is opened and messes up the entire design with the change (screenshot attached). This seems to happen because of the addition of the following code (added via JS?):
<div id="partial-refresh-menu-container-1" class="partial-refresh-menu-container" data-instance-number="1">
I've already figured out how to correct this on my end, but I imagine there'll be other themes with similar issues. Injecting an additional <div> has potential to cause some unintended consequences with theme designs.
comment:18 @valendesigns — 3 months ago
That code is added by WP_Customize_Menus::filter_wp_nav_menu() under certain conditions when a menu can be partially refreshed. If you want to hack it so it works without partial refresh you could set echo to false when you use wp_nav_menu and then echo the menu manually.
comment:19 @ocean90 — 3 months ago
In 32808:
comment:20 in reply to: ↑ 17 ; follow-up: ↓ 22 @westonruter — 3 months ago
Replying to greenshady:
With one of my themes that has a hidden menu by default, the menu is opened and messes up the entire design with the change (screenshot attached). This seems to happen because of the addition of the following code (added via JS?):
<div id="partial-refresh-menu-container-1" class="partial-refresh-menu-container" data-instance-number="1">I've already figured out how to correct this on my end, but I imagine there'll be other themes with similar issues. Injecting an additional <div> has potential to cause some unintended consequences with theme designs.
Instead of wrapping the menu with a div when wp_nav_menu is called, we could maybe add those attributes directly onto the root element that would be output.
comment:21 @valendesigns — 3 months ago
That would probably be better.
comment:22 in reply to: ↑ 20 @greenshady — 3 months ago
Replying to westonruter:
Replying to greenshady:
With one of my themes that has a hidden menu by default, the menu is opened and messes up the entire design with the change (screenshot attached). This seems to happen because of the addition of the following code (added via JS?):
<div id="partial-refresh-menu-container-1" class="partial-refresh-menu-container" data-instance-number="1">I've already figured out how to correct this on my end, but I imagine there'll be other themes with similar issues. Injecting an additional <div> has potential to cause some unintended consequences with theme designs.
Instead of wrapping the menu with a div when wp_nav_menu is called, we could maybe add those attributes directly onto the root element that would be output.
I tested by live-editing the HTML on my test install. That idea seems to fix the issue for me.
comment:23 @iseulde — 3 months ago
In 32815:
comment:24 @celloexpressions — 3 months ago
@ocean90 @westonruter 32576.link-updates.diff should be ready for commit now.
Since this is a tracking ticket, let's make new tickets for new issues, and try to keep this ticket focused on any remaining merge-specific things (with commits and new tickets referencing this as well).
comment:25 @obenland — 3 months ago
In 32855:
comment:26 @ocean90 — 3 months ago
In 32887:
comment:27 @ocean90 — 3 months ago
In 32888:
comment:28 @ocean90 — 3 months ago
In 32892:
comment:29 @ocean90 — 3 months ago
In 32893:
comment:30 @ocean90 — 3 months ago
In 32895:
comment:31 @celloexpressions — 3 months ago
- Focuses javascript added
- Resolution set to fixed
- Status changed from new to closed
Things are going pretty smoothly here, with tons and tons of community-generated tickets and patches being reviewed and committed since the initial merge. Going to close this ticket out for now as it looks like we've sorted out all of the merge-specific issues or moved them to distinct tickets.
comment:32 @ocean90 — 2 months ago
In 33163:
comment:33 @ocean90 — 2 months ago
In 33164:
comment:34 @ocean90 — 2 months ago
In 33167:
comment:35 @SergeyBiryukov — 2 weeks ago
In 33859:
Point admin bar link to menus in the Customizer, add a manage in Customizer link to nav-menus.php.