Automattic\WooCommerce\Internal\Admin\ProductReviews
ReviewsListTable::review_rating_dropdown()
Displays a review rating drop-down for filtering reviews in the Product Reviews list table.
Метод класса: ReviewsListTable{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
$ReviewsListTable = new ReviewsListTable(); $ReviewsListTable->review_rating_dropdown( $current_rating ) : void;
- $current_rating(int|строка|разное) (обязательный)
- Rating to display reviews for.
Код ReviewsListTable::review_rating_dropdown() ReviewsListTable::review rating dropdown WC 9.3.3
<?php public function review_rating_dropdown( $current_rating ) : void { $rating_options = [ '0' => __( 'All ratings', 'woocommerce' ), '1' => '★', '2' => '★★', '3' => '★★★', '4' => '★★★★', '5' => '★★★★★', ]; ?> <label class="screen-reader-text" for="filter-by-review-rating"><?php esc_html_e( 'Filter by review rating', 'woocommerce' ); ?></label> <select id="filter-by-review-rating" name="review_rating"> <?php foreach ( $rating_options as $rating => $label ) : ?> <?php $title = 0 === (int) $rating ? $label : sprintf( /* translators: %s: Star rating (1-5). */ __( '%s-star rating', 'woocommerce' ), $rating ); ?> <option value="<?php echo esc_attr( $rating ); ?>" <?php selected( $rating, (string) $current_rating ); ?> title="<?php echo esc_attr( $title ); ?>"><?php echo esc_html( $label ); ?></option> <?php endforeach; ?> </select> <?php }