Automattic\WooCommerce\Internal\Admin\ProductReviews

ReviewsListTable::single_row()publicWC 1.0

Render a single row HTML.

Method of the class: ReviewsListTable{}

No Hooks.

Return

null. Nothing.

Usage

$ReviewsListTable = new ReviewsListTable();
$ReviewsListTable->single_row( $item ) : void;
$item(WP_Comment|mixed) (required)
Review or reply being rendered.

Notes

  • Global. WP_Post. $post
  • Global. WP_Comment. $comment

ReviewsListTable::single_row() code WC 7.1.1

<?php
public function single_row( $item ) : void {
	global $post, $comment;

	// Overrides the comment global for properly rendering rows.
	$comment           = $item; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
	$the_comment_class = (string) wp_get_comment_status( $comment->comment_ID );
	$the_comment_class = implode( ' ', get_comment_class( $the_comment_class, $comment->comment_ID, $comment->comment_post_ID ) );
	// Sets the post for the product in context.
	$post = get_post( $comment->comment_post_ID ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited

	$this->current_user_can_edit_review = current_user_can( 'edit_comment', $comment->comment_ID );

	?>
	<tr id="comment-<?php echo esc_attr( $comment->comment_ID ); ?>" class="comment <?php echo esc_attr( $the_comment_class ); ?>">
		<?php $this->single_row_columns( $comment ); ?>
	</tr>
	<?php
}