[wp-hackers] Adding the "Insert From URL" tab to a 3.5 upload modal
Ian Dunn
ian at iandunn.name
Mon Apr 1 16:56:09 UTC 2013
Thanks Luke. It seems like I'd need to create an entirely new view by
extending wp.media.view.MediaFrame.Post, and then remove the Gallery
tab, change the Insert Into Post button, etc. My initial attempts at
that didn't work out, though, and I've already spent more time on this
than it really warrants, so in the interest of being practical I decided
to compromise and just give the user an extra text field if they want to
enter a remote URL.
On 03/30/2013 09:29 AM, Luke Bryan wrote:
> For debugging Wordpress' javascript, it's very helpful to have the
> minifying turned off:
> https://codex.wordpress.org/Debugging_in_WordPress#SCRIPT_DEBUG
>
> Now enter 'wp.media' in Firebug, it will give you a link to the function
> definition. As you can see in the source, there are two completely
> different classes that are called up depending on the frame attribute:
>
> if ( 'select' === attributes.frame && MediaFrame.Select )
> frame = new MediaFrame.Select( attributes );
> else if ( 'post' === attributes.frame && MediaFrame.Post )
> frame = new MediaFrame.Post( attributes );
>
> Which is why wp.media({frame:'select'}).open() (simple, featured image
> picker) is completely different than wp.media({frame:'post'}).open() full
> picker.
>
> To expand upon this question - I'm also wondering why these are separate
> classes for basically the same file picking functionality. The frame:post
> option gives a picker similar to the old one, which shows the insert-url
> tab, and can be hooked by NextGen gallery and others, but the simple
> featured-image-picker doesn't seem to have any way to hook plugin
> functionality into it (or add insert-url tab).
>
> http://wordpress.stackexchange.com/questions/76980/add-a-menu-item-to-wordpress-3-5-media-manager
> This answer here looks like the new right-way to extend the new WP3.5
> uploader, without the old style iframes. Unfortunately, it doesn't show in
> the simple (featured-image) picker. A similar problem exists in NextGen
> now, since you can't select a NextGen image from the featured-image.
>
> Is there a recommended way to add a nextgen-style picker, or an additional
> option to the 'media' category, for both the post-uploader and the
> featured-image style uploader? Will these two pickers be unified in 3.6 or
> 3.7?
>
> Best regards,
> Luke
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
More information about the wp-hackers
mailing list