new MenuSection()
wp.customize.Menus.MenuSection
Customizer section for menus. This is used only for lazy-loading child controls.
Note that 'nav_menu' must match the WP_Customize_Menu_Section::$type.
Extends
Methods
-
<private> _animateChangeExpanded(completeCallback)
-
Animate container state change if transitions are supported by the browser.
Parameters:
Name Type Description completeCallback
function Function to be called after transition is completed. - Since:
-
- 4.7.0
- Inherited From:
- Source:
Returns:
- Type
- void
-
_children(parentType, childType)
-
Get the child models associated with this parent, sorting them by their priority Value.
Parameters:
Name Type Description parentType
String childType
String - Since:
-
- 4.1.0
- Inherited From:
- Source:
Returns:
- Type
- Array
-
_toggleActive(active [, params])
-
Parameters:
Name Type Argument Description active
Boolean params
Object <optional>
- Since:
-
- 4.1.0
- Inherited From:
- Source:
Returns:
False if state already applied.- Type
- Boolean
-
_toggleExpanded(expanded [, params])
-
Handle the toggle logic for expand/collapse.
Parameters:
Name Type Argument Description expanded
Boolean The new state to apply. params
Object <optional>
Object containing options for expand/collapse. Properties
Name Type Argument Description completeCallback
function <optional>
Function to call when expansion/collapse is complete. - Inherited From:
- Source:
Returns:
False if state already applied or active state is false.- Type
- Boolean
-
activate( [params])
-
Parameters:
Name Type Argument Description params
Object <optional>
- Inherited From:
- Source:
Returns:
False if already active.- Type
- Boolean
-
attachEvents()
-
Add behaviors for the accordion section.
- Since:
-
- 4.1.0
- Inherited From:
- Source:
-
collapse( [params])
-
Parameters:
Name Type Argument Description params
Object <optional>
- Inherited From:
- Source:
Returns:
False if already collapsed.- Type
- Boolean
-
controls()
-
Get the controls that are associated with this section, sorted by their priority Value.
- Since:
-
- 4.1.0
- Inherited From:
- Source:
Returns:
- Type
- Array
-
deactivate( [params])
-
Parameters:
Name Type Argument Description params
Object <optional>
- Inherited From:
- Source:
Returns:
False if already inactive.- Type
- Boolean
-
embed()
-
Embed the container in the DOM when any parent panel is ready.
- Since:
-
- 4.1.0
- Inherited From:
- Source:
-
expand( [params])
-
Parameters:
Name Type Argument Description params
Object <optional>
- Inherited From:
- Source:
Returns:
False if already expanded or if inactive.- Type
- Boolean
-
getContainer()
-
Return the container html, generated from its JS template, if it exists.
- Since:
-
- 4.3.0
- Inherited From:
- Source:
-
getContent()
-
Find content element which is displayed when the section is expanded. After a construct is initialized, the return value will be available via the `contentContainer` property. By default the element will be related it to the parent container with `aria-owns` and detached. Custom panels and sections (such as the `NewMenuSection`) that do not have a sliding pane should just return the content element without needing to add the `aria-owns` element or detach it from the container. Such non-sliding pane custom sections also need to override the `onChangeExpanded` method to handle animating the panel/section into and out of view.
- Since:
-
- 4.7.0
- Inherited From:
- Source:
Returns:
Detached content element.- Type
- jQuery
-
getNotificationsContainerElement()
-
Get the element that will contain the notifications.
- Since:
-
- 4.9.0
- Inherited From:
- Source:
Returns:
Notification container element.- Type
- jQuery
-
highlightNewItemButton()
-
Highlight how a user may create new menu items. This method reminds the user to create new menu items and how. It's exposed this way because this class knows best which UI needs highlighted but those expanding this section know more about why and when the affordance should be highlighted.
- Since:
-
- 4.9.0
- Source:
Returns:
- Type
- void
-
initialize(id, options)
-
Initialize.
Parameters:
Name Type Description id
String options
Object - Since:
-
- 4.3.0
- Source:
-
isContextuallyActive()
-
Return whether this section has any active controls.
- Since:
-
- 4.1.0
- Inherited From:
- Source:
Returns:
- Type
- Boolean
-
onChangeActive(active [, args])
-
Active state change handler. Shows the container if it is active, hides it if not. To override by subclass, update the container's UI to reflect the provided active state.
Parameters:
Name Type Argument Description active
boolean The active state to transiution to. args
Object <optional>
Args. Properties
Name Type Argument Description duration
Object <optional>
The duration for the slideUp/slideDown animation. unchanged
boolean <optional>
Whether the state is already known to not be changed, and so short-circuit with calling completeCallback early. completeCallback
function <optional>
Function to call when the slideUp/slideDown has completed. - Since:
-
- 4.1.0
- Inherited From:
- Source:
-
onChangeExpanded(expanded, args)
-
Update UI to reflect expanded state.
Parameters:
Name Type Description expanded
Boolean args
Object - Since:
-
- 4.1.0
- Inherited From:
- Overrides:
- Source:
-
ready()
-
Ready.
- Overrides:
- Source:
-
refreshAssignedLocations()
-
setupNotifications()
-
Set up notifications.
- Since:
-
- 4.9.0
- Inherited From:
- Source:
Returns:
- Type
- void
-
updateAssignedLocationsInSectionTitle(themeLocationSlugs)
-
Parameters:
Name Type Description themeLocationSlugs
Array Theme location slugs.