Skip to content

Commit dc64903

Browse files
committed
Docs: Supply missing documentation in WP_MS_Themes_List_Table.
Developed in #10963 Props noruzzaman, westonruter, huzaifaalmesbah. See #64224. git-svn-id: https://develop.svn.wordpress.org/trunk@61717 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 954c187 commit dc64903

1 file changed

Lines changed: 57 additions & 34 deletions

File tree

src/wp-admin/includes/class-wp-ms-themes-list-table.php

Lines changed: 57 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
3737
*
3838
* @see WP_List_Table::__construct() for more information on default arguments.
3939
*
40-
* @global string $status
41-
* @global int $page
40+
* @global string $status The current theme status.
41+
* @global int $page The current page number.
4242
*
4343
* @param array $args An associative array of arguments.
4444
*/
@@ -70,15 +70,19 @@ public function __construct( $args = array() ) {
7070
}
7171

7272
/**
73-
* @return array
73+
* Gets the list of CSS classes for the table tag.
74+
*
75+
* @return string[] The list of CSS classes.
7476
*/
7577
protected function get_table_classes() {
7678
// @todo Remove and add CSS for .themes.
7779
return array( 'widefat', 'plugins' );
7880
}
7981

8082
/**
81-
* @return bool
83+
* Checks if the current user has permissions to perform AJAX actions.
84+
*
85+
* @return bool True if the current user has permissions, false otherwise.
8286
*/
8387
public function ajax_user_can() {
8488
if ( $this->is_site_themes ) {
@@ -89,12 +93,14 @@ public function ajax_user_can() {
8993
}
9094

9195
/**
92-
* @global string $status
93-
* @global array $totals
94-
* @global int $page
95-
* @global string $orderby
96-
* @global string $order
97-
* @global string $s
96+
* Prepares the themes list for display.
97+
*
98+
* @global string $status The current theme status.
99+
* @global array<string, int> $totals An array of theme counts for each status.
100+
* @global int $page The current page number.
101+
* @global string $orderby The column to order the themes list by.
102+
* @global string $order The order of the themes list (ASC or DESC).
103+
* @global string $s The search string.
98104
*/
99105
public function prepare_items() {
100106
global $status, $totals, $page, $orderby, $order, $s;
@@ -261,8 +267,10 @@ public function prepare_items() {
261267
}
262268

263269
/**
264-
* @param WP_Theme $theme
265-
* @return bool
270+
* Filters a theme by the search term.
271+
*
272+
* @param WP_Theme $theme The WP_Theme object to check.
273+
* @return bool True if the theme matches the search term, false otherwise.
266274
*/
267275
public function _search_callback( $theme ) {
268276
static $term = null;
@@ -290,11 +298,14 @@ public function _search_callback( $theme ) {
290298

291299
// Not used by any core columns.
292300
/**
293-
* @global string $orderby
294-
* @global string $order
295-
* @param array $theme_a
296-
* @param array $theme_b
297-
* @return int
301+
* Compares the order of two themes by a specific field.
302+
*
303+
* @global string $orderby The column to order the themes list by.
304+
* @global string $order The order of the themes list (ASC or DESC).
305+
*
306+
* @param WP_Theme $theme_a The first theme to compare.
307+
* @param WP_Theme $theme_b The second theme to compare.
308+
* @return int 0 if equal, -1 if the first is less than the second, 1 if more.
298309
*/
299310
public function _order_callback( $theme_a, $theme_b ) {
300311
global $orderby, $order;
@@ -308,6 +319,7 @@ public function _order_callback( $theme_a, $theme_b ) {
308319
}
309320

310321
/**
322+
* Displays the message when there are no items to list.
311323
*/
312324
public function no_items() {
313325
if ( $this->has_items ) {
@@ -318,7 +330,9 @@ public function no_items() {
318330
}
319331

320332
/**
321-
* @return string[] Array of column titles keyed by their column name.
333+
* Gets the list of columns for the list table.
334+
*
335+
* @return array<string, string> Array of column titles keyed by their column name.
322336
*/
323337
public function get_columns() {
324338
$columns = array(
@@ -335,7 +349,9 @@ public function get_columns() {
335349
}
336350

337351
/**
338-
* @return array
352+
* Gets the list of sortable columns for the list table.
353+
*
354+
* @return array<string, array<int, mixed>> An array of sortable columns.
339355
*/
340356
protected function get_sortable_columns() {
341357
return array(
@@ -355,9 +371,12 @@ protected function get_primary_column_name() {
355371
}
356372

357373
/**
358-
* @global array $totals
359-
* @global string $status
360-
* @return array
374+
* Gets the list of views (statuses) for the list table.
375+
*
376+
* @global array<string, int> $totals An array of theme counts for each status.
377+
* @global string $status The current theme status.
378+
*
379+
* @return array<string, string> The list of views.
361380
*/
362381
protected function get_views() {
363382
global $totals, $status;
@@ -451,9 +470,11 @@ protected function get_views() {
451470
}
452471

453472
/**
454-
* @global string $status
473+
* Gets the list of bulk actions for the list table.
474+
*
475+
* @global string $status The current theme status.
455476
*
456-
* @return array
477+
* @return array<string, string> The list of bulk actions.
457478
*/
458479
protected function get_bulk_actions() {
459480
global $status;
@@ -532,9 +553,9 @@ public function column_cb( $item ) {
532553
*
533554
* @since 4.3.0
534555
*
535-
* @global string $status
536-
* @global int $page
537-
* @global string $s
556+
* @global string $status The current theme status.
557+
* @global int $page The current page number.
558+
* @global string $s The search string.
538559
*
539560
* @param WP_Theme $theme The current WP_Theme object.
540561
*/
@@ -689,8 +710,8 @@ public function column_name( $theme ) {
689710
*
690711
* @since 4.3.0
691712
*
692-
* @global string $status
693-
* @global array $totals
713+
* @global string $status The current theme status.
714+
* @global array<string, int> $totals An array of theme counts for each status.
694715
*
695716
* @param WP_Theme $theme The current WP_Theme object.
696717
*/
@@ -777,8 +798,8 @@ public function column_description( $theme ) {
777798
*
778799
* @since 5.5.0
779800
*
780-
* @global string $status
781-
* @global int $page
801+
* @global string $status The current theme status.
802+
* @global int $page The current page number.
782803
*
783804
* @param WP_Theme $theme The current WP_Theme object.
784805
*/
@@ -979,10 +1000,12 @@ public function single_row_columns( $item ) {
9791000
}
9801001

9811002
/**
982-
* @global string $status
983-
* @global array $totals
1003+
* Handles the output for a single table row.
1004+
*
1005+
* @global string $status The current theme status.
1006+
* @global array<string, int> $totals An array of theme counts for each status.
9841007
*
985-
* @param WP_Theme $theme
1008+
* @param WP_Theme $theme The current WP_Theme object.
9861009
*/
9871010
public function single_row( $theme ) {
9881011
global $status, $totals;

0 commit comments

Comments
 (0)