[wp-trac] [WordPress Trac] #19278: Allow WP_List_Table ::get_bulk_items() to receive a nested array and output optgroups

WordPress Trac noreply at wordpress.org
Fri Mar 30 00:57:13 UTC 2018


#19278: Allow WP_List_Table ::get_bulk_items() to receive a nested array and output
optgroups
-------------------------------------------------+-------------------------
 Reporter:  goldenapples                         |       Owner:
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
Component:  Administration                       |  Review
 Severity:  normal                               |     Version:
 Keywords:  has-patch dev-feedback needs-        |  Resolution:
  testing                                        |     Focuses:
-------------------------------------------------+-------------------------
Changes (by mattkeys):

 * keywords:  needs-patch => has-patch dev-feedback needs-testing


Comment:

 Going to play necromancer here a bit and submit a patch for this. I work
 with WP List Table often and I know many other developers use it in their
 plugins/themes ([https://codex.wordpress.org/Class_Reference/WP_List_Table
 despite the codex warning]). Optgroup's would be a nice way to organize
 bulk actions.

 The patch I submitted just checks if the current value from the existing
 bulk actions foreach is an array. If it is, the key becomes the optgroup
 label, and a new foreach is used to loop over the optgroup's children.
 Otherwise it proceeds as usual. I also modified a couple variable names to
 semantic reasons.

 I would love to hear back from others about any unforeseen impacts that
 this change might have.

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


More information about the wp-trac mailing list