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.

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

Возвращает

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

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->review_type_dropdown( $current_type ) : void;
$current_type(строка|разное) (обязательный)
The current comment item type slug.

Заметки

Код ReviewsListTable::review_type_dropdown() WC 8.7.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
}