Class: SiteIconControl

wp.customize. SiteIconControl


new SiteIconControl()

A control for selecting and cropping Site Icons.
Source:

Extends

Members


defaults :object

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

Methods


<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

calculateImageSelectOptions(attachment, controller)

Returns a set of options, computed from the attached image data and control-specific data, to be fed to the imgAreaSelect plugin in wp.media.view.Cropper.
Parameters:
Name Type Description
attachment wp.media.model.Attachment
controller wp.media.controller.Cropper
Inherited From:
Source:
Returns:
Options
Type
Object

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:

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

initFrame()

Create a media modal select frame, and store it so the instance can be reused when needed.
Overrides:
Source:

linkElements()

Link elements between settings and inputs.
Since:
  • 4.7.0
Inherited From:
Source:
Returns:
Type
void

mustBeCropped(flexW, flexH, dstW, dstH, imgW, imgH)

Return whether the image must be cropped, based on required dimensions.
Parameters:
Name Type Description
flexW bool
flexH bool
dstW int
dstH int
imgW int
imgH int
Inherited From:
Source:
Returns:
Type
bool

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:

onCropped(croppedImage)

After the image has been cropped, apply the cropped image data to the setting.
Parameters:
Name Type Description
croppedImage object Cropped attachment data.
Inherited From:
Source:

onSelect()

After an image is selected in the media modal, switch to the cropper state if the image isn't the right size.
Overrides:
Source:

onSkippedCrop()

If cropping was skipped, apply the image data directly to the setting.
Inherited From:
Source:

openFrame()

Open the media modal to the library state.
Inherited From:
Source:

ready()

When the control's DOM structure is ready, set up internal event bindings.
Inherited From:
Source:

removeFile(event)

Called when the "Remove" link is clicked. Empties the setting.
Parameters:
Name Type Description
event object jQuery Event object
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:

restoreDefault()

Reset the setting to the default value.
Inherited From:
Source:

select()

Callback handler for when an attachment is selected in the media modal. Gets the selected image information, and sets it within the control.
Inherited From:
Source:

setImageFromAttachment(attachment)

Updates the setting and re-renders the control UI.
Parameters:
Name Type Description
attachment object
Overrides:
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: