WC_Admin_API_Keys_Table_List::search_box()publicWC 1.0

Search box.

Method of the class: WC_Admin_API_Keys_Table_List{}

No Hooks.

Return

null. Nothing (null).

Usage

$WC_Admin_API_Keys_Table_List = new WC_Admin_API_Keys_Table_List();
$WC_Admin_API_Keys_Table_List->search_box( $text, $input_id );
$text(string) (required)
Button text.
$input_id(string) (required)
Input ID.

WC_Admin_API_Keys_Table_List::search_box() code WC 9.4.2

public function search_box( $text, $input_id ) {
	if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) { // WPCS: input var okay, CSRF ok.
		return;
	}

	$input_id     = $input_id . '-search-input';
	$search_query = isset( $_REQUEST['s'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['s'] ) ) : ''; // WPCS: input var okay, CSRF ok.

	echo '<p class="search-box">';
	echo '<label class="screen-reader-text" for="' . esc_attr( $input_id ) . '">' . esc_html( $text ) . ':</label>';
	echo '<input type="search" id="' . esc_attr( $input_id ) . '" name="s" value="' . esc_attr( $search_query ) . '" />';
	submit_button(
		$text,
		'',
		'',
		false,
		array(
			'id' => 'search-submit',
		)
	);
	echo '</p>';
}