Make WordPress Core

Ticket #51553: WP_ListTable-column_width.diff

File WP_ListTable-column_width.diff, 9.4 KB (added by hellofromTonya, 3 years ago)

WP_List_Table::column_default(): fix parameters name mismatches (task 1)

  • src/wp-admin/includes/class-wp-comments-list-table.php

    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 d62020039d..a027e800cd 100644
    a b class WP_Comments_List_Table extends WP_List_Table { 
    10471047        }
    10481048
    10491049        /**
    1050          * @param WP_Comment $comment     The comment object.
     1050         * @since 5.9.0 Renamed `$comment` to `$item` to match parent class for PHP 8 named param.
     1051         *
     1052         * @param WP_Comment $item        The comment object.
    10511053         * @param string     $column_name The custom column's name.
    10521054         */
    1053         public function column_default( $comment, $column_name ) {
     1055        public function column_default( $item, $column_name ) {
    10541056                /**
    10551057                 * Fires when the default column output is displayed for a single row.
    10561058                 *
    class WP_Comments_List_Table extends WP_List_Table { 
    10591061                 * @param string $column_name The custom column's name.
    10601062                 * @param int    $comment_id  The custom column's unique ID number.
    10611063                 */
    1062                 do_action( 'manage_comments_custom_column', $column_name, $comment->comment_ID );
     1064                do_action( 'manage_comments_custom_column', $column_name, $item->comment_ID );
    10631065        }
    10641066}
  • src/wp-admin/includes/class-wp-links-list-table.php

    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 b867a8ad19..60ba8ed778 100644
    a b class WP_Links_List_Table extends WP_List_Table { 
    279279         * Handles the default column output.
    280280         *
    281281         * @since 4.3.0
     282         * @since 5.9.0 Renamed `$link` to `$item` to match parent class for PHP 8 named param.
    282283         *
    283          * @param object $link        Link object.
     284         * @param object $item        Link object.
    284285         * @param string $column_name Current column name.
    285286         */
    286         public function column_default( $link, $column_name ) {
     287        public function column_default( $item, $column_name ) {
    287288                /**
    288289                 * Fires for each registered custom link column.
    289290                 *
    class WP_Links_List_Table extends WP_List_Table { 
    292293                 * @param string $column_name Name of the custom column.
    293294                 * @param int    $link_id     Link ID.
    294295                 */
    295                 do_action( 'manage_link_custom_column', $column_name, $link->link_id );
     296                do_action( 'manage_link_custom_column', $column_name, $item->link_id );
    296297        }
    297298
    298299        public function display_rows() {
  • src/wp-admin/includes/class-wp-media-list-table.php

    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 275d07caca..6c0a499001 100644
    a b class WP_Media_List_Table extends WP_List_Table { 
    594594         * Handles output for the default column.
    595595         *
    596596         * @since 4.3.0
     597         * @since 5.9.0 Renamed `$post` to `$item` to match parent class for PHP 8 named param.
    597598         *
    598          * @param WP_Post $post        The current WP_Post object.
     599         * @param WP_Post $item        The current WP_Post object.
    599600         * @param string  $column_name Current column name.
    600601         */
    601         public function column_default( $post, $column_name ) {
     602        public function column_default( $item, $column_name ) {
     603                // Restores the more descriptive, specific name for use within this method.
     604                $post = $item;
     605
    602606                if ( 'categories' === $column_name ) {
    603607                        $taxonomy = 'category';
    604608                } elseif ( 'tags' === $column_name ) {
  • src/wp-admin/includes/class-wp-ms-sites-list-table.php

    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 b928ee92c6..02f7938ead 100644
    a b class WP_MS_Sites_List_Table extends WP_List_Table { 
    560560         * Handles output for the default column.
    561561         *
    562562         * @since 4.3.0
     563         * @since 5.9.0 Renamed `$blog` to `$item` to match parent class for PHP 8 named param.
    563564         *
    564          * @param array  $blog        Current site.
     565         * @param array  $item        Current site.
    565566         * @param string $column_name Current column name.
    566567         */
    567         public function column_default( $blog, $column_name ) {
     568        public function column_default( $item, $column_name ) {
    568569                /**
    569570                 * Fires for each registered custom column in the Sites list table.
    570571                 *
    class WP_MS_Sites_List_Table extends WP_List_Table { 
    573574                 * @param string $column_name The name of the column to display.
    574575                 * @param int    $blog_id     The site ID.
    575576                 */
    576                 do_action( 'manage_sites_custom_column', $column_name, $blog['blog_id'] );
     577                do_action( 'manage_sites_custom_column', $column_name, $item['blog_id'] );
    577578        }
    578579
    579580        /**
  • src/wp-admin/includes/class-wp-ms-themes-list-table.php

    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 d7d20e238a..d4ad43df57 100644
    a b class WP_MS_Themes_List_Table extends WP_List_Table { 
    855855         * Handles default column output.
    856856         *
    857857         * @since 4.3.0
     858         * @since 5.9.0 Renamed `$theme` to `$item` to match parent class for PHP 8 named param.
    858859         *
    859          * @param WP_Theme $theme       The current WP_Theme object.
     860         * @param WP_Theme $item        The current WP_Theme object.
    860861         * @param string   $column_name The current column name.
    861862         */
    862         public function column_default( $theme, $column_name ) {
    863                 $stylesheet = $theme->get_stylesheet();
    864 
     863        public function column_default( $item, $column_name ) {
    865864                /**
    866865                 * Fires inside each custom column of the Multisite themes list table.
    867866                 *
    class WP_MS_Themes_List_Table extends WP_List_Table { 
    871870                 * @param string   $stylesheet  Directory name of the theme.
    872871                 * @param WP_Theme $theme       Current WP_Theme object.
    873872                 */
    874                 do_action( 'manage_themes_custom_column', $column_name, $stylesheet, $theme );
     873                do_action(
     874                        'manage_themes_custom_column',
     875                        $column_name,
     876                        $item->get_stylesheet(), // Directory name of the theme.
     877                        $item // Theme object.
     878                );
    875879        }
    876880
    877881        /**
  • src/wp-admin/includes/class-wp-ms-users-list-table.php

    diff --git a/src/wp-admin/includes/class-wp-ms-users-list-table.php b/src/wp-admin/includes/class-wp-ms-users-list-table.php
    index 8e1656ed6c..825f8e86ef 100644
    a b class WP_MS_Users_List_Table extends WP_List_Table { 
    442442         * Handles the default column output.
    443443         *
    444444         * @since 4.3.0
     445         * @since 5.9.0 Renamed `$user` to `$item` to match parent class for PHP 8 named param.
    445446         *
    446          * @param WP_User $user        The current WP_User object.
     447         * @param WP_User $item        The current WP_User object.
    447448         * @param string  $column_name The current column name.
    448449         */
    449         public function column_default( $user, $column_name ) {
     450        public function column_default( $item, $column_name ) {
    450451                /** This filter is documented in wp-admin/includes/class-wp-users-list-table.php */
    451                 echo apply_filters( 'manage_users_custom_column', '', $column_name, $user->ID );
     452                echo apply_filters(
     453                        'manage_users_custom_column',
     454                        '', // Custom column output. Default empty.
     455                        $column_name,
     456                        $item->ID // User ID.
     457                );
    452458        }
    453459
    454460        public function display_rows() {
  • src/wp-admin/includes/class-wp-posts-list-table.php

    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 f8687efb95..9b3a03b1c0 100644
    a b class WP_Posts_List_Table extends WP_List_Table { 
    12351235         * Handles the default column output.
    12361236         *
    12371237         * @since 4.3.0
     1238         * @since 5.9.0 Renamed `$post` to `$item` to match parent class for PHP 8 named param.
    12381239         *
    1239          * @param WP_Post $post        The current WP_Post object.
     1240         * @param WP_Post $item        The current WP_Post object.
    12401241         * @param string  $column_name The current column name.
    12411242         */
    1242         public function column_default( $post, $column_name ) {
     1243        public function column_default( $item, $column_name ) {
     1244                // Restores the more descriptive, specific name for use within this method.
     1245                $post = $item;
     1246
    12431247                if ( 'categories' === $column_name ) {
    12441248                        $taxonomy = 'category';
    12451249                } elseif ( 'tags' === $column_name ) {
  • src/wp-admin/includes/class-wp-terms-list-table.php

    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 f6697f13a9..ef4b37ee4d 100644
    a b class WP_Terms_List_Table extends WP_List_Table { 
    620620        }
    621621
    622622        /**
    623          * @param WP_Term $tag         Term object.
     623         * @since 5.9.0 Renamed `$tag` to `$item` to match parent class for PHP 8 named param.
     624         *
     625         * @param WP_Term $item        Term object.
    624626         * @param string  $column_name Name of the column.
    625627         * @return string
    626628         */
    627         public function column_default( $tag, $column_name ) {
     629        public function column_default( $item, $column_name ) {
    628630                /**
    629631                 * Filters the displayed columns in the terms list table.
    630632                 *
    class WP_Terms_List_Table extends WP_List_Table { 
    638640                 *
    639641                 * @since 2.8.0
    640642                 *
    641                  * @param string $string      Blank string.
     643                 * @param string $string      Custom column output. Default empty.
    642644                 * @param string $column_name Name of the column.
    643645                 * @param int    $term_id     Term ID.
    644646                 */
    645                 return apply_filters( "manage_{$this->screen->taxonomy}_custom_column", '', $column_name, $tag->term_id );
     647                return apply_filters( "manage_{$this->screen->taxonomy}_custom_column", '', $column_name, $item->term_id );
    646648        }
    647649
    648650        /**