WordPress.org

Support

Support » Alpha/Beta » Pre-select images in Media Library popup

Pre-select images in Media Library popup

  • While testing a component of ours on the lastest WordPress beta release (as we speak, 3.6-beta3), we’ve stumbled upon an inconsistency with the code related to the integration with the Media Manager we had written and was working fine for version 3.5.

    This is what we have now, among other things. The “media_popup” object is the frame, options.ids is an array containing the IDs of the media library items to be selected, and of course after binding this on the “open” event, we’d then proceed actually opening the popup.

    media_popup.on('open', function() {
            var selection = media_popup.state().get('selection');
    
            if( options.ids ) {
                jQuery.each(options.ids, function(id) {
                    attachment = wp.media.attachment(options.ids[id]);
                    attachment.fetch();
                    selection.add( attachment ? [attachment] : [] );
                });
            }
        });

    We’ve checked the WordPress SVN log, and we’ve seen that in revision #23089, the “media-views.js” file has been modified introducing a “New method of managing media selections.”

    Has anyone found a solution for this, when trying to update code written for WP 3.5?

  • The topic ‘Pre-select images in Media Library popup’ is closed to new replies.
Skip to toolbar