WordPress.org

Make WordPress Core


Ignore:
Timestamp:
07/11/2016 09:49:30 PM (4 years ago)
Author:
swissspidy
Message:

Plugins: Improve Ajax search of installed plugins.

Fixes a few accessibility issues, tweaks the design of the search form to match other Ajax search fields and improves compatibility with older browsers.

See #37230.

File:
1 edited

Legend:

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

    r37961 r38033  
    340340        else
    341341            _e( 'You do not appear to have any plugins available at this time.' );
     342    }
     343
     344    /**
     345     * Display the search box.
     346     *
     347     * @since 4.6.0
     348     * @access public
     349     *
     350     * @param string $text The search button text
     351     * @param string $input_id The search input id
     352     */
     353    public function search_box( $text, $input_id ) {
     354        if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) {
     355            return;
     356        }
     357
     358        $input_id = $input_id . '-search-input';
     359
     360        if ( ! empty( $_REQUEST['orderby'] ) ) {
     361            echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
     362        }
     363        if ( ! empty( $_REQUEST['order'] ) ) {
     364            echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
     365        }
     366        ?>
     367        <p class="search-box">
     368            <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
     369            <input type="search" id="<?php echo $input_id ?>" class="wp-filter-search" name="s" value="<?php _admin_search_query(); ?>" placeholder="<?php echo esc_attr( 'Search installed plugins...' ); ?>"/>
     370            <input type="submit" id="search-submit" class="button hide-if-js" value="<?php echo esc_attr( $text ); ?>">
     371        </p>
     372        <?php
    342373    }
    343374
Note: See TracChangeset for help on using the changeset viewer.