[wp-trac] [WordPress Trac] #19278: Allow WP_List_Table ::get_bulk_items() to receive a nested array and output optgroups
WordPress Trac
wp-trac at lists.automattic.com
Thu Nov 17 17:25:38 UTC 2011
#19278: Allow WP_List_Table ::get_bulk_items() to receive a nested array and output
optgroups
-----------------------------+-----------------------------
Reporter: goldenapples | Owner:
Type: feature request | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version:
Severity: minor | Keywords:
-----------------------------+-----------------------------
I'm just putting this out there as a possible enhancement to the
WP_List_Table... would like feedback as to whether anyone else would find
it helpful. If so, I'm more than happy to write up a patch for this.
I think it may be useful to be able to pass a nested array to
`WP_List_Table::get_bulk_actions()` and have it output the options within
the subarray in an `<optgroup>`. My specific use case is in applying meta
fields to a custom table. I would like to be able to define something like
this in my `get_bulk_items` function:
{{{
function get_bulk_actions() {
$actions = array(
'delete' => 'Delete',
'outofstock' => 'Mark out of stock',
'applytags' => array(
'label' => 'Apply tags to products',
'actions' => array(
'featured' => 'Featured',
'sale' => 'On Sale'
)
)
);
return $actions;
}
}}}
and have the output look something like this:
{{{
<select name="action">
<option value='-1' selected='selected'>Bulk Actions</option>
<option value='delete'>Delete</option>
<option value='outofstock'>Mark out of stock</option>
<optgroup label="Apply tags to products">
<option value='feature'>Featured</option>
<option value='sale'>On sale</option>
</optgroup>
</select>
}}}
A very minor feature, and possibly too fringe of a use case to bother
with. But I've worked on a couple projects now where being able to specify
markup like that would have made that screen more user-friendly. Any
thoughts?
--
Ticket URL: <http://core.trac.wordpress.org/ticket/19278>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list