new MenuControl()
wp.customize.Menus.MenuControl
Customizer control for menus.
Note that 'nav_menu' must match the WP_Menu_Customize_Control::$type
Extends
Members
-
debouncedReflowMenuItems
-
Note that this function gets debounced so that when a lot of setting changes are made at once, for instance when moving a menu item that has child items, this function will only be called once all of the settings have been updated.
-
defaults :object
-
Default params.
Type:
- object
- Since:
-
- 4.9.0
- Inherited From:
- Source:
Methods
-
_setupAddition()
-
Set up UI for adding a new menu item.
-
_setupModel()
-
Update ordering of menu item controls when the setting is updated.
-
_setupSortable(menuList)
-
Allow items in each menu to be re-ordered, and for the order to be previewed. Notice that the UI aspects here are handled by wpNavMenu.initSortables() which is called in MenuSection.onChangeExpanded()
Parameters:
Name Type Description menuList
object The element that has sortable(). -
_setupTitle()
-
Update Section Title as menu name is changed.
-
addItemToMenu(item)
-
Add a new item to this menu.
Parameters:
Name Type Description item
object Value for the nav_menu_item setting to be created. Returns:
The newly-created nav_menu_item control instance.- Type
- wp.customize.Menus.controlConstructor.nav_menu_item
-
<private> addNewPage()
-
Add a new page to a dropdown-pages control reusing menus code for this.
- Since:
-
- 4.7.0
- Inherited From:
- Source:
Returns:
- Type
- void
-
embed()
-
Embed the control into the page.
- Inherited From:
- Source:
-
expand( [params])
-
Normal controls do not expand, so just expand its parent
Parameters:
Name Type Argument Description params
Object <optional>
- Inherited From:
- Source:
-
getMenuItemControls()
-
Returns:
-
getNotificationsContainerElement()
-
Get the element inside of a control's container that contains the validation error message. Control subclasses may override this to return the proper container to render notifications into. Injects the notification container for existing controls that lack the necessary container, including special handling for nav menu items and widgets.
- Since:
-
- 4.6.0
- Inherited From:
- Source:
Returns:
Setting validation message element.- Type
- jQuery
-
linkElements()
-
Link elements between settings and inputs.
- Since:
-
- 4.7.0
- Inherited From:
- Source:
Returns:
- Type
- void
-
onChangeActive(active, args)
-
Update UI in response to a change in the control's active state. This does not change the active state, it merely handles the behavior for when it does change.
Parameters:
Name Type Description active
Boolean args
Object Properties
Name Type Description duration
Number completeCallback
function - Since:
-
- 4.1.0
- Inherited From:
- Source:
-
ready()
-
Set up the control.
- Overrides:
- Source:
-
reflowMenuItems()
-
Make sure that each menu item control has the proper depth.
-
renderContent()
-
Render the control from its JS template, if it exists. The control's container must already exist in the DOM.
- Since:
-
- 4.1.0
- Inherited From:
- Source:
-
renderNotifications()
-
Render notifications. Renders the `control.notifications` into the control's container. Control subclasses may override this method to do their own handling of rendering notifications.
This:
- Since:
-
- 4.6.0
- Inherited From:
- Deprecated:
-
- in favor of `control.notifications.render()`
- Source:
-
setupNotifications()
-
Set up notifications.
- Since:
-
- 4.9.0
- Inherited From:
- Source:
Returns:
- Type
- void
-
toggle()
-
- Inherited From:
- Deprecated:
-
- 4.1.0 Use this.onChangeActive() instead.
- Source:
-
toggleReordering(showOrHide)
-
Enable/disable the reordering UI
Parameters:
Name Type Description showOrHide
Boolean to enable/disable reordering -
updateInvitationVisibility(optionalMenuItemControls)
-
Show an invitation to add new menu items when there are no menu items.
Parameters:
Name Type Description optionalMenuItemControls
Array:.<wp.customize.controlConstructor.nav_menu_item:> - Since:
-
- 4.9.0
- Source: