Automattic\WooCommerce\Internal\Admin\ProductReviews

ReviewsListTable::review_type_dropdown()protectedWC 1.0

Displays a review type drop-down for filtering reviews in the Product Reviews list table.

{} It's a method of the class: ReviewsListTable{}

Return

null. Nothing.

Usage

// protected - for code of main (parent) or child class
$result = $this->review_type_dropdown( $current_type ) : void;
$current_type(string|mixed) (required)
The current comment item type slug.

Notes

Code of ReviewsListTable::review_type_dropdown() WC 7.1.0

<?php
protected function review_type_dropdown( $current_type ) : void {
	/**
	 * Sets the possible options used in the Product Reviews List Table's filter-by-review-type
	 * selector.
	 *
	 * @since 7.0.0
	 *
	 * @param array Map of possible review types.
	 */
	$item_types = apply_filters(
		'woocommerce_product_reviews_list_table_item_types',
		array(
			'all'     => __( 'All types', 'woocommerce' ),
			'comment' => __( 'Replies', 'woocommerce' ),
			'review'  => __( 'Reviews', 'woocommerce' ),
		)
	);

	?>
	<label class="screen-reader-text" for="filter-by-review-type"><?php esc_html_e( 'Filter by review type', 'woocommerce' ); ?></label>
	<select id="filter-by-review-type" name="review_type">
		<?php foreach ( $item_types as $type => $label ) : ?>
			<option value="<?php echo esc_attr( $type ); ?>" <?php selected( $type, $current_type ); ?>><?php echo esc_html( $label ); ?></option>
		<?php endforeach; ?>
	</select>
	<?php
}