From 126147a8770f45626f8126f59a2cf036cb57f229 Mon Sep 17 00:00:00 2001 From: "Drew Jaynes (DrewAPicture)" Date: Sun, 10 Aug 2014 02:17:14 +0000 Subject: [PATCH] Document default arguments for the `WP_List_Table` class. Also add referenced docblocks to extending class constructors. Props mikejolley for the initial patch. Fixes #28679. See #28298. git-svn-id: https://develop.svn.wordpress.org/trunk@29459 602fd350-edb4-49c9-b593-d223f7449a82 --- .../includes/class-wp-comments-list-table.php | 9 ++++++ .../includes/class-wp-links-list-table.php | 9 ++++++ src/wp-admin/includes/class-wp-list-table.php | 32 +++++++++++++++---- .../includes/class-wp-media-list-table.php | 9 ++++++ .../includes/class-wp-ms-sites-list-table.php | 9 ++++++ .../class-wp-ms-themes-list-table.php | 9 ++++++ .../includes/class-wp-plugins-list-table.php | 9 ++++++ .../includes/class-wp-posts-list-table.php | 9 ++++++ .../includes/class-wp-terms-list-table.php | 9 ++++++ .../includes/class-wp-themes-list-table.php | 9 ++++++ .../includes/class-wp-users-list-table.php | 9 ++++-- 11 files changed, 113 insertions(+), 9 deletions(-) diff --git a/src/wp-admin/includes/class-wp-comments-list-table.php b/src/wp-admin/includes/class-wp-comments-list-table.php index 77733f1c4e..6464d204d8 100644 --- a/src/wp-admin/includes/class-wp-comments-list-table.php +++ b/src/wp-admin/includes/class-wp-comments-list-table.php @@ -21,6 +21,15 @@ class WP_Comments_List_Table extends WP_List_Table { public $pending_count = array(); + /** + * Constructor. + * + * @since 3.1.0 + * + * @see WP_List_Table::__construct() for more information on default arguments. + * + * @param array $args An associative array of arguments. + */ public function __construct( $args = array() ) { global $post_id; diff --git a/src/wp-admin/includes/class-wp-links-list-table.php b/src/wp-admin/includes/class-wp-links-list-table.php index ae550b0b54..7d32d469fc 100644 --- a/src/wp-admin/includes/class-wp-links-list-table.php +++ b/src/wp-admin/includes/class-wp-links-list-table.php @@ -9,6 +9,15 @@ */ class WP_Links_List_Table extends WP_List_Table { + /** + * Constructor. + * + * @since 3.1.0 + * + * @see WP_List_Table::__construct() for more information on default arguments. + * + * @param array $args An associative array of arguments. + */ public function __construct( $args = array() ) { parent::__construct( array( 'plural' => 'bookmarks', diff --git a/src/wp-admin/includes/class-wp-list-table.php b/src/wp-admin/includes/class-wp-list-table.php index 463d0e1106..11966a1387 100644 --- a/src/wp-admin/includes/class-wp-list-table.php +++ b/src/wp-admin/includes/class-wp-list-table.php @@ -2,10 +2,11 @@ /** * Base class for displaying a list of items in an ajaxified HTML table. * - * @package WordPress - * @subpackage List_Table * @since 3.1.0 * @access private + * + * @package WordPress + * @subpackage List_Table */ class WP_List_Table { @@ -64,11 +65,30 @@ class WP_List_Table { private $_pagination; /** - * Constructor. The child class should call this constructor from its own constructor + * Constructor. * - * @param array $args An associative array with information about the current table - * @access protected - */ + * The child class should call this constructor from its own constructor to override + * the default $args. + * + * @since 3.1.0 + * + * @param array|string $args { + * Array or string of arguments. + * + * @type string $plural Plural value used for labels and the objects being listed. + * This affects things such as CSS class-names and nonces used + * in the list table, e.g. 'posts'. Default empty. + * @type string $singular Singular label for an object being listed, e.g. 'post'. + * Default empty + * @type bool $ajax Whether the list table supports AJAX. This includes loading + * and sorting data, for example. If true, the class will call + * the {@see _js_vars()} method in the footer to provide variables + * to any scripts handling AJAX events. Default false. + * @type string $screen String containing the hook name used to determine the current + * screen. If left null, the current screen will be automatically set. + * Default null. + * } + */ public function __construct( $args = array() ) { $args = wp_parse_args( $args, array( 'plural' => '', diff --git a/src/wp-admin/includes/class-wp-media-list-table.php b/src/wp-admin/includes/class-wp-media-list-table.php index 91c72c71b1..2e4e8eb80e 100644 --- a/src/wp-admin/includes/class-wp-media-list-table.php +++ b/src/wp-admin/includes/class-wp-media-list-table.php @@ -9,6 +9,15 @@ */ class WP_Media_List_Table extends WP_List_Table { + /** + * Constructor. + * + * @since 3.1.0 + * + * @see WP_List_Table::__construct() for more information on default arguments. + * + * @param array $args An associative array of arguments. + */ public function __construct( $args = array() ) { $this->detached = isset( $_REQUEST['detached'] ) || isset( $_REQUEST['find_detached'] ); diff --git a/src/wp-admin/includes/class-wp-ms-sites-list-table.php b/src/wp-admin/includes/class-wp-ms-sites-list-table.php index 945327cf65..976c8989f5 100644 --- a/src/wp-admin/includes/class-wp-ms-sites-list-table.php +++ b/src/wp-admin/includes/class-wp-ms-sites-list-table.php @@ -9,6 +9,15 @@ */ class WP_MS_Sites_List_Table extends WP_List_Table { + /** + * Constructor. + * + * @since 3.1.0 + * + * @see WP_List_Table::__construct() for more information on default arguments. + * + * @param array $args An associative array of arguments. + */ public function __construct( $args = array() ) { parent::__construct( array( 'plural' => 'sites', diff --git a/src/wp-admin/includes/class-wp-ms-themes-list-table.php b/src/wp-admin/includes/class-wp-ms-themes-list-table.php index f93e1d0ec6..646afa754a 100644 --- a/src/wp-admin/includes/class-wp-ms-themes-list-table.php +++ b/src/wp-admin/includes/class-wp-ms-themes-list-table.php @@ -12,6 +12,15 @@ class WP_MS_Themes_List_Table extends WP_List_Table { public $site_id; public $is_site_themes; + /** + * Constructor. + * + * @since 3.1.0 + * + * @see WP_List_Table::__construct() for more information on default arguments. + * + * @param array $args An associative array of arguments. + */ public function __construct( $args = array() ) { global $status, $page; diff --git a/src/wp-admin/includes/class-wp-plugins-list-table.php b/src/wp-admin/includes/class-wp-plugins-list-table.php index 377db7391d..7e4e0f43e6 100644 --- a/src/wp-admin/includes/class-wp-plugins-list-table.php +++ b/src/wp-admin/includes/class-wp-plugins-list-table.php @@ -9,6 +9,15 @@ */ class WP_Plugins_List_Table extends WP_List_Table { + /** + * Constructor. + * + * @since 3.1.0 + * + * @see WP_List_Table::__construct() for more information on default arguments. + * + * @param array $args An associative array of arguments. + */ public function __construct( $args = array() ) { global $status, $page; diff --git a/src/wp-admin/includes/class-wp-posts-list-table.php b/src/wp-admin/includes/class-wp-posts-list-table.php index 90a454551d..712228b07e 100644 --- a/src/wp-admin/includes/class-wp-posts-list-table.php +++ b/src/wp-admin/includes/class-wp-posts-list-table.php @@ -45,6 +45,15 @@ class WP_Posts_List_Table extends WP_List_Table { */ private $sticky_posts_count = 0; + /** + * Constructor. + * + * @since 3.1.0 + * + * @see WP_List_Table::__construct() for more information on default arguments. + * + * @param array $args An associative array of arguments. + */ public function __construct( $args = array() ) { global $post_type_object, $wpdb; diff --git a/src/wp-admin/includes/class-wp-terms-list-table.php b/src/wp-admin/includes/class-wp-terms-list-table.php index a1943e0eae..ec17db31f1 100644 --- a/src/wp-admin/includes/class-wp-terms-list-table.php +++ b/src/wp-admin/includes/class-wp-terms-list-table.php @@ -11,6 +11,15 @@ class WP_Terms_List_Table extends WP_List_Table { public $callback_args; + /** + * Constructor. + * + * @since 3.1.0 + * + * @see WP_List_Table::__construct() for more information on default arguments. + * + * @param array $args An associative array of arguments. + */ public function __construct( $args = array() ) { global $post_type, $taxonomy, $action, $tax; diff --git a/src/wp-admin/includes/class-wp-themes-list-table.php b/src/wp-admin/includes/class-wp-themes-list-table.php index 30448a0be2..0b1c18625d 100644 --- a/src/wp-admin/includes/class-wp-themes-list-table.php +++ b/src/wp-admin/includes/class-wp-themes-list-table.php @@ -12,6 +12,15 @@ class WP_Themes_List_Table extends WP_List_Table { protected $search_terms = array(); public $features = array(); + /** + * Constructor. + * + * @since 3.1.0 + * + * @see WP_List_Table::__construct() for more information on default arguments. + * + * @param array $args An associative array of arguments. + */ public function __construct( $args = array() ) { parent::__construct( array( 'ajax' => true, diff --git a/src/wp-admin/includes/class-wp-users-list-table.php b/src/wp-admin/includes/class-wp-users-list-table.php index 6c1a503a08..41aa0d7032 100644 --- a/src/wp-admin/includes/class-wp-users-list-table.php +++ b/src/wp-admin/includes/class-wp-users-list-table.php @@ -30,10 +30,13 @@ class WP_Users_List_Table extends WP_List_Table { /** * Constructor. - * + * * @since 3.1.0 - * @access public - */ + * + * @see WP_List_Table::__construct() for more information on default arguments. + * + * @param array $args An associative array of arguments. + */ public function __construct( $args = array() ) { parent::__construct( array( 'singular' => 'user',