WP_Media_List_Table::views() WordPress Method

The WP_Media_List_Table::views() method is used to generate the list of views for a WP_List_Table. It is used to generate the default views, as well as any custom views added by plugins or themes.

WP_Media_List_Table::views() #

Override parent views so we can use the filter bar display.


Source

File: wp-admin/includes/class-wp-media-list-table.php

267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
public function views() {
    global $mode;
 
    $views = $this->get_views();
 
    $this->screen->render_screen_reader_content( 'heading_views' );
    ?>
    <div class="wp-filter">
        <div class="filter-items">
            <?php $this->view_switcher( $mode ); ?>
 
            <label for="attachment-filter" class="screen-reader-text"><?php _e( 'Filter by type' ); ?></label>
            <select class="attachment-filters" name="attachment-filter" id="attachment-filter">
                <?php
                if ( ! empty( $views ) ) {
                    foreach ( $views as $class => $view ) {
                        echo "\t$view\n";
                    }
                }
                ?>
            </select>
 
            <?php
            $this->extra_tablenav( 'bar' );
 
            /** This filter is documented in wp-admin/inclues/class-wp-list-table.php */
            $views = apply_filters( "views_{$this->screen->id}", array() );
 
            // Back compat for pre-4.0 view links.
            if ( ! empty( $views ) ) {
                echo '<ul class="filter-links">';
                foreach ( $views as $class => $view ) {
                    echo "<li class='$class'>$view</li>";
                }
                echo '</ul>';
            }
            ?>
        </div>
 
        <div class="search-form">
            <label for="media-search-input" class="media-search-input-label"><?php esc_html_e( 'Search' ); ?></label>
            <input type="search" id="media-search-input" class="search" name="s" value="<?php _admin_search_query(); ?>">
        </div>
    </div>
    <?php
}

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by the Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.