From 942482993d599d14f8a448e5f8fec40ebbbcdaf9 Mon Sep 17 00:00:00 2001 From: Gary Pendergast Date: Tue, 3 Oct 2017 00:24:31 +0000 Subject: [PATCH] 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 --- src/wp-admin/css/list-tables.css | 33 +++++++++++++++---- .../includes/class-wp-plugins-list-table.php | 14 ++++++-- src/wp-admin/update-core.php | 6 ++++ 3 files changed, 43 insertions(+), 10 deletions(-) diff --git a/src/wp-admin/css/list-tables.css b/src/wp-admin/css/list-tables.css index 8fc1020316..7adf9f4386 100644 --- a/src/wp-admin/css/list-tables.css +++ b/src/wp-admin/css/list-tables.css @@ -1286,15 +1286,34 @@ ul.cat-checklist { border-left: 4px solid #00a0d2; } -#wpbody-content .plugins .plugin-title, -#wpbody-content .plugins .theme-title { - padding-right: 12px; - white-space:nowrap; +.wp-list-table.plugins .plugin-title, +.wp-list-table.plugins .theme-title { + white-space: nowrap; } -.updates-table-screenshot { - float:left; - padding: 0 10px 5px 0; +.wp-list-table.plugins .theme-title { + padding-right: 12px; +} + +.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 { diff --git a/src/wp-admin/includes/class-wp-plugins-list-table.php b/src/wp-admin/includes/class-wp-plugins-list-table.php index 2cc6c77df1..6687739657 100644 --- a/src/wp-admin/includes/class-wp-plugins-list-table.php +++ b/src/wp-admin/includes/class-wp-plugins-list-table.php @@ -751,9 +751,17 @@ class WP_Plugins_List_Table extends WP_List_Table { echo "$checkbox"; break; case 'name': - echo "$plugin_name"; - echo $this->row_actions( $actions, true ); - echo ""; + $icon = ''; + if ( ! empty( $plugin_data['icons']['default'] ) ) { + $icon = ''; + } + ?> + + + + row_actions( $actions, true ); ?> + + $plugin_data ) { $plugin_data = (object) _get_plugin_data_markup_translate( $plugin_file, (array) $plugin_data, false, true ); + $icon = ''; + if ( ! empty( $plugin_data->update->icons['default'] ) ) { + $icon = ''; + } + // Get plugin compat for running version of WordPress. if ( isset($plugin_data->update->tested) && version_compare($plugin_data->update->tested, $cur_wp_version, '>=') ) { $compat = '
' . sprintf(__('Compatibility with WordPress %1$s: 100%% (according to its author)'), $cur_wp_version); @@ -302,6 +307,7 @@ function list_plugin_updates() { ?>

+ Name; ?>