Rework WP_MS_Themes_List_Table column display. Props ocean90. See #15318

git-svn-id: https://develop.svn.wordpress.org/trunk@16361 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
scribu 2010-11-13 23:47:14 +00:00
parent c38380fd8f
commit fcef01b720
1 changed files with 77 additions and 54 deletions

View File

@ -250,6 +250,11 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
}
function display_rows() {
foreach ( $this->items as $key => $theme )
$this->single_row( $key, $theme );
}
function single_row( $key, $theme ) {
global $status, $page, $s;
$context = $status;
@ -259,7 +264,6 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
else
$url = 'themes.php?';
foreach ( $this->items as $key => $theme ) {
// preorder
$actions = array(
'enable' => '',
@ -281,28 +285,37 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
$actions = apply_filters( "theme_action_links_$theme_key", $actions, $theme_key, $theme, $context );
$class = empty( $theme['enabled'] ) ? 'inactive' : 'active';
$checkbox = "<input type='checkbox' name='checked[]' value='" . esc_attr( $theme_key ) . "' />";
$checkbox_id = md5($theme['Name']) . "_checkbox";
$checkbox = "<input type='checkbox' name='checked[]' value='" . esc_attr( $theme_key ) . "' id='" . $checkbox_id . "' /><label class='screen-reader-text' for='" . $checkbox_id . "' >" . __('Select') . " " . $theme['Name'] . "</label>";
$description = '<p>' . $theme['Description'] . '</p>';
$theme_name = $theme['Name'];
$id = sanitize_title( $theme_name );
echo "
<tr id='$id' class='$class'>
<th scope='row' class='check-column'>$checkbox</th>
<td class='theme-title'><strong>$theme_name</strong></td>
<td class='desc'>$description</td>
</tr>
<tr class='$class second'>
<td></td>
<td class='theme-title'>";
echo "<tr id='$id' class='$class'>";
list( $columns, $hidden ) = $this->get_column_info();
foreach ( $columns as $column_name => $column_display_name ) {
$style = '';
if ( in_array( $column_name, $hidden ) )
$style = ' style="display:none;"';
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_name</strong>";
echo $this->row_actions( $actions, true );
echo "</td>";
break;
case 'description':
echo "<td class='column-description desc'$style>
<div class='theme-description'>$description</div>
<div class='$class second theme-version-author-uri'>";
echo "</td>
<td class='desc'>";
$theme_meta = array();
if ( !empty( $theme['Version'] ) )
$theme_meta[] = sprintf( __( 'Version %s' ), $theme['Version'] );
@ -317,12 +330,22 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
$theme_meta = apply_filters( 'theme_row_meta', $theme_meta, $theme_key, $theme, $status );
echo implode( ' | ', $theme_meta );
echo "</td>
</tr>\n";
echo "</div></td>";
break;
break;
default:
echo "<td class='$column_name column-$column_name'$style>";
do_action( 'manage_themes_custom_column', $column_name, $theme_key, $theme );
echo "</td>";
}
}
echo "</tr>";
do_action( 'after_theme_row', $theme_key, $theme, $status );
do_action( "after_theme_row_$theme_key", $theme_key, $theme, $status );
}
}
}
?>