Houdy mates,
Anyone knows where I can find the new wordpress 3.5 media uploader api? Or something similar I’ve tried to search in the codex but nothing solid comes up 
Specifically the javascript wp.media.editor functions and handling.
Thanks for any help 
- Microlancer Beta Tester
- Author had a Free File of the Month
- Has been a member for 3-4 years
- Item was Featured
- Author was Featured
- Austria
- Exclusive Author
- Referred between 200 and 499 users
The thing is I want something more personalized, I already made this:
//Prepare frame
var frame = wp.media({
title : 'Pick the images for this work',
multiple : true,
library : { type : 'image'},
button : { text : 'Insert' },
});
frame.on('close',function() {
// get selections and save to hidden input plus other AJAX stuff etc.
var selection = frame.state().get('selection');
console.log(selection["_byId"]);
});
frame.on('open',function() {
var selection = frame.state().get('selection');
//Get ids array from
ids = jQuery('#<?php echo $this->id; ?>').val().split(',');
ids.forEach(function(id) {
attachment = wp.media.attachment(id);
attachment.fetch();
selection.add( attachment ? [ attachment ] : [] );
});
});
frame.open();
But I wanted to see what I can do with it, was trying to find wp’s actual documentation on this
Thank you plusquare! I like this approach much better than overriding wp.media.editor.send.attachment function. Any idea on how to enable “Attachment Display Settings” in the sidebar? right now only “Attachment Details” is being displayed.
$('#somelink').on('click', function(event){
event.preventDefault();
var frame = wp.media({
title: "Select Image",
multiple: false,
library: { type: 'image' },
button : { text : 'add image' }
});
frame.on( 'select', function() {
var selection = frame.state().get('selection');
selection.each(function(attachment) {
console.log(attachment);
// this will return an object with all the attachment-details
});
});
});
In my case I ended up in using admin-ajax get attachment function to display the actual images on the admin as the attachment fetch only functioned after I opened media picker the first time. Got it working exactly as I wanted 
