<abstract> new MediaWidgetControl(options)
Media Widget Control.
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | Options.
Properties
|
- Source:
Returns:
- Type
- void
Extends
- Backbone.View
Members
-
events :Object
-
View events.
Type:
- Object
- 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
- 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
- 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
- Source:
-
showDisplaySettings :boolean
-
Show display settings.
Type:
- boolean
- Source:
Methods
-
<abstract> editMedia()
-
Open the media frame to modify the selected item.
- 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. - Source:
Returns:
Props.- Type
- Object
-
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. - Source:
Returns:
- Type
- void
-
isSelected()
-
Whether a media item is selected.
- Source:
Returns:
Whether selected and no error.- Type
- boolean
-
mapMediaToModelProps(mediaFrameProps)
-
Map media frame props to model props.
Parameters:
Name Type Description mediaFrameProps
Object Media frame props. - Source:
Returns:
Model props.- Type
- Object
-
mapModelToMediaFrameProps(modelProps)
-
Map model props to media frame props.
Parameters:
Name Type Description modelProps
Object Model props. - Source:
Returns:
Media frame props.- Type
- Object
-
mapModelToPreviewTemplateProps()
-
Map model props to previewTemplateProps.
- Source:
Returns:
Preview Template Props.- Type
- Object
-
render()
-
Render template.
- Source:
Returns:
- Type
- void
-
<abstract> renderPreview()
-
Render media preview.
- Source:
Returns:
- Type
- void
-
selectMedia()
-
Open the media select frame to chose an item.
- Source:
Returns:
- Type
- void
-
syncModelToInputs()
-
Sync the model attributes to the hidden inputs, and update previewTemplateProps.
- Source:
Returns:
- Type
- void
-
syncModelToPreviewProps()
-
Sync the model attributes to the hidden inputs, and update previewTemplateProps.
- Source:
Returns:
- Type
- void
-
template()
-
Get template.
- Source:
Returns:
Template.- Type
- function
-
updateSelectedAttachment()
-
Update the selected attachment if necessary.
- Source:
Returns:
- Type
- void