[wp-trac] [WordPress Trac] #45089: Update WP_List_Table::get_sortable_columns() to support 'asc' and 'desc' arguments

WordPress Trac noreply at wordpress.org
Fri May 24 11:19:41 UTC 2019


#45089: Update WP_List_Table::get_sortable_columns() to support 'asc' and 'desc'
arguments
-------------------------------------------------+-------------------------
 Reporter:  Tkama                                |       Owner:  birgire
     Type:  enhancement                          |      Status:  assigned
 Priority:  normal                               |   Milestone:  5.3
Component:  Administration                       |     Version:  4.9.8
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch needs-testing has-unit-    |     Focuses:
  tests                                          |  administration
-------------------------------------------------+-------------------------
Changes (by birgire):

 * keywords:  has-patch needs-testing => has-patch needs-testing has-unit-
     tests
 * owner:  (none) => birgire
 * focuses:   => administration
 * status:  new => assigned


Comment:

 This seems like a good improvement.

 In [attachment:"45089-2.diff"] I updated the patch with minor code
 standard fixes and test cases:

 - {{{test_sortable_columns()}}}
 - {{{test_sortable_columns_with_current_ordering()}}}

 for the {{{WP_Comments_List_Table}}} class.

 The {{{WP_List_Table::get_sortable_columns()}}} method is protected. I
 therefore considered adding new test classes (as new files) that extended
 an existing list table class, like {{{WP_Comments_List_Table}}}. That way
 we could modify the {{get_sortable_columns()}}} method. Anonymous classes
 might have made that more cleaner, but it's only available in PHP 7, so I
 ended with using the mock builder to override the method instead.

 This will need an owner for the 5.3 milestone, so I add myself as an owner
 to help with that.

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


More information about the wp-trac mailing list