[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-admin/includes/ -> class-wp-list-table-compat.php (source)

   1  <?php
   2  /**
   3   * Helper functions for displaying a list of items in an ajaxified HTML table.
   4   *
   5   * @package WordPress
   6   * @subpackage List_Table
   7   * @since 4.7.0
   8   */
   9  
  10  /**
  11   * Helper class to be used only by back compat functions.
  12   *
  13   * @since 3.1.0
  14   */
  15  class _WP_List_Table_Compat extends WP_List_Table {
  16      public $_screen;
  17      public $_columns;
  18  
  19      /**
  20       * Constructor.
  21       *
  22       * @since 3.1.0
  23       *
  24       * @param string|WP_Screen $screen  The screen hook name or screen object.
  25       * @param string[]         $columns An array of columns with column IDs as the keys
  26       *                                  and translated column names as the values.
  27       */
  28  	public function __construct( $screen, $columns = array() ) {
  29          if ( is_string( $screen ) ) {
  30              $screen = convert_to_screen( $screen );
  31          }
  32  
  33          $this->_screen = $screen;
  34  
  35          if ( ! empty( $columns ) ) {
  36              $this->_columns = $columns;
  37              add_filter( 'manage_' . $screen->id . '_columns', array( $this, 'get_columns' ), 0 );
  38          }
  39      }
  40  
  41      /**
  42       * Gets a list of all, hidden, and sortable columns.
  43       *
  44       * @since 3.1.0
  45       *
  46       * @return array
  47       */
  48  	protected function get_column_info() {
  49          $columns  = get_column_headers( $this->_screen );
  50          $hidden   = get_hidden_columns( $this->_screen );
  51          $sortable = array();
  52          $primary  = $this->get_default_primary_column_name();
  53  
  54          return array( $columns, $hidden, $sortable, $primary );
  55      }
  56  
  57      /**
  58       * Gets a list of columns.
  59       *
  60       * @since 3.1.0
  61       *
  62       * @return array
  63       */
  64  	public function get_columns() {
  65          return $this->_columns;
  66      }
  67  }


Generated: Sun Dec 22 01:00:02 2024 Cross-referenced by PHPXref 0.7.1