new WidgetControl()
wp.customize.Widgets.WidgetControl
Customizer control for widgets.
Note that 'widget_form' must match the WP_Widget_Form_Customize_Control::$type
- Since:
-
- 4.1.0
- Source:
Extends
Members
-
_toggleExpanded
-
- Since:
-
- 4.1.0
- Source:
-
collapse
-
- Since:
-
- 4.1.0
- Source:
-
defaults :object
-
Default params.
Type:
- object
- Since:
-
- 4.9.0
- Inherited From:
- Source:
-
expand
-
- Since:
-
- 4.1.0
- Overrides:
- Source:
Methods
-
<private> _getInputs(container)
-
Find all inputs in a widget container that should be considered when comparing the loaded form with the sanitized form, whose fields will be aligned to copy the sanitized over. The elements returned by this are passed into this._getInputsSignature(), and they are iterated over when copying sanitized values over to the form loaded.
Parameters:
Name Type Description containerjQuery element in which to look for inputs Returns:
inputs- Type
- jQuery
-
<private> _getInputsSignature(inputs)
-
Iterate over supplied inputs and create a signature string for all of them together. This string can be used to compare whether or not the form has all of the same fields.
Parameters:
Name Type Description inputsjQuery Returns:
- Type
- string
-
<private> _getInputState(input)
-
Get the state for an input depending on its type.
Parameters:
Name Type Description inputjQuery | Element Returns:
- Type
- string | boolean | array | *
-
<private> _moveWidgetByOne(offset)
-
Parameters:
Name Type Description offsetNumber 1|-1 -
<private> _setInputState(input, state)
-
Update an input's state based on its type.
Parameters:
Name Type Description inputjQuery | Element statestring | boolean | array | * -
_setupControlToggle()
-
Show/hide the control when clicking on the form title, when clicking the close button
-
_setupHighlightEffects()
-
Highlight widgets in preview when interacted with in the Customizer
-
_setupModel()
-
Handle changes to the setting
-
_setupRemoveUI()
-
Set up event handlers for widget removal
-
_setupReorderUI()
-
Set up the widget-reorder-nav
-
_setupUpdateUI()
-
Set up event handlers for widget updating
-
_setupWideWidget()
-
Add special behaviors for wide widget controls
-
_setupWidgetTitle()
-
Update the title of the form if a title field is entered
-
<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()
-
Collapse the widget form control
- Deprecated:
-
- 4.1.0 Use this.collapse() instead.
- Source:
-
embed()
-
Embed the control into the page.
- Inherited From:
- Source:
-
embedWidgetContent()
-
Embed the actual widget form inside of .widget-content and finally trigger the widget-added event.
- Since:
-
- 4.4.0
- Source:
-
embedWidgetControl()
-
Embed the .widget element inside the li container.
- Since:
-
- 4.4.0
- Source:
-
expandControlSection()
-
Expand the accordion section containing a control
-
expandForm()
-
Expand the widget form control
- Deprecated:
-
- 4.1.0 Use this.expand() instead.
- Source:
-
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
-
getSidebarWidgetsControl()
-
Returns:
-
getWidgetSidebarPosition()
-
Get the position (index) of the widget in the containing sidebar
Returns:
- Type
- Number
-
highlightSectionAndControl()
-
Highlight the widget control and section
-
linkElements()
-
Link elements between settings and inputs.
- Since:
-
- 4.7.0
- Inherited From:
- Source:
Returns:
- Type
- void
-
moveDown()
-
Move widget up one in the sidebar
-
moveUp()
-
Move widget up one in the sidebar
-
onChangeActive(active, args)
-
Update widget control to indicate whether it is currently rendered. Overrides api.Control.toggle()
Parameters:
Name Type Description activeBoolean argsObject Properties
Name Type Description completeCallbackfunction - Since:
-
- 4.1.0
- Overrides:
- Source:
-
onChangeExpanded(expanded, args)
-
Respond to change in the expanded state.
Parameters:
Name Type Description expandedBoolean argsObject merged on top of this.defaultActiveArguments -
ready()
-
Set up the control.
- Since:
-
- 3.9.0
- Overrides:
- Source:
-
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:
-
toggleForm( [showOrHide])
-
Expand or collapse the widget control
Parameters:
Name Type Argument Description showOrHideboolean | undefined <optional>
If not supplied, will be inverse of current visibility - Deprecated:
-
- this is poor naming, and it is better to directly set control.expanded( showOrHide )
- Source:
-
toggleWidgetMoveArea( [showOrHide])
-
Toggle visibility of the widget move area
Parameters:
Name Type Argument Description showOrHideBoolean <optional>
-
updateWidget( [args])
-
Submit the widget form via Ajax and get back the updated instance, along with the new widget control form to render.
Parameters:
Name Type Argument Description argsobject <optional>
Properties
Name Type Argument Default Description instanceObject | null <optional>
null When the model changes, the instance is sent here; otherwise, the inputs from the form are used completefunction | null <optional>
null Function which is called when the request finishes. Context is bound to the control. First argument is any error. Following arguments are for success. ignoreActiveElementBoolean <optional>
false Whether or not updating a field will be deferred if focus is still on the element.