From fa29d5bb80fdc2beb8913140f54238ae3951be76 Mon Sep 17 00:00:00 2001 From: Helen Hou-Sandi Date: Wed, 3 Jun 2015 15:07:22 +0000 Subject: [PATCH] List tables: tighten up primary column handling for plugins and multisite themes. These shouldn't be able to have their primary column reassigned by default. Also removes the `has-row-actions` class as these list tables always have row actions visible and the JS for visual toggling conflicts. The `column-primary` class remains. props stephdau. see #25408. git-svn-id: https://develop.svn.wordpress.org/trunk@32686 602fd350-edb4-49c9-b593-d223f7449a82 --- .../includes/class-wp-ms-themes-list-table.php | 17 +++++++++++------ .../includes/class-wp-plugins-list-table.php | 8 ++++---- 2 files changed, 15 insertions(+), 10 deletions(-) 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 8ab1881c11..5146e18a14 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 @@ -245,14 +245,14 @@ class WP_MS_Themes_List_Table extends WP_List_Table { } /** - * Get the name of the default primary column. + * Get the name of the primary column. * * @since 4.3.0 * @access protected * - * @return string Name of the default primary column name, in this case, 'name'. + * @return string Unalterable name of the primary column name, in this case, 'name'. */ - protected function get_default_primary_column_name() { + protected function get_primary_column_name() { return 'name'; } @@ -438,19 +438,24 @@ class WP_MS_Themes_List_Table extends WP_List_Table { if ( in_array( $column_name, $hidden ) ) $style = ' style="display:none;"'; + $extra_class = ''; + if ( $primary === $column_name ) { + $extra_class = ' column-primary'; + } + switch ( $column_name ) { case 'cb': echo "$checkbox"; break; case 'name': - echo "" . $theme->display('Name') . ""; + echo "" . $theme->display('Name') . ""; if ( $primary === $column_name ) { echo $this->row_actions($actions, true); } echo ""; break; case 'description': - echo ""; + echo ""; if ( $theme->errors() ) { $pre = $status == 'broken' ? __( 'Broken Theme:' ) . ' ' : ''; echo '

' . $pre . $theme->errors()->get_error_message() . '

'; @@ -492,7 +497,7 @@ class WP_MS_Themes_List_Table extends WP_List_Table { break; default: - echo ""; + echo ""; /** * Fires inside each custom column of the Multisite themes list table. 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 8424843317..1de524c2d6 100644 --- a/src/wp-admin/includes/class-wp-plugins-list-table.php +++ b/src/wp-admin/includes/class-wp-plugins-list-table.php @@ -581,7 +581,7 @@ class WP_Plugins_List_Table extends WP_List_Table { list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); - $extra_class = ' has-row-actions column-primary'; + $extra_class = ' column-primary'; foreach ( $columns as $column_name => $column_display_name ) { $style = ''; @@ -719,14 +719,14 @@ class WP_Plugins_List_Table extends WP_List_Table { } /** - * Get the name of default primary column for this specific list table. + * Get the name of primary column for this specific list table. * * @since 4.3.0 * @access protected * - * @return string Name for the default primary column, in this case, 'plugin'. + * @return string Unalterable name for the primary column, in this case, 'plugin'. */ - protected function get_default_primary_column_name() { + protected function get_primary_column_name() { return 'plugin'; } }