WordPress.org

Make WordPress Core

Opened 16 months ago

Last modified 15 months ago

#23096 new enhancement

Provide callback before setting state of the editor media manager

Reported by: griffinjt Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 3.5
Component: Media Keywords: has-patch dev-feedback
Focuses: Cc:

Description (last modified by SergeyBiryukov)

In the current setup, there is no way to modify the current state or views when the media manager is opened from the "Add Media" button. By the time you can modify anything, all the default views have been rendered and all of the events have been fired.

It would be helpful to check for the existence of a callback, and if it exists, run that before returning the workflow.

My patch does this, which you could invoke in this way:

wp.media.editor.extend = function(workflow){
        // Manipulate the workflow here
}

Thoughts? This is only for the default media manager that is invoked by clicking the Add Media button.

Attachments (1)

23096.diff (604 bytes) - added by griffinjt 16 months ago.

Download all attachments as: .zip

Change History (6)

griffinjt16 months ago

comment:1 griffinjt16 months ago

Oops, wrong syntax for code block. This should look better:

wp.media.editor.extend = function(workflow){
        // Manipulate workflow here
}

comment:2 SergeyBiryukov16 months ago

  • Description modified (diff)

comment:3 SergeyBiryukov16 months ago

  • Version changed from trunk to 3.5

comment:4 sc0ttkclark15 months ago

  • Cc lol@… added

WANT / NEED. Caps on purpose.

comment:5 husobj15 months ago

  • Cc ben@… added
Note: See TracTickets for help on using tickets.