To get you started, the basic functions and overrides as far as I know currently.There might be better solutions, but I only had two days with 3.5 yet:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | // open modal - bind this to your button if ( typeof wp !== 'undefined' && wp.media && wp.media.editor ) wp.media.editor.open( ##unique_id_here## ); // backup of original send function original_send = wp.media.editor.send.attachment; // new send function wp.media.editor.send.attachment = function( a, b) { console.log(b); // b has all informations about the attachment // or whatever you want to do with the data at this point // original function makes an ajax call to retrieve the image html tag and does a little more }; // wp.media.send.to.editor will automatically trigger window.send_to_editor for backwards compatibility // backup original window.send_to_editor window.original_send_to_editor = window.send_to_editor; // override window.send_to_editor window.send_to_editor = function(html) { // html argument might not be useful in this case // use the data from var b (attachment) here to make your own ajax call or use data from b and send it back to your defined input fields etc. } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.