Class: MenuItemControl

wp.customize.Menus. MenuItemControl


wp.customize.Menus.MenuItemControl Customizer control for menu items. Note that 'menu_item' must match the WP_Customize_Menu_Item_Control::$type.
Source:

Extends

Members


_toggleExpanded

Since:
  • 4.6.0
Source:

collapse

Since:
  • 4.6.0
Source:

defaults :object

Default params.
Type:
  • object
Since:
  • 4.9.0
Inherited From:
Source:

expand

Since:
  • 4.6.0
Overrides:
Source:

Methods


<private> _changeDepth(offset)

Note that this will trigger a UI update, causing child items to move as well and cardinal order class names to be updated.
Parameters:
Name Type Description
offset Number 1|-1
Source:

<private> _changePosition(offset)

Note that this will trigger a UI update, causing child items to move as well and cardinal order class names to be updated.
Parameters:
Name Type Description
offset Number 1|-1
Source:

_setupControlToggle()

Show/hide the settings when clicking on the menu item handle.
Source:

_setupRemoveUI()

Set up event handlers for menu item deletion.
Source:

_setupReorderUI()

Set up the menu-item-reorder-nav
Source:

_setupTitleUI()

Update item handle title when changed.
Source:

_setupUpdateUI()

Set up event handlers for menu item updating.
Source:

actuallyEmbed()

This function is called in Section.onChangeExpanded() so the control will only get embedded when the Section is first expanded.
Since:
  • 4.3.0
Source:

<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

collapseForm( [params])

Collapse the menu item form control.
Parameters:
Name Type Argument Description
params Object <optional>
Optional params.
Properties
Name Type Argument Description
completeCallback function <optional>
Function to call when the form toggle has finished animating.
Since:
  • 4.5.0 Added params.completeCallback.
Source:

embed()

Override the embed() method to do nothing, so that the control isn't embedded on load, unless the containing section is already expanded.
Since:
  • 4.3.0
Overrides:
Source:

expandControlSection()

Expand the accordion section containing a control
Source:

expandForm( [params])

Expand the menu item form control.
Parameters:
Name Type Argument Description
params Object <optional>
Optional params.
Properties
Name Type Argument Description
completeCallback function <optional>
Function to call when the form toggle has finished animating.
Since:
  • 4.5.0 Added params.completeCallback.
Source:

focus( [params])

Expand the containing menu section, expand the form, and focus on the first input in the control.
Parameters:
Name Type Argument Description
params Object <optional>
Params object.
Properties
Name Type Argument Description
completeCallback function <optional>
Optional callback function when focus has completed.
Since:
  • 4.5.0 Added params.completeCallback.
Source:

getDepth()

Source:
Returns:
Type
number

getMenuControl()

Source:
Returns:
Type
wp.customize.controlConstructor.nav_menu | null

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

moveDown()

Move menu item up one in the menu.
Source:

moveLeft()

Move menu item and all children up one level of depth.
Source:

moveRight()

Move menu item and children one level deeper, as a submenu of the previous item.
Source:

moveUp()

Move menu item up one in the menu.
Source:

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:

onChangeExpanded( [showOrHide] [, params])

Expand or collapse the menu item control.
Parameters:
Name Type Argument Description
showOrHide boolean <optional>
If not supplied, will be inverse of current visibility
params Object <optional>
Optional params.
Properties
Name Type Argument Description
completeCallback function <optional>
Function to call when the form toggle has finished animating.
Since:
  • 4.6.0
Source:

ready()

Set up the control.
Overrides:
Source:

renderContent()

Amend the control's params with the data necessary for the JS template just in time.
Overrides:
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:

toggleForm( [showOrHide] [, params])

Expand or collapse the menu item control.
Parameters:
Name Type Argument Description
showOrHide boolean <optional>
If not supplied, will be inverse of current visibility
params Object <optional>
Optional params.
Properties
Name Type Argument Description
completeCallback function <optional>
Function to call when the form toggle has finished animating.
Since:
  • 4.5.0 Added params.completeCallback.
Deprecated:
  • this is poor naming, and it is better to directly set control.expanded( showOrHide )
Source: