From 093e6ff1b2e99a04288376a1cbe0a49052c6c5f1 Mon Sep 17 00:00:00 2001 From: Philipp Stracker Date: Thu, 13 Feb 2025 19:38:08 +0100 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Extend=20payment=20method?= =?UTF-8?q?=20definition=20response?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/Data/Definition/PaymentMethodsDefinition.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/ppcp-settings/src/Data/Definition/PaymentMethodsDefinition.php b/modules/ppcp-settings/src/Data/Definition/PaymentMethodsDefinition.php index 56d8cf988..f9ac675d5 100644 --- a/modules/ppcp-settings/src/Data/Definition/PaymentMethodsDefinition.php +++ b/modules/ppcp-settings/src/Data/Definition/PaymentMethodsDefinition.php @@ -92,17 +92,21 @@ class PaymentMethodsDefinition { private function define_common_fields( string $gateway_id, string $title, string $description, string $icon ) : array { $gateway = $this->wc_gateways[ $gateway_id ] ?? null; + $gateway_title = $gateway ? $gateway->get_title() : $title; + $gateway_description = $gateway ? $gateway->get_description() : $description; + return array( 'id' => $gateway_id, - 'title' => $title, - 'description' => $description, + 'enabled' => wc_string_to_bool( $gateway ? $gateway->enabled : '' ), + 'title' => str_replace( '&', '&', $gateway_title ), + 'description' => $gateway_description, 'icon' => $icon, 'itemTitle' => $title, 'itemDescription' => $description, 'fields' => array( 'checkoutPageTitle' => array( 'type' => 'text', - 'default' => $gateway ? $gateway->get_title() : '', + 'default' => $gateway_title, 'label' => __( 'Checkout page title', 'woocommerce-paypal-payments' ), ), 'checkoutPageDescription' => array(