Automattic\WooCommerce\Internal\Admin\ProductReviews
ReviewsListTable::column_rating()
Renders the rating column.
Метод класса: ReviewsListTable{}
Хуков нет.
Возвращает
null
. Ничего.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->column_rating( $item ) : void;
- $item(WP_Comment|разное) (обязательный)
- Review or reply being rendered.
Код ReviewsListTable::column_rating() ReviewsListTable::column rating WC 7.7.2
<?php protected function column_rating( $item ) : void { $rating = get_comment_meta( $item->comment_ID, 'rating', true ); ob_start(); if ( ! empty( $rating ) && is_numeric( $rating ) ) { $rating = (int) $rating; $accessibility_label = sprintf( /* translators: 1: number representing a rating */ __( '%1$d out of 5', 'woocommerce' ), $rating ); $stars = str_repeat( '★', $rating ); $stars .= str_repeat( '☆', 5 - $rating ); ?> <span aria-label="<?php echo esc_attr( $accessibility_label ); ?>"><?php echo esc_html( $stars ); ?></span> <?php } echo $this->filter_column_output( 'rating', ob_get_clean(), $item ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped }