Making WordPress.org

Changeset 10036


Ignore:
Timestamp:
07/08/2020 05:06:56 PM (6 years ago)
Author:
ryelle
Message:

Plugin Directory: UI Improvements for reviewer section

See #5306

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-block-validator.php

    r10033 r10036  
    8989                }
    9090
     91                $results_by_type = array();
     92                foreach ( $results as $item ) {
     93                        $results_by_type[ $item->type ][] = $item;
     94                }
     95
    9196                if ( $checker->slug ) {
    9297                        $plugin = Plugin_Directory::get_plugin_post( $checker->slug );
    9398                        if ( current_user_can( 'edit_post', $plugin->ID ) ) {
    9499                                echo '<form method="post">';
    95                                 echo '<fieldset>';
    96                                 echo '<legend>' . __( 'Plugin Review Tools', 'wporg-plugins' ) . '</legend>';
     100                                echo '<h3>' . __( 'Plugin Review Tools', 'wporg-plugins' ) . '</h3>';
    97101                                echo wp_nonce_field( 'block-directory-edit-' . $plugin->ID, 'block-directory-nonce' );
    98102                                echo '<input type="hidden" name="plugin-id" value="' . esc_attr( $plugin->ID ) . '" />';
    99                                 if ( self::plugin_is_in_block_directory( $checker->slug ) ) {
    100                                         echo '<button type="submit" name="block-directory-edit" value="remove">' . __( 'Remove from Block Directory', 'wporg-plugins' ) . '</button>';
     103                                echo '<p>';
     104                                if ( ! empty( $results_by_type['error'] ) ) {
     105                                        printf( __( "%s can't be added to the block directory, due to errors in validation.", 'wporg-plugins' ), $plugin->post_title );
     106                                } else if ( self::plugin_is_in_block_directory( $checker->slug ) ) {
     107                                        echo '<button type="submit" name="block-directory-edit" value="remove">' . sprintf( __( 'Remove %s from Block Directory', 'wporg-plugins' ), $plugin->post_title ) . '</button>';
    101108                                } else {
    102                                         echo '<button type="submit" name="block-directory-edit" value="add">' . __( 'Add to Block Directory', 'wporg-plugins' ) . '</button>';
     109                                        echo '<button type="submit" name="block-directory-edit" value="add">' . sprintf( __( 'Add %s to Block Directory', 'wporg-plugins' ), $plugin->post_title ) . '</button>';
    103110                                }
     111                                echo '</p>';
    104112       
    105113                                echo '<ul><li><a href="' . get_edit_post_link( $plugin->ID ) . '">' . __( 'Edit plugin', 'wporg-plugins' ) . '</a></li>';
    106114                                echo '<li><a href="' . esc_url( 'https://plugins.trac.wordpress.org/browser/' . $checker->slug . '/trunk' ) .'">' . __( 'Trac browser', 'wporg-plugins' ) . '</a></li></ul>';
    107                                 echo '</fieldset>';
    108115                                echo '</form>';
    109116                        }
    110                 }
    111 
    112                 $results_by_type = array();
    113                 foreach ( $results as $item ) {
    114                         $results_by_type[ $item->type ][] = $item;
    115117                }
    116118
Note: See TracChangeset for help on using the changeset viewer.