Automattic\WooCommerce\Internal\Admin\ProductReviews

ReviewsListTable::product_search()protectedWC 1.0

Displays a product search input for filtering reviews by product in the Product Reviews list table.

{} Это метод класса: ReviewsListTable{}

Хуков нет.

Возвращает

null. Ничего.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->product_search( ?WC_Product $current_product ) : void;
?WC_Product $current_product (обязательный)
-

Код ReviewsListTable::product_search() WC 6.7.0

<?php
protected function product_search( ?WC_Product $current_product ) : void {
	?>
	<label class="screen-reader-text" for="filter-by-product"><?php esc_html_e( 'Filter by product', 'woocommerce' ); ?></label>
	<select
		id="filter-by-product"
		class="wc-product-search"
		name="product_id"
		style="width: 200px;"
		data-placeholder="<?php esc_attr_e( 'Search for a product&hellip;', 'woocommerce' ); ?>"
		data-action="woocommerce_json_search_products"
		data-allow_clear="true">
		<?php if ( $current_product instanceof WC_Product ) : ?>
			<option value="<?php echo esc_attr( $current_product->get_id() ); ?>" selected="selected"><?php echo esc_html( $current_product->get_formatted_name() ); ?></option>
		<?php endif; ?>
	</select>
	<?php
}