Make WordPress Core

Changeset 41695


Ignore:
Timestamp:
10/03/2017 12:24:31 AM (9 years ago)
Author:
pento
Message:

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.

Location:
trunk/src/wp-admin
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/css/list-tables.css

    r41684 r41695  
    12871287}
    12881288
    1289 #wpbody-content .plugins .plugin-title,
    1290 #wpbody-content .plugins .theme-title {
     1289.wp-list-table.plugins .plugin-title,
     1290.wp-list-table.plugins .theme-title {
     1291        white-space: nowrap;
     1292}
     1293
     1294.wp-list-table.plugins .theme-title {
    12911295        padding-right: 12px;
    1292         white-space:nowrap;
    1293 }
    1294 
    1295 .updates-table-screenshot {
    1296         float:left;
    1297         padding: 0 10px 5px 0;
     1296}
     1297
     1298.wp-list-table.plugins .plugin-title {
     1299        padding-right: 86px; /* 64 (icon width) + 10 (icon padding) + 12 (title padding) = 86 */
     1300}
     1301
     1302.plugins .plugin-title img,
     1303.plugins .plugin-title .dashicons {
     1304        float: left;
     1305        padding: 0 10px 0 0;
     1306        width: 64px;
     1307        height: 64px;
     1308}
     1309
     1310.plugins .plugin-title .dashicons:before {
     1311        font-size: 64px;
     1312}
     1313
     1314#update-themes-table .plugin-title img,
     1315#update-themes-table .plugin-title .dashicons {
     1316        width: 85px;
    12981317}
    12991318
  • trunk/src/wp-admin/includes/class-wp-plugins-list-table.php

    r41683 r41695  
    752752                                        break;
    753753                                case 'name':
    754                                         echo "<td class='plugin-title column-primary'><strong>$plugin_name</strong>";
    755                                         echo $this->row_actions( $actions, true );
    756                                         echo "</td>";
     754                                        $icon = '<span class="dashicons dashicons-admin-plugins"></span>';
     755                                        if ( ! empty( $plugin_data['icons']['default'] ) ) {
     756                                                $icon = '<img src="' . esc_url( $plugin_data['icons']['default'] ) . '" alt="" />';
     757                                        }
     758                                        ?>
     759                                        <td class="plugin-title column-primary">
     760                                                <?php echo $icon; ?>
     761                                                <strong><?php echo $plugin_name; ?></strong>
     762                                                <?php echo $this->row_actions( $actions, true ); ?>
     763                                        </td>
     764                                        <?php
    757765                                        break;
    758766                                case 'description':
  • trunk/src/wp-admin/update-core.php

    r41268 r41695  
    253253                $plugin_data = (object) _get_plugin_data_markup_translate( $plugin_file, (array) $plugin_data, false, true );
    254254
     255                $icon = '<span class="dashicons dashicons-admin-plugins"></span>';
     256                if ( ! empty( $plugin_data->update->icons['default'] ) ) {
     257                        $icon = '<img src="' . esc_url( $plugin_data->update->icons['default'] ) . '" alt="" />';
     258                }
     259
    255260                // Get plugin compat for running version of WordPress.
    256261                if ( isset($plugin_data->update->tested) && version_compare($plugin_data->update->tested, $cur_wp_version, '>=') ) {
    … …  
    303308                        </td>
    304309                        <td class="plugin-title"><p>
     310                                <?php echo $icon; ?>
    305311                                <strong><?php echo $plugin_data->Name; ?></strong>
    306312                                <?php
Note: See TracChangeset for help on using the changeset viewer.