array key: extra_navigation
returns: HTML string
The extra_navigation definition is designed so that a filter can be accommodated, generally dropdowns, but it also could be radio buttons or similar. The extra_navigation is outputted into the List Table form and the form values must be processed via query string in get_data and get_data_count. Typically the extra_navigation is followed by the filter button, however the filter button could be omitted for various reasons, including a Javascript submit.
$list_table_definitions['extra_navigation'] = "saturn_tables_cars_make_dropdown";
function saturn_tables_cars_make_dropdown() {
global $wpdb;
$makes = $wpdb->get_col( "SELECT DISTINCT make FROM saturn_tables_cars ORDER BY make" );
$output = '<label for="filter-by-make" class="screen-reader-text">Filter by Make</label>';
$output .= '<select name="make" id="filter-by-make">';
$output .= '<option>All Makes</option>';
foreach ($makes as $make) {
$selected = (isset($_GET['make']) && ($make == $_GET['make'])) ? " selected" : "";
$output .= "<option$selected>" . esc_html($make) ."</option>";
}
$output .= '</select>';
return $output;
}