Automattic\WooCommerce\Internal\Admin\Orders

ListTable::search_box()publicWC 1.0

Renders the search box with various options to limit order search results.

Метод класса: ListTable{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$ListTable = new ListTable();
$ListTable->search_box( $text, $input_id );
$text(строка) (обязательный)
The search button text.
$input_id(строка) (обязательный)
The search input ID.

Код ListTable::search_box() WC 8.7.0

<?php
public function search_box( $text, $input_id ) {
	if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) {
		return;
	}

	$input_id = $input_id . '-search-input';

	if ( ! empty( $_REQUEST['orderby'] ) ) {
		echo '<input type="hidden" name="orderby" value="' . esc_attr( sanitize_text_field( wp_unslash( $_REQUEST['orderby'] ) ) ) . '" />';
	}
	if ( ! empty( $_REQUEST['order'] ) ) {
		echo '<input type="hidden" name="order" value="' . esc_attr( sanitize_text_field( wp_unslash( $_REQUEST['order'] ) ) ) . '" />';
	}
	?>
	<p class="search-box">
		<label class="screen-reader-text" for="<?php echo esc_attr( $input_id ); ?>"><?php echo esc_html( $text ); ?>:</label>
		<input type="search" id="<?php echo esc_attr( $input_id ); ?>" name="s" value="<?php _admin_search_query(); ?>" />
		<?php $this->search_filter(); ?>
		<?php submit_button( $text, '', '', false, array( 'id' => 'search-submit' ) ); ?>
	</p>
	<?php
}