List tables: Yet more primary column fallbacks.

Some custom list tables override enough methods for the column definition fallback to never kick in, so let's ensure that toggling columns only applies when a primary column is defined in some way. We also need to show a toggle button when we can when there are no row actions.

props Chouby, obenland, ocean90.
fixes #33313.


git-svn-id: https://develop.svn.wordpress.org/trunk@33623 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Helen Hou-Sandi 2015-08-17 15:37:03 +00:00
parent eea1678cd3
commit 3b1e1f0376
2 changed files with 5 additions and 6 deletions

View File

@ -1764,9 +1764,8 @@ div.action-links,
font-size: 14px;
}
.wp-list-table th:not(.column-primary),
.wp-list-table th:not(.column-primary),
.wp-list-table tr:not(.inline-edit-row):not(.no-items) td:not(.column-primary):not(.check-column) {
.wp-list-table th.column-primary ~ th,
.wp-list-table tr:not(.inline-edit-row):not(.no-items) td.column-primary ~ td:not(.check-column) {
display: none;
}
@ -1780,7 +1779,7 @@ div.action-links,
width: 35px;
}
.wp-list-table .toggle-row {
.wp-list-table .column-primary .toggle-row {
display: block;
}
@ -1795,7 +1794,7 @@ div.action-links,
padding-right: 50px; /* space for toggle button */
}
.wp-list-table tr:not(.inline-edit-row):not(.no-items) td:not(.column-primary):not(.check-column) {
.wp-list-table tr:not(.inline-edit-row):not(.no-items) td.column-primary ~ td:not(.check-column) {
padding: 3px 8px 3px 35%;
}

View File

@ -1258,7 +1258,7 @@ class WP_List_Table {
* @return string The row actions output. In this case, an empty string.
*/
protected function handle_row_actions( $item, $column_name, $primary ) {
return '';
return $column_name == $primary ? '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __( 'Show more details' ) . '</span></button>' : '';
}
/**