Automattic\WooCommerce\Internal\Fulfillments

FulfillmentsRenderer::render_order_fulfillment_status_badgeprivateWC 1.0

Render the fulfillment status badge.

Method of the class: FulfillmentsRenderer{}

No Hooks.

Returns

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->render_order_fulfillment_status_badge( $order, $order_fulfillment_status );
$order(WC_Order) (required)
The order object.
$order_fulfillment_status(string) (required)
The fulfillment status of the order.

FulfillmentsRenderer::render_order_fulfillment_status_badge() code WC 10.3.3

private function render_order_fulfillment_status_badge( $order, string $order_fulfillment_status ) {
	$status_props = FulfillmentUtils::get_order_fulfillment_statuses()[ $order_fulfillment_status ];
	if ( ! $status_props ) {
		$status_props = array(
			'label'            => __( 'Unknown', 'woocommerce' ),
			'background_color' => '#f0f0f0',
			'text_color'       => '#000',
		);
	}

	echo '<mark class="fulfillment-status" style="background-color:' . esc_attr( $status_props['background_color'] ) . '; color: ' . esc_attr( $status_props['text_color'] ) . '"><span>' . esc_html( $status_props['label'] ) . '</span></mark>';
	echo "<a href='#' class='fulfillments-trigger' data-order-id='" . esc_attr( $order->get_id() ) . "' title='" . esc_attr__( 'View Fulfillments', 'woocommerce' ) . "'>
		<svg width='16' height='16' viewBox='0 0 12 14' xmlns='http://www.w3.org/2000/svg'>
			<path d='M11.8333 2.83301L9.33329 0.333008L2.24996 7.41634L1.41663 10.7497L4.74996 9.91634L11.8333 2.83301ZM5.99996 12.4163H0.166626V13.6663H5.99996V12.4163Z' />
		</svg>
	</a>";
}