[wp-trac] [WordPress Trac] #21988: Filter get_media_item output

WordPress Trac wp-trac at lists.automattic.com
Tue Sep 25 03:56:28 UTC 2012


#21988: Filter get_media_item output
-----------------------------+-------------------------
 Reporter:  griffinjt        |       Type:  enhancement
   Status:  new              |   Priority:  normal
Milestone:  Awaiting Review  |  Component:  General
  Version:  trunk            |   Severity:  normal
 Keywords:  dev-feedback     |
-----------------------------+-------------------------
 L1027-1028 of media.php looks like this:

 {{{
 if ( $item = get_media_item( $id, array( 'errors' => isset($errors[$id]) ?
 $errors[$id] : null) ) )
                         $output .= "\n<div id='media-item-$id' class
 ='media-item child-of-$attachment->post_parent preloaded'><div
 class='progress hidden'><div class='bar'></div></div><div id='media-
 upload-error-$id' class='hidden'></div><div class='filename
 hidden'></div>$item\n</div>";
 }}}

 The biggest issue I see with this is that because you can only attach
 images to one post, this will unnecessarily display images that cannot be
 attached to the current post type in instances where the Media Library tab
 is forced to send items even though no editor support has been added for
 the post type.

 In that light, it would be nice to have a filter to remove the output of
 these unnecessary items in order to improve UI and UX when navigating
 through images to attach to the post type. Currently I am having to create
 an error-like overlay on each item that is already attached in order to
 prevent users from trying to attach an item that is already attached
 elsewhere.

 Where would it make the most sense to have this filter? At the end of
 get_media_item?

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21988>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list