[wp-trac] [WordPress Trac] #17578: Add filter to control which media buttons get shown

WordPress Trac wp-trac at lists.automattic.com
Sat May 28 14:59:22 UTC 2011


#17578: Add filter to control which media buttons get shown
-----------------------------+------------------------------
 Reporter:  mitchoyoshitaka  |       Owner:
     Type:  feature request  |      Status:  new
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  Administration   |     Version:
 Severity:  trivial          |  Resolution:
 Keywords:  has-patch        |
-----------------------------+------------------------------

Comment (by azaozz):

 I'm unsure why there are four buttons there that do the same thing.
 Perhaps they were needed when this was introduced but have lost their
 meaning since. It seems confusing that you can upload anything by using
 any of these buttons. Perhaps when we change the uploader in 3.3 we will
 switch to using only one "Insert/Upload" button.

 Looking at the patch: we already have most of the logic there, don't see a
 need to repeat it (also really dislike using `extract()` especially
 without `EXTR_IF_EXISTS / EXTR_SKIP`). So this should probably be:
 {{{
 $media_buttons = array('image' => true, 'audio' => true, 'video' => true);
 if ( is_multisite() )
   $media_buttons = get_site_option( 'mu_media_buttons' );

 $media_buttons = apply_filters( 'media_buttons_media_types',
 $media_buttons );

 if ( empty($media_buttons['image']) )
   $do_image = false;

 ....
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/17578#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list