WP_List_Table::views() WordPress Method

The WP_List_Table::views() method is used to displays the list table views. The views are the links that are displayed at the top of the list table, above the items. The method takes an array of links, each of which is an associative array with two keys: 'label' and 'url'. The 'label' is the text that is displayed for the link, and the 'url' is the link itself. The method outputs the links as an HTML list.

WP_List_Table::views() #

Displays the list of views available on this table.


More Information

It renders out the <ul> element that contains the view names.


Top ↑

Source

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

	public function views() {
		$views = $this->get_views();
		/**
		 * Filters the list of available list table views.
		 *
		 * The dynamic portion of the hook name, `$this->screen->id`, refers
		 * to the ID of the current screen.
		 *
		 * @since 3.1.0
		 *
		 * @param string[] $views An array of available list table views.
		 */
		$views = apply_filters( "views_{$this->screen->id}", $views );

		if ( empty( $views ) ) {
			return;
		}

		$this->screen->render_screen_reader_content( 'heading_views' );

		echo "<ul class='subsubsub'>\n";
		foreach ( $views as $class => $view ) {
			$views[ $class ] = "\t<li class='$class'>$view";
		}
		echo implode( " |</li>\n", $views ) . "</li>\n";
		echo '</ul>';
	}


Top ↑

Changelog

Changelog
VersionDescription
3.1.0Introduced.

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.