WordPress at a glance
function is not described

WP_Media_List_Table::get_views() WP 1.0

This is a method of the class: WP_Media_List_Table

No Hooks.

Return

Array.

Usage

$WP_Media_List_Table = new WP_Media_List_Table();
$var = $WP_Media_List_Table->get_views();

Notes

  • Global. Array. $post_mime_types
  • Global. Array. $avail_post_mime_types

Code of WP Media List Table::get views: wp-admin/includes/class-wp-media-list-table.php WP 5.2.2

<?php
protected function get_views() {
	global $post_mime_types, $avail_post_mime_types;

	$type_links = array();

	$filter = empty( $_GET['attachment-filter'] ) ? '' : $_GET['attachment-filter'];

	$type_links['all'] = sprintf(
		'<option value=""%s>%s</option>',
		selected( $filter, true, false ),
		__( 'All media items' )
	);

	foreach ( $post_mime_types as $mime_type => $label ) {
		if ( ! wp_match_mime_types( $mime_type, $avail_post_mime_types ) ) {
			continue;
		}

		$selected = selected(
			$filter && 0 === strpos( $filter, 'post_mime_type:' ) &&
				wp_match_mime_types( $mime_type, str_replace( 'post_mime_type:', '', $filter ) ),
			true,
			false
		);

		$type_links[ $mime_type ] = sprintf(
			'<option value="post_mime_type:%s"%s>%s</option>',
			esc_attr( $mime_type ),
			$selected,
			$label[0]
		);
	}

	$type_links['detached'] = '<option value="detached"' . ( $this->detached ? ' selected="selected"' : '' ) . '>' . __( 'Unattached' ) . '</option>';

	$type_links['mine'] = sprintf(
		'<option value="mine"%s>%s</option>',
		selected( 'mine' === $filter, true, false ),
		_x( 'Mine', 'media items' )
	);

	if ( $this->is_trash || ( defined( 'MEDIA_TRASH' ) && MEDIA_TRASH ) ) {
		$type_links['trash'] = sprintf(
			'<option value="trash"%s>%s</option>',
			selected( 'trash' === $filter, true, false ),
			_x( 'Trash', 'attachment filter' )
		);
	}

	return $type_links;
}