array key: views

The views definition provides links generally used for different views such as All, Trash or Active. Views generally require some logic, as the active views should not be a link, but instead should be bold. So in the example dataset views, like link_actions, are returned by a callable via call_user_func. Views are generally links with query string variables defining how the data should be returned. Note both get_data and get_data_count must accommodate the view definition.

function saturn_tables_cars_views() {

    if (isset($_GET['status']) && $_GET['status'] == "trash") {
        $all = '<a href="' . admin_url("admin.php?page=my-cars-table&status=all") . '">' . __("All") . '</a>';
        $trash = '<strong>' . __("Trash") . '</strong>';
    } else {
        $all = '<strong>' . __("All") . '</strong>';
        $trash = '<a href="' . admin_url("admin.php?page=my-cars-table&status=trash") . '">' . __("Trash") . '</a>';    
    }

    return array( "all" => $all, "trash" => $trash);
}