WP_List_Table::_js_vars() WordPress Method

The WP_List_Table::_js_vars() method is used to set up the necessary javascript variables for the list table. This includes things like the current page, the total number of items, the number of items per page, etc. This method is called during the list table's "prepare_items()" method.

WP_List_Table::_js_vars() #

Sends required variables to JavaScript land.


More Information

It outputs key Javascript variables that were dynamically created by the class.


Top ↑

Source

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

	public function _js_vars() {
		$args = array(
			'class'  => get_class( $this ),
			'screen' => array(
				'id'   => $this->screen->id,
				'base' => $this->screen->base,
			),
		);

		printf( "<script type='text/javascript'>list_args = %s;</script>\n", wp_json_encode( $args ) );
	}


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.