Class: MediaWidgetModel

wp.mediaWidgets. MediaWidgetModel


new MediaWidgetModel()

Media widget model.
Source:

Extends

  • Backbone.Model

Members


idAttribute :string

Id attribute.
Type:
  • string
Source:

schema :Object:.<string:, Object:>

Instance schema. This adheres to JSON Schema and subclasses should have their schema exported from PHP to JS such as is done in WP_Widget_Media_Image::enqueue_admin_scripts().
Type:
  • Object:.<string:, Object:>
Source:

Methods


defaults()

Get default attribute values.
Source:
Returns:
Mapping of property names to their default values.
Type
Object

getEmbedResetProps()

Get props which are merged on top of the model when an embed is chosen (as opposed to an attachment).
Source:
Returns:
Reset/override props.
Type
Object

set(key [, val] [, options])

Set attribute value(s). This is a wrapped version of Backbone.Model#set() which allows us to cast the attribute values from the hidden inputs' string values into the appropriate data types (integers or booleans).
Parameters:
Name Type Argument Description
key string | Object Attribute name or attribute pairs.
val mixed | Object <optional>
Attribute value or options object.
options Object <optional>
Options when attribute name and value are passed separately.
Source:
Returns:
This model.
Type
wp.mediaWidgets.MediaWidgetModel