Make WordPress Core


Ignore:
Timestamp:
08/21/2014 07:10:59 PM (12 years ago)
Author:
nacin
Message:

Introduce plugin icons in the installer.

See ​http://wp.me/p2AvED-2P8 for the announcement and how to implement these.

props tellyworth.
see #28785.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-plugin-install-list-table.php

    r29498 r29569  
    9999                        'page' => $paged,
    100100                        'per_page' => $per_page,
    101                         'fields' => array( 'last_updated' => true, 'downloaded' => true ),
     101                        'fields' => array( 'last_updated' => true, 'downloaded' => true, 'icons' => true ),
    102102                        // Send the locale and installed plugin slugs to the API so it can provide context-sensitive results.
    103103                        'locale' => get_locale(),
    … …  
    399399                        $action_links[] = '<a href="' . esc_url( $details_link ) . '" class="thickbox" aria-label="' . esc_attr( sprintf( __( 'More information about %s' ), $name ) ) . '" data-title="' . esc_attr( $name ) . '">' . __( 'More Details' ) . '</a>';
    400400
     401                        if ( !empty( $plugin['icons']['svg'] ) ) {
     402                                $plugin_icon_url = $plugin['icons']['svg'];
     403                        } elseif ( !empty( $plugin['icons']['2x'] ) ) {
     404                                $plugin_icon_url = $plugin['icons']['2x'];
     405                        } elseif ( !empty( $plugin['icons']['1x'] ) ) {
     406                                $plugin_icon_url = $plugin['icons']['1x'];
     407                        } else {
     408                                $plugin_icon_url = $plugin['icons']['default'];
     409                        }
    401410
    402411                        /**
    … …  
    412421                <div class="plugin-card">
    413422                        <div class="plugin-card-top">
     423                                <a href="<?php echo esc_url( $details_link ); ?>" class="thickbox"><img src="<?php echo esc_attr( $plugin_icon_url ) ?>" class="plugin-icon" /></a>
     424                                <div class="action-links">
     425                                        <?php
     426                                                if ( $action_links ) {
     427                                                        echo '<ul class="plugin-action-buttons"><li>' . implode( '</li><li>', $action_links ) . '</li></ul>';
     428                                                }
     429                                        ?>
     430                                </div>
    414431                                <div class="name column-name">
    415432                                        <h4><a href="<?php echo esc_url( $details_link ); ?>" class="thickbox"><?php echo $title; ?></a></h4>
    416                                         <div class="action-links">
    417                                                 <?php
    418                                                         if ( ! empty( $action_links ) ) {
    419                                                                 echo '<ul class="plugin-action-buttons"><li>' . implode( '</li><li>', $action_links ) . '</li></ul>';
    420                                                         }
    421                                                 ?>
    422                                         </div>
    423433                                </div>
    424434                                <div class="desc column-description">
Note: See TracChangeset for help on using the changeset viewer.