[wp-trac] [WordPress Trac] #32708: Customizer Menus: add hooks to the WP_Customize_Nav_Menus class so it can be extended
WordPress Trac
noreply at wordpress.org
Thu Jul 23 07:41:26 UTC 2015
#32708: Customizer Menus: add hooks to the WP_Customize_Nav_Menus class so it can
be extended
-------------------------------------+---------------------------
Reporter: imath | Owner: valendesigns
Type: defect (bug) | Status: closed
Priority: normal | Milestone: 4.3
Component: Customize | Version: trunk
Severity: normal | Resolution: fixed
Keywords: has-patch needs-testing | Focuses:
-------------------------------------+---------------------------
Comment (by Chouby):
Hi!
Thank you for fixing this ticket. It should help plugins adding custom
menu items. However by default we get a standard form, and I don't see how
to customize it.
Currently, in Polylang, I have a custom menu item with a custom form.
Rendering the form can be achieved either by using the
'wp_edit_nav_menu_walker filter' or JS. I use the second as the first is
subject to conflicts with other plugins. Saving the user input is
obviously done in a function hooked to the action
'wp_update_nav_menu_item'.
Now I am trying to include this custom menu item in the customizer menus
and hopefully to be ready for the final release of WP 4.3, but I am
lacking basic comprehension of the internals of the customizer menus.
Adding the menu item using the filters provided by this ticket was
straightforward. I have two issues:
1. Rendering the form is not as obvious for me. In Appearance->menus, I do
it binding a function to the click events on the form 'update-nav-menu'.
Here I tried the same approach using the form 'customize-controls' but for
some reason, this does not react on clicks when we are adding a menu item
(thus this works for pre-existing items, not the newly added ones).
2. Of course, changes to the form are not propagated to the preview and
worse, the 'wp_update_nav_menu_item' is not fired when I click on save and
publish (for what I understood, the action is fired only for modified
items, but currently my custom form does not inform the customizer of its
changes).
Is there a documentation somewhere which explains the internals of the
customizer menus?
How the form is created when adding a new item? Do we need a new filter to
customize the form?
How to propagate changes to the preview and save them to the DB?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/32708#comment:30>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list