Introduce plugin icons in the installer.

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

props tellyworth.
see #28785.


git-svn-id: https://develop.svn.wordpress.org/trunk@29569 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2014-08-21 19:10:59 +00:00
parent f7c295be3e
commit 7a504df72a
2 changed files with 26 additions and 13 deletions

View File

@ -1297,16 +1297,12 @@ div.action-links,
}
.plugin-card h4 {
float: left;
margin: 0 0 12px;
font-size: 18px;
}
.plugin-card .desc {
clear: left;
}
.plugin-action-buttons {
clear: right;
float: right;
margin-left: 2em;
margin-bottom: 1em;
@ -1350,6 +1346,13 @@ div.action-links,
clear: right;
}
.plugin-icon {
width: 128px;
height: 128px;
float: left;
margin: 0 1em 1em 0;
}
/* ms */
/* Background Color for Site Status */
.wp-list-table .site-deleted {

View File

@ -98,7 +98,7 @@ class WP_Plugin_Install_List_Table extends WP_List_Table {
$args = array(
'page' => $paged,
'per_page' => $per_page,
'fields' => array( 'last_updated' => true, 'downloaded' => true ),
'fields' => array( 'last_updated' => true, 'downloaded' => true, 'icons' => true ),
// Send the locale and installed plugin slugs to the API so it can provide context-sensitive results.
'locale' => get_locale(),
'installed_plugins' => $this->get_installed_plugin_slugs(),
@ -398,6 +398,15 @@ class WP_Plugin_Install_List_Table extends WP_List_Table {
/* translators: 1: Plugin name and version. */
$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>';
if ( !empty( $plugin['icons']['svg'] ) ) {
$plugin_icon_url = $plugin['icons']['svg'];
} elseif ( !empty( $plugin['icons']['2x'] ) ) {
$plugin_icon_url = $plugin['icons']['2x'];
} elseif ( !empty( $plugin['icons']['1x'] ) ) {
$plugin_icon_url = $plugin['icons']['1x'];
} else {
$plugin_icon_url = $plugin['icons']['default'];
}
/**
* Filter the install action links for a plugin.
@ -411,15 +420,16 @@ class WP_Plugin_Install_List_Table extends WP_List_Table {
?>
<div class="plugin-card">
<div class="plugin-card-top">
<div class="name column-name">
<h4><a href="<?php echo esc_url( $details_link ); ?>" class="thickbox"><?php echo $title; ?></a></h4>
<a href="<?php echo esc_url( $details_link ); ?>" class="thickbox"><img src="<?php echo esc_attr( $plugin_icon_url ) ?>" class="plugin-icon" /></a>
<div class="action-links">
<?php
if ( ! empty( $action_links ) ) {
if ( $action_links ) {
echo '<ul class="plugin-action-buttons"><li>' . implode( '</li><li>', $action_links ) . '</li></ul>';
}
?>
</div>
<div class="name column-name">
<h4><a href="<?php echo esc_url( $details_link ); ?>" class="thickbox"><?php echo $title; ?></a></h4>
</div>
<div class="desc column-description">
<p><?php echo $description; ?></p>