From 3f81faa0459d787641d23800f3b32a2e58d31b50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A9sz=C3=A1ros=20R=C3=B3bert?= Date: Thu, 9 Apr 2020 18:14:27 +0300 Subject: [PATCH] Add title, description and button context enabler settings --- .../src/Settings/SettingsFields.php | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/modules.local/ppcp-wc-gateway/src/Settings/SettingsFields.php b/modules.local/ppcp-wc-gateway/src/Settings/SettingsFields.php index 58d561087..b1585b6a2 100644 --- a/modules.local/ppcp-wc-gateway/src/Settings/SettingsFields.php +++ b/modules.local/ppcp-wc-gateway/src/Settings/SettingsFields.php @@ -7,6 +7,15 @@ namespace Inpsyde\PayPalCommerce\WcGateway\Settings; class SettingsFields { public function fields(): array + { + return array_merge( + $this->gateway(), + $this->account(), + $this->buttons(), + ); + } + + protected function gateway() { return [ 'enabled' => [ @@ -15,6 +24,40 @@ class SettingsFields 'label' => __('Enable PayPal Payments', 'woocommerce-paypal-gateway'), 'default' => 'yes', ], + 'title' => [ + 'title' => __('Title', 'woocommerce-paypal-gateway'), + 'type' => 'text', + 'description' => __( + 'This controls the title which the user sees during checkout.', + 'woocommerce-paypal-gateway' + ), + 'default' => __('PayPal', 'woocommerce-paypal-gateway'), + 'desc_tip' => true, + ], + 'description' => [ + 'title' => __('Description', 'woocommerce-paypal-gateway'), + 'type' => 'text', + 'desc_tip' => true, + 'description' => __( + 'This controls the description which the user sees during checkout.', + 'woocommerce-paypal-gateway' + ), + 'default' => __( + 'Pay via PayPal; you can pay with your credit card if you don\'t have a PayPal account.', + 'woocommerce-paypal-gateway' + ), + ], + ]; + } + + protected function account() + { + return [ + 'account_settings' => [ + 'title' => __('Account Settings', 'woocommerce-paypal-gateway'), + 'type' => 'title', + 'description' => '', + ], 'sandbox_on' => [ 'title' => __('Enable Sandbox', 'woocommerce-paypal-gateway'), 'type' => 'checkbox', @@ -26,4 +69,36 @@ class SettingsFields ], ]; } + + protected function buttons() + { + return [ + 'button_settings' => [ + 'title' => __('Button Settings', 'woocommerce-paypal-gateway'), + 'type' => 'title', + 'description' => __( + 'Customize the appearance of PayPal Payments on your site.', + 'woocommerce-paypal-gateway' + ), + ], + 'button_single_product_enabled' => [ + 'title' => __('Buttons on Single Product', 'woocommerce-paypal-gateway'), + 'type' => 'checkbox', + 'label' => __('Enable on Single Product', 'woocommerce-paypal-gateway'), + 'default' => 'yes', + ], + 'button_mini_cart_enabled' => [ + 'title' => __('Buttons on Mini Cart', 'woocommerce-paypal-gateway'), + 'type' => 'checkbox', + 'label' => __('Enable on Mini Cart', 'woocommerce-paypal-gateway'), + 'default' => 'yes', + ], + 'button_cart_enabled' => [ + 'title' => __('Buttons on Cart', 'woocommerce-paypal-gateway'), + 'type' => 'checkbox', + 'label' => __('Enable on Cart', 'woocommerce-paypal-gateway'), + 'default' => 'yes', + ], + ]; + } }