new media_gallery(options)
Gallery widget control.
See WP_Widget_Gallery::enqueue_admin_scripts() for amending prototype from PHP exports.
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | Options.
Properties
|
- Since:
-
- 4.9.0
- Source:
Returns:
- Type
- void
Extends
Members
-
events :object
-
View events.
Type:
- object
- Since:
-
- 4.9.0
- Overrides:
- Source:
-
id_base :string
-
Widget ID base. This may be defined by the subclass. It may be exported from PHP to JS such as is done in WP_Widget_Media_Image::enqueue_admin_scripts(). If not, it will attempt to be discovered by looking to see if this control instance extends each member of component.controlConstructors, and if it does extend one, will use the key as the id_base.
Type:
- string
- Inherited From:
- Source:
-
l10n :Object
-
Translation strings. The mapping of translation strings is handled by media widget subclasses, exported from PHP to JS such as is done in WP_Widget_Media_Image::enqueue_admin_scripts().
Type:
- Object
- Inherited From:
- Source:
-
mime_type :string
-
Mime type. This must be defined by the subclass. It may be exported from PHP to JS such as is done in WP_Widget_Media_Image::enqueue_admin_scripts().
Type:
- string
- Inherited From:
- Source:
-
showDisplaySettings :boolean
-
Show display settings.
Type:
- boolean
- Inherited From:
- Source:
Methods
-
editMedia()
-
Open the media select frame to edit images.
- Since:
-
- 4.9.0
- Overrides:
- Source:
Returns:
- Type
- void
-
getModelPropsFromMediaFrame(mediaFrame)
-
Get the instance props from the media selection frame.
Parameters:
Name Type Description mediaFrame
wp.media.view.MediaFrame.Select Select frame. - Inherited From:
- Source:
Returns:
Props.- Type
- Object
-
handleAttachmentDestroy(attachment)
-
Clear the selected attachment when it is deleted in the media select frame.
Parameters:
Name Type Description attachment
wp.media.models.Attachment Attachment. - Since:
-
- 4.9.0
- Source:
Returns:
- Type
- void
-
handleMediaLibraryLinkClick(event)
-
Handle click on link to Media Library to open modal, such as the link that appears when in the missing attachment error notice.
Parameters:
Name Type Description event
jQuery.Event Event. - Inherited From:
- Source:
Returns:
- Type
- void
-
isSelected()
-
Determine whether there are selected attachments.
- Since:
-
- 4.9.0
- Overrides:
- Source:
Returns:
Selected.- Type
- boolean
-
mapMediaToModelProps(mediaFrameProps)
-
Map media frame props to model props.
Parameters:
Name Type Description mediaFrameProps
Object Media frame props. - Inherited From:
- Source:
Returns:
Model props.- Type
- Object
-
mapModelToMediaFrameProps(modelProps)
-
Map model props to media frame props.
Parameters:
Name Type Description modelProps
Object Model props. - Inherited From:
- Source:
Returns:
Media frame props.- Type
- Object
-
mapModelToPreviewTemplateProps()
-
Map model props to previewTemplateProps.
- Inherited From:
- Source:
Returns:
Preview Template Props.- Type
- Object
-
render()
-
Render template.
- Inherited From:
- Source:
Returns:
- Type
- void
-
renderPreview()
-
Render preview.
- Since:
-
- 4.9.0
- Overrides:
- Source:
Returns:
- Type
- void
-
selectMedia()
-
Open the media select frame to chose an item.
- Since:
-
- 4.9.0
- Overrides:
- Source:
Returns:
- Type
- void
-
syncModelToInputs()
-
Sync the model attributes to the hidden inputs, and update previewTemplateProps.
- Inherited From:
- Source:
Returns:
- Type
- void
-
syncModelToPreviewProps()
-
Sync the model attributes to the hidden inputs, and update previewTemplateProps.
- Inherited From:
- Source:
Returns:
- Type
- void
-
template()
-
Get template.
- Inherited From:
- Source:
Returns:
Template.- Type
- function
-
updateSelectedAttachment()
-
Update the selected attachment if necessary.
- Inherited From:
- Source:
Returns:
- Type
- void
-
updateSelectedAttachments()
-
Update the selected attachments if necessary.
- Since:
-
- 4.9.0
- Source:
Returns:
- Type
- void