Plugins: Add plugin icons to the plugin list tables.

To mirror theme list table behaviour, the plugin icon now appears next to plugins in the plugin list tables. For plugins that don't have an icon, or non-W.org plugins, a fallback dashicon is shown.

Props melchoyce, afercia, paulwilde, pento, obenland.
Fixes #30186.


Built from https://develop.svn.wordpress.org/trunk@41695


git-svn-id: http://core.svn.wordpress.org/trunk@41529 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Gary Pendergast 2017-10-03 00:25:46 +00:00
parent 8d79246606
commit 7e33702830
7 changed files with 72 additions and 20 deletions

View File

@ -1286,15 +1286,34 @@ ul.cat-checklist {
border-right: 4px solid #00a0d2; border-right: 4px solid #00a0d2;
} }
#wpbody-content .plugins .plugin-title, .wp-list-table.plugins .plugin-title,
#wpbody-content .plugins .theme-title { .wp-list-table.plugins .theme-title {
padding-left: 12px; white-space: nowrap;
white-space:nowrap;
} }
.updates-table-screenshot { .wp-list-table.plugins .theme-title {
float:right; padding-left: 12px;
padding: 0 0 5px 10px; }
.wp-list-table.plugins .plugin-title {
padding-left: 86px; /* 64 (icon width) + 10 (icon padding) + 12 (title padding) = 86 */
}
.plugins .plugin-title img,
.plugins .plugin-title .dashicons {
float: right;
padding: 0 0 0 10px;
width: 64px;
height: 64px;
}
.plugins .plugin-title .dashicons:before {
font-size: 64px;
}
#update-themes-table .plugin-title img,
#update-themes-table .plugin-title .dashicons {
width: 85px;
} }
.plugins .inactive .plugin-title strong { .plugins .inactive .plugin-title strong {

File diff suppressed because one or more lines are too long

View File

@ -1286,15 +1286,34 @@ ul.cat-checklist {
border-left: 4px solid #00a0d2; border-left: 4px solid #00a0d2;
} }
#wpbody-content .plugins .plugin-title, .wp-list-table.plugins .plugin-title,
#wpbody-content .plugins .theme-title { .wp-list-table.plugins .theme-title {
padding-right: 12px; white-space: nowrap;
white-space:nowrap;
} }
.updates-table-screenshot { .wp-list-table.plugins .theme-title {
float:left; padding-right: 12px;
padding: 0 10px 5px 0; }
.wp-list-table.plugins .plugin-title {
padding-right: 86px; /* 64 (icon width) + 10 (icon padding) + 12 (title padding) = 86 */
}
.plugins .plugin-title img,
.plugins .plugin-title .dashicons {
float: left;
padding: 0 10px 0 0;
width: 64px;
height: 64px;
}
.plugins .plugin-title .dashicons:before {
font-size: 64px;
}
#update-themes-table .plugin-title img,
#update-themes-table .plugin-title .dashicons {
width: 85px;
} }
.plugins .inactive .plugin-title strong { .plugins .inactive .plugin-title strong {

File diff suppressed because one or more lines are too long

View File

@ -751,9 +751,17 @@ class WP_Plugins_List_Table extends WP_List_Table {
echo "<th scope='row' class='check-column'>$checkbox</th>"; echo "<th scope='row' class='check-column'>$checkbox</th>";
break; break;
case 'name': case 'name':
echo "<td class='plugin-title column-primary'><strong>$plugin_name</strong>"; $icon = '<span class="dashicons dashicons-admin-plugins"></span>';
echo $this->row_actions( $actions, true ); if ( ! empty( $plugin_data['icons']['default'] ) ) {
echo "</td>"; $icon = '<img src="' . esc_url( $plugin_data['icons']['default'] ) . '" alt="" />';
}
?>
<td class="plugin-title column-primary">
<?php echo $icon; ?>
<strong><?php echo $plugin_name; ?></strong>
<?php echo $this->row_actions( $actions, true ); ?>
</td>
<?php
break; break;
case 'description': case 'description':
$classes = 'column-description desc'; $classes = 'column-description desc';

View File

@ -252,6 +252,11 @@ function list_plugin_updates() {
foreach ( (array) $plugins as $plugin_file => $plugin_data ) { foreach ( (array) $plugins as $plugin_file => $plugin_data ) {
$plugin_data = (object) _get_plugin_data_markup_translate( $plugin_file, (array) $plugin_data, false, true ); $plugin_data = (object) _get_plugin_data_markup_translate( $plugin_file, (array) $plugin_data, false, true );
$icon = '<span class="dashicons dashicons-admin-plugins"></span>';
if ( ! empty( $plugin_data->update->icons['default'] ) ) {
$icon = '<img src="' . esc_url( $plugin_data->update->icons['default'] ) . '" alt="" />';
}
// Get plugin compat for running version of WordPress. // Get plugin compat for running version of WordPress.
if ( isset($plugin_data->update->tested) && version_compare($plugin_data->update->tested, $cur_wp_version, '>=') ) { if ( isset($plugin_data->update->tested) && version_compare($plugin_data->update->tested, $cur_wp_version, '>=') ) {
$compat = '<br />' . sprintf(__('Compatibility with WordPress %1$s: 100%% (according to its author)'), $cur_wp_version); $compat = '<br />' . sprintf(__('Compatibility with WordPress %1$s: 100%% (according to its author)'), $cur_wp_version);
@ -302,6 +307,7 @@ function list_plugin_updates() {
?></label> ?></label>
</td> </td>
<td class="plugin-title"><p> <td class="plugin-title"><p>
<?php echo $icon; ?>
<strong><?php echo $plugin_data->Name; ?></strong> <strong><?php echo $plugin_data->Name; ?></strong>
<?php <?php
/* translators: 1: plugin version, 2: new version */ /* translators: 1: plugin version, 2: new version */

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.9-alpha-41694'; $wp_version = '4.9-alpha-41695';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.