/** * Add a subscriptions header to the My Payment Methods table. * * @since 4.3.0 * @param array $method the table row data * @param \SV_WC_Payment_Gateway_Payment_Token $token the payment token * @param \SV_WC_Payment_Gateway_My_Payment_Methods the my payment methods instance * @return array */ public function add_my_payment_methods_table_body_row_data($method, $token, $handler) { // If the subscription data has already been added or this method is for a different gateway, bail if (isset($method['subscriptions']) || str_replace('_', '-', $token->get_type()) !== $this->get_gateway()->get_payment_type()) { return $method; } $subscription_ids = array(); // Build a link for each subscription foreach ($this->get_payment_token_subscriptions(get_current_user_id(), $token) as $subscription) { $subscription_ids[] = sprintf('<a href="%1$s">%2$s</a>', esc_url($subscription->get_view_order_url()), esc_attr(sprintf(_x('#%s', 'hash before order number', 'woocommerce-plugin-framework'), $subscription->get_order_number()))); } if (!empty($subscription_ids)) { $method['subscriptions'] = implode(', ', $subscription_ids); } return $method; }