Automattic\WooCommerce\Internal\OrderWithdrawal

OrderWithdrawalFormProcessor::get_email_details_html │ private │ WC 1.0

Get the email details list.

Method of the class: OrderWithdrawalFormProcessor{}

No Hooks.

Returns

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->get_email_details_html( $data, $submitted_at ): string;
$data(array<string,string>) (required)
Form data.
$submitted_at(int) (required)
Unix timestamp for the submission.

OrderWithdrawalFormProcessor::get_email_details_html() code WC 11.1.2

private function get_email_details_html( array $data, int $submitted_at ): string {
	$date_format        = (string) get_option( 'date_format' );
	$time_format        = (string) get_option( 'time_format' );
	$additional_details = '' === $data[ self::FIELD_ADDITIONAL_DETAILS ] ? __( 'None provided', 'woocommerce' ) : $data[ self::FIELD_ADDITIONAL_DETAILS ];
	$submitted_at_text  = wp_date( trim( $date_format . ' ' . $time_format ), $submitted_at );

	if ( false === $submitted_at_text ) {
		$submitted_at_text = '';
	}

	$rows = array(
		__( 'Submitted', 'woocommerce' )          => $submitted_at_text,
		__( 'Name', 'woocommerce' )               => $this->get_customer_name( $data ),
		__( 'Email address', 'woocommerce' )      => $data[ self::FIELD_EMAIL ],
		__( 'Order number', 'woocommerce' )       => $data[ self::FIELD_ORDER_NUMBER ],
		__( 'Withdrawing', 'woocommerce' )        => $this->get_withdrawal_type_label( $data[ self::FIELD_WITHDRAWAL_TYPE ] ),
		__( 'Additional details', 'woocommerce' ) => $additional_details,
	);

	$html = '<ul>';

	foreach ( $rows as $label => $value ) {
		$html .= sprintf(
			'<li><strong>%1$s:</strong> %2$s</li>',
			esc_html( $label ),
			nl2br( esc_html( $value ) )
		);
	}

	$html .= '</ul>';

	return $html;
}