Skip to content

Commit

Permalink
Docs: Synchronize @return descriptions for ::handle_row_actions()
Browse files Browse the repository at this point in the history
… methods in list tables.

Make sure `WP_Comments_List_Table::handle_row_actions()` and `WP_MS_Sites_List_Table::handle_row_actions()` return a string, for consistency with other classes.

See #49170, #48303.

git-svn-id: https://develop.svn.wordpress.org/trunk@47059 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
SergeyBiryukov committed Jan 11, 2020
1 parent 1824604 commit f9e52f8
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 9 deletions.
6 changes: 4 additions & 2 deletions src/wp-admin/includes/class-wp-comments-list-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,9 @@ public function single_row( $item ) {
* @param WP_Comment $comment The comment object.
* @param string $column_name Current column name.
* @param string $primary Primary column name.
* @return string|void Comment row actions output.
* @return string Row actions output for comments. An empty string
* if the current column is not the primary column,
* or if the current user cannot edit the comment.
*/
protected function handle_row_actions( $comment, $column_name, $primary ) {
global $comment_status;
Expand All @@ -586,7 +588,7 @@ protected function handle_row_actions( $comment, $column_name, $primary ) {
}

if ( ! $this->user_can ) {
return;
return '';
}

$the_comment_status = wp_get_comment_status( $comment );
Expand Down
3 changes: 2 additions & 1 deletion src/wp-admin/includes/class-wp-links-list-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,8 @@ public function display_rows() {
* @param object $link Link being acted upon.
* @param string $column_name Current column name.
* @param string $primary Primary column name.
* @return string Row action output for links.
* @return string Row actions output for links, or an empty string
* if the current column is not the primary column.
*/
protected function handle_row_actions( $link, $column_name, $primary ) {
if ( $primary !== $column_name ) {
Expand Down
4 changes: 3 additions & 1 deletion src/wp-admin/includes/class-wp-media-list-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -781,14 +781,16 @@ private function _get_row_actions( $post, $att_title ) {
* @param object $post Attachment being acted upon.
* @param string $column_name Current column name.
* @param string $primary Primary column name.
* @return string Row actions output for media attachments.
* @return string Row actions output for media attachments, or an empty string
* if the current column is not the primary column.
*/
protected function handle_row_actions( $post, $column_name, $primary ) {
if ( $primary !== $column_name ) {
return '';
}

$att_title = _draft_or_post_title();

return $this->row_actions( $this->_get_row_actions( $post, $att_title ) );
}
}
6 changes: 4 additions & 2 deletions src/wp-admin/includes/class-wp-ms-sites-list-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -666,11 +666,12 @@ protected function get_default_primary_column_name() {
* @param object $blog Site being acted upon.
* @param string $column_name Current column name.
* @param string $primary Primary column name.
* @return string Row actions output.
* @return string Row actions output for sites in Multisite, or an empty string
* if the current column is not the primary column.
*/
protected function handle_row_actions( $blog, $column_name, $primary ) {
if ( $primary !== $column_name ) {
return;
return '';
}

$blogname = untrailingslashit( $blog['domain'] . $blog['path'] );
Expand Down Expand Up @@ -733,6 +734,7 @@ protected function handle_row_actions( $blog, $column_name, $primary ) {
* or subdirectory multisite installation.
*/
$actions = apply_filters( 'manage_sites_action_links', array_filter( $actions ), $blog['blog_id'], $blogname );

return $this->row_actions( $actions );
}
}
4 changes: 3 additions & 1 deletion src/wp-admin/includes/class-wp-ms-users-list-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,8 @@ protected function get_default_primary_column_name() {
* @param object $user User being acted upon.
* @param string $column_name Current column name.
* @param string $primary Primary column name.
* @return string Row actions output for users in Multisite.
* @return string Row actions output for users in Multisite, or an empty string
* if the current column is not the primary column.
*/
protected function handle_row_actions( $user, $column_name, $primary ) {
if ( $primary !== $column_name ) {
Expand Down Expand Up @@ -517,6 +518,7 @@ protected function handle_row_actions( $user, $column_name, $primary ) {
* @param WP_User $user WP_User object.
*/
$actions = apply_filters( 'ms_user_row_actions', $actions, $user );

return $this->row_actions( $actions );
}
}
3 changes: 2 additions & 1 deletion src/wp-admin/includes/class-wp-posts-list-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -1320,7 +1320,8 @@ protected function get_default_primary_column_name() {
* @param object $post Post being acted upon.
* @param string $column_name Current column name.
* @param string $primary Primary column name.
* @return string Row actions output for posts.
* @return string Row actions output for posts, or an empty string
* if the current column is not the primary column.
*/
protected function handle_row_actions( $post, $column_name, $primary ) {
if ( $primary !== $column_name ) {
Expand Down
3 changes: 2 additions & 1 deletion src/wp-admin/includes/class-wp-terms-list-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,8 @@ protected function get_default_primary_column_name() {
* @param WP_Term $tag Tag being acted upon.
* @param string $column_name Current column name.
* @param string $primary Primary column name.
* @return string Row actions output for terms.
* @return string Row actions output for terms, or an empty string
* if the current column is not the primary column.
*/
protected function handle_row_actions( $tag, $column_name, $primary ) {
if ( $primary !== $column_name ) {
Expand Down

0 comments on commit f9e52f8

Please sign in to comment.