Class: GalleryEdit

wp.media.controller. GalleryEdit


new GalleryEdit( [attributes])

wp.media.controller.GalleryEdit A state for editing a gallery's images and settings.
Parameters:
Name Type Argument Description
attributes object <optional>
The attributes hash passed to the state.
Properties
Name Type Argument Default Description
id string <optional>
gallery-edit Unique identifier.
title string <optional>
Edit Gallery Title for the state. Displays in the frame's title region.
library wp.media.model.Attachments <optional>
The collection of attachments in the gallery. If one is not supplied, an empty media.model.Selection collection is created.
multiple boolean <optional>
false Whether multi-select is enabled.
searchable boolean <optional>
false Whether the library is searchable.
sortable boolean <optional>
true Whether the Attachments should be sortable. Depends on the orderby property being set to menuOrder on the attachments collection.
date boolean <optional>
true Whether to show the date filter in the browser's toolbar.
content string | false <optional>
browse Initial mode for the content region.
toolbar string | false <optional>
image-details Initial mode for the toolbar region.
describe boolean <optional>
true Whether to offer UI to describe attachments - e.g. captioning images in a gallery.
displaySettings boolean <optional>
true Whether to show the attachment display settings interface.
dragInfo boolean <optional>
true Whether to show instructional text about the attachments being sortable.
idealColumnWidth int <optional>
170 The ideal column width in pixels for attachments.
editing boolean <optional>
false Whether the gallery is being created, or editing an existing instance.
priority int <optional>
60 The priority for the state link in the media menu.
syncSelection boolean <optional>
false Whether the Attachments selection should be persisted from the last state. Defaults to false for this state, because the library passed in *is* the selection.
AttachmentView view <optional>
The single `Attachment` view to be used in the `Attachments`. If none supplied, defaults to wp.media.view.Attachment.EditLibrary.
Source:

Extends

Methods


activate()

Since:
  • 3.5.0
Overrides:
Source:

canEmbed(attachment)

Whether an attachment can be embedded (audio or video).
Parameters:
Name Type Description
attachment wp.media.model.Attachment
Since:
  • 3.6.0
Inherited From:
Source:
Returns:
Type
Boolean

constructor()

Constructor.
Since:
  • 3.5.0
Inherited From:
Overrides:
Source:

deactivate()

Since:
  • 3.5.0
Overrides:
Source:

defaultDisplaySettings(attachment)

Given an attachment, create attachment display settings properties.
Parameters:
Name Type Description
attachment wp.media.model.Attachment
Since:
  • 3.6.0
Inherited From:
Source:
Returns:
Type
Object

display(attachment)

Create a model to represent display settings (alignment, etc.) for an attachment.
Parameters:
Name Type Description
attachment wp.media.model.Attachment
Since:
  • 3.5.0
Inherited From:
Source:
Returns:
Type
Backbone.Model

gallerySettings(browser)

Parameters:
Name Type Description
browser
Since:
  • 3.5.0
Source:

initialize()

Since:
  • 3.5.0
Overrides:
Source:

isImageAttachment(attachment)

Whether an attachment is image.
Parameters:
Name Type Description
attachment wp.media.model.Attachment
Since:
  • 4.4.1
Inherited From:
Source:
Returns:
Type
Boolean

<abstract> ready()

Ready event callback.
Since:
  • 3.5.0
Inherited From:
Overrides:
Source:

refreshContent()

If the state is active, no items are selected, and the current content mode is not an option in the state's router (provided the state has a router), reset the content mode to the default.
Since:
  • 3.5.0
Inherited From:
Source:

reset()

Reset the library to its initial state.
Since:
  • 3.5.0
Inherited From:
Overrides:
Source:

resetDisplays()

Reset the attachment display settings defaults to the site options. If site options don't define them, fall back to a persistent user setting.
Since:
  • 3.5.0
Inherited From:
Source:

saveContentMode()

Persist the mode of the content region as a user setting.
Since:
  • 3.5.0
Inherited From:
Source:

uploading(attachment)

Callback handler when an attachment is uploaded. Switch to the Media Library if uploaded from the 'Upload Files' tab. Adds any uploading attachments to the selection. If the state only supports one attachment to be selected and multiple attachments are uploaded, the last attachment in the upload queue will be selected.
Parameters:
Name Type Description
attachment wp.media.model.Attachment
Since:
  • 3.5.0
Inherited From:
Source: