WordPress at Your Fingertips
function is not described

WP_List_Table::view_switcher() protected WP 3.1.0

Displays a view switcher.

{} It's a method of the class: WP_List_Table{}

No Hooks.

Return

null. Nothing.

Usage

// protected - for code of main (parent) or child class
$result = $this->view_switcher( $current_mode );
$current_mode(string) (required)
-

Changelog

Since 3.1.0 Introduced.

Code of WP_List_Table::view_switcher() WP 5.8.1

<?php
protected function view_switcher( $current_mode ) {
	?>
	<input type="hidden" name="mode" value="<?php echo esc_attr( $current_mode ); ?>" />
	<div class="view-switch">
	<?php
	foreach ( $this->modes as $mode => $title ) {
		$classes      = array( 'view-' . $mode );
		$aria_current = '';

		if ( $current_mode === $mode ) {
			$classes[]    = 'current';
			$aria_current = ' aria-current="page"';
		}

		printf(
			"<a href='%s' class='%s' id='view-switch-$mode'$aria_current><span class='screen-reader-text'>%s</span></a>\n",
			esc_url( remove_query_arg( 'attachment-filter', add_query_arg( 'mode', $mode ) ) ),
			implode( ' ', $classes ),
			$title
		);
	}
	?>
	</div>
	<?php
}