Automattic\WooCommerce\Internal\Admin\ProductReviews

ReviewsListTable::column_date()protectedWC 1.0

Renders the "submitted on" column.

Note that the output is consistent with WP_Comments_List_Table::column_date().

Method of the class: ReviewsListTable{}

No Hooks.

Return

null. Nothing (null).

Usage

// protected - for code of main (parent) or child class
$result = $this->column_date( $item ) : void;
$item(WP_Comment|mixed) (required)
Review or reply being rendered.

ReviewsListTable::column_date() code WC 8.7.0

<?php
protected function column_date( $item ) : void {

	$submitted = sprintf(
		/* translators: 1 - Product review date, 2: Product review time. */
		__( '%1$s at %2$s', 'woocommerce' ),
		/* translators: Review date format. See https://www.php.net/manual/datetime.format.php */
		get_comment_date( __( 'Y/m/d', 'woocommerce' ), $item ),
		/* translators: Review time format. See https://www.php.net/manual/datetime.format.php */
		get_comment_date( __( 'g:i a', 'woocommerce' ), $item )
	);

	ob_start();

	?>
	<div class="submitted-on">
		<?php

		if ( 'approved' === wp_get_comment_status( $item ) && ! empty( $item->comment_post_ID ) ) :
			printf(
				'<a href="%1$s">%2$s</a>',
				esc_url( get_comment_link( $item ) ),
				esc_html( $submitted )
			);
		else :
			echo esc_html( $submitted );
		endif;

		?>
	</div>
	<?php

	echo $this->filter_column_output( 'date', ob_get_clean(), $item ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}