[wp-trac] [WordPress Trac] #41675: Add filter to bypass display/query for Media Months filter in media modal

WordPress Trac noreply at wordpress.org
Fri Sep 1 16:00:24 UTC 2017


#41675: Add filter to bypass display/query for Media Months filter in media modal
--------------------------------------+------------------------------
 Reporter:  CrazyJaco                 |       Owner:  joemcgill
     Type:  enhancement               |      Status:  reviewing
 Priority:  normal                    |   Milestone:  Awaiting Review
Component:  Media                     |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  good-first-bug has-patch  |     Focuses:  performance
--------------------------------------+------------------------------
Changes (by joemcgill):

 * owner:   => joemcgill
 * status:  new => reviewing


Comment:

 Thanks for the great start on this @herregroen!

 I could see how a separate filter for this case might be helpful, but I
 think we can support this right now with the current filter if, as
 @CrazyJaco suggests, someone were to return an empty array, then the UI
 should not be shown.

 There are a few places in the `AttachmentsBrowser` view where a new
 `wp.media.view.DateFilter` view is rendered, which will need to be
 accounted for — the grid view in the media library, and the default one
 used by the `wp.media.frame`. In the latter, there is already a check to
 se if `this.options.date` is `true` before rendering the `DateFilter`
 view. I think we could add a check for the length of
 `wp.media.view.settings.months` as well before rendering that view.

 Additionally, in the list view of the media library, you can disable the
 months dropdown using the `disable_months_dropdown` filter. Seems like we
 could take advantage of this opportunity to unify the process for
 disabling the months dropdown between the media views and the
 `WP_List_Table`.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/41675#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list