Singular_Order_Page::get_gateway_label( WP_Post|int $order )
Get the gateway label for the order.
Contents
Parameters
- $order
-
(WP_Post|int) (Required) The order post object or ID.
Return
(string)
Source
File: src/Tickets/Commerce/Admin/Singular_Order_Page.php
public function get_gateway_label( $order ): string {
$order = tec_tc_get_order( $order );
if ( ! $order instanceof WP_Post ) {
return '';
}
$gateway = tribe( Manager::class )->get_gateway_by_key( $order->gateway );
if ( $gateway instanceof Free_Gateway ) {
return esc_html__( 'Free', 'event-tickets' );
}
if ( ! $gateway ) {
return esc_html( $order->gateway );
}
$order_url = $gateway->get_order_controller()->get_gateway_dashboard_url_by_order( $order );
if ( empty( $order_url ) ) {
return esc_html( $gateway::get_label() );
}
ob_start();
tec_copy_to_clipboard_button( $order->gateway_order_id, true, __( 'Copy Payment\'s Gateway Transaction ID to your Clipboard', 'event-tickets' ) );
$copy_button = ob_get_clean();
return sprintf(
'%1$s%2$s%3$s%4$s<br>%5$s',
'<a class="tribe-dashicons" href="' . esc_url( $order_url ) . '" target="_blank" rel="noopener noreferrer">',
esc_html( $gateway::get_label() ),
'<span class="dashicons dashicons-external"></span>',
'</a>',
$copy_button
);
}
Changelog
| Version | Description |
|---|---|
| 5.13.3 | Introduced. |