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.



git-svn-id: https://develop.svn.wordpress.org/trunk@41695 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Gary Pendergast
2017-10-03 00:24:31 +00:00
parent 88db798f62
commit 942482993d
3 changed files with 43 additions and 10 deletions

View File

@@ -252,6 +252,11 @@ function list_plugin_updates() {
foreach ( (array) $plugins as $plugin_file => $plugin_data ) {
$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.
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);
@@ -302,6 +307,7 @@ function list_plugin_updates() {
?></label>
</td>
<td class="plugin-title"><p>
<?php echo $icon; ?>
<strong><?php echo $plugin_data->Name; ?></strong>
<?php
/* translators: 1: plugin version, 2: new version */