WordPress.org

Forums

Pre-select images in Media Library popup (1 post)

  1. Andrea Gandino
    Member
    Posted 1 year ago #

    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?

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 1 year ago by Andrea Gandino
  • This topic is not resolved
  • WordPress version: 3.6-beta3