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
This commit is contained in:
Helen Hou-Sandi 2015-06-03 15:07:22 +00:00
parent ab747208b2
commit fa29d5bb80
2 changed files with 15 additions and 10 deletions

View File

@ -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 "<th scope='row' class='check-column'>$checkbox</th>";
break;
case 'name':
echo "<td class='theme-title'$style><strong>" . $theme->display('Name') . "</strong>";
echo "<td class='theme-title{$extra_class}'$style><strong>" . $theme->display('Name') . "</strong>";
if ( $primary === $column_name ) {
echo $this->row_actions($actions, true);
}
echo "</td>";
break;
case 'description':
echo "<td class='column-description desc'$style>";
echo "<td class='column-description desc{$extra_class}'$style>";
if ( $theme->errors() ) {
$pre = $status == 'broken' ? __( 'Broken Theme:' ) . ' ' : '';
echo '<p><strong class="attention">' . $pre . $theme->errors()->get_error_message() . '</strong></p>';
@ -492,7 +497,7 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
break;
default:
echo "<td class='$column_name column-$column_name'$style>";
echo "<td class='$column_name column-$column_name{$extra_class}'$style>";
/**
* Fires inside each custom column of the Multisite themes list table.

View File

@ -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';
}
}