Make WordPress Core


Ignore:
Timestamp:
08/25/2010 12:51:44 AM (14 years ago)
Author:
scribu
Message:

Introduce get_list_table(). See #14579

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/list-table.php

    r15517 r15528  
    629629
    630630    /**
    631      * Handle an incoming ajax request ( called from admin-ajax.php )
    632      *
     631     * Handle an incoming ajax request (called from admin-ajax.php)
     632     *
     633     * @since 3.1.0
    633634     * @access public
    634635     */
     
    666667    }
    667668}
     669
     670/**
     671 * Fetch an instance of a WP_List_Table class
     672 *
     673 * @since 3.1.0
     674 *
     675 * @param string $type The type of the list table
     676 * @return object
     677 */
     678function get_list_table( $type ) {
     679    require_once( ABSPATH . '/wp-admin/includes/default-list-tables.php' );
     680
     681    $type = strtr( ucwords( strtr( $type, '-', ' ') ), ' ', '_' );
     682
     683    $class = "WP_{$type}_Table";
     684    $class = apply_filters( "get_list_table_$type", $class );
     685
     686    return new $class;
     687}
     688
Note: See TracChangeset for help on using the changeset viewer.