Class: SidebarPartial

wp.customize.widgetsPreview. SidebarPartial


new SidebarPartial(id, options)

Represents a partial widget area.
Parameters:
Name Type Description
id string The partial's ID.
options Object Options used to initialize the partial's instance.
Properties
Name Type Description
params Object The options parameters.
Since:
  • 4.5.0
Source:

Extends

Methods


ensureWidgetPlacementContainers(widgetId)

Makes sure there is a widget instance container in this sidebar for the given widget ID.
Parameters:
Name Type Description
widgetId string The widget ID.
Since:
  • 4.5.0
Source:
Returns:
The widget instance partial.
Type
wp.customize.selectiveRefresh.Partial

findDynamicSidebarBoundaryNodes()

Gets the before/after boundary nodes for all instances of this sidebar (usually one). Note that TreeWalker is not implemented in IE8.
Since:
  • 4.5.0
Source:
Returns:
An array with an object for each sidebar instance, containing the node before and after the sidebar instance and its instance number.
Type
Array:.<{before:: Comment:, after:: Comment:, instanceNumber:: number:}>

getWidgetIds()

Get the list of widget IDs associated with this widget area.
Since:
  • 4.5.0
Source:
Throws:
  • If there's no settingId.
    Type
    Error
  • If the setting doesn't exist in the API.
    Type
    Error
  • If the API doesn't pass an array of widget ids.
    Type
    Error
Returns:
A shallow copy of the array containing widget IDs.
Type
Array

handleSettingChange(newWidgetIds, oldWidgetIds)

Handles changes to the sidebars_widgets[] setting.
Parameters:
Name Type Description
newWidgetIds Array New widget IDs.
oldWidgetIds Array Old widget IDs.
Since:
  • 4.5.0
Source:
Returns:
Type
void

placements()

Gets the placements for this partial.
Since:
  • 4.5.0
Source:
Returns:
An array containing placement objects for each of the dynamic sidebar boundary nodes.
Type
Array

ready()

Sets up the partial.
Since:
  • 4.5.0
Source:
Returns:
Type
void

reflowWidgets()

Reflows widgets in the sidebar, ensuring they have the proper position in the DOM.
Since:
  • 4.5.0
Source:
Returns:
List of placements that were reflowed.
Type
Array:.<wp.customize.selectiveRefresh.Placement:>

refresh()

Refreshes the sidebar partial. Note that the meat is handled in handleSettingChange because it has the context of which widgets were removed.
Since:
  • 4.5.0
Source:
Returns:
A promise postponing the refresh.
Type
Promise