diff --git a/src/PaymentMethods/Giftcard.php b/src/PaymentMethods/Giftcard.php index 395016fa..dbbd3895 100644 --- a/src/PaymentMethods/Giftcard.php +++ b/src/PaymentMethods/Giftcard.php @@ -73,6 +73,11 @@ protected function getConfig(): array public function getFormFields($generalFormFields): array { + $searchKey = 'advanced'; + $keys = array_keys($generalFormFields); + $index = array_search($searchKey, $keys); + $before = array_slice($generalFormFields, 0, $index + 1, true); + $after = array_slice($generalFormFields, $index + 1, null, true); $paymentMethodFormFields = [ 'issuers_dropdown_shown' => [ 'title' => __( @@ -105,6 +110,8 @@ public function getFormFields($generalFormFields): array 'default' => __('Select your gift card', 'mollie-payments-for-woocommerce'), ], ]; - return array_merge($generalFormFields, $paymentMethodFormFields); + $before = array_merge($before, $paymentMethodFormFields); + $formFields = array_merge($before, $after); + return $formFields; } } diff --git a/src/PaymentMethods/Ideal.php b/src/PaymentMethods/Ideal.php index c02ee7e7..006ea6d9 100644 --- a/src/PaymentMethods/Ideal.php +++ b/src/PaymentMethods/Ideal.php @@ -29,6 +29,11 @@ public function getConfig(): array public function getFormFields($generalFormFields): array { + $searchKey = 'advanced'; + $keys = array_keys($generalFormFields); + $index = array_search($searchKey, $keys); + $before = array_slice($generalFormFields, 0, $index + 1, true); + $after = array_slice($generalFormFields, $index + 1, null, true); $paymentMethodFormFieds = [ 'issuers_dropdown_shown' => [ 'title' => __('Show iDEAL banks dropdown', 'mollie-payments-for-woocommerce'), @@ -55,6 +60,8 @@ public function getFormFields($generalFormFields): array 'default' => __('Select your bank', 'mollie-payments-for-woocommerce'), ], ]; - return array_merge($generalFormFields, $paymentMethodFormFieds); + $before = array_merge($before, $paymentMethodFormFieds); + $formFields = array_merge($before, $after); + return $formFields; } } diff --git a/src/PaymentMethods/Kbc.php b/src/PaymentMethods/Kbc.php index 5c220cac..4005b83f 100644 --- a/src/PaymentMethods/Kbc.php +++ b/src/PaymentMethods/Kbc.php @@ -28,6 +28,11 @@ protected function getConfig(): array public function getFormFields($generalFormFields): array { + $searchKey = 'advanced'; + $keys = array_keys($generalFormFields); + $index = array_search($searchKey, $keys); + $before = array_slice($generalFormFields, 0, $index + 1, true); + $after = array_slice($generalFormFields, $index + 1, null, true); $paymentMethodFormFieds = [ 'issuers_dropdown_shown' => [ 'title' => __( @@ -60,6 +65,8 @@ public function getFormFields($generalFormFields): array 'default' => __('Select your bank', 'mollie-payments-for-woocommerce'), ], ]; - return array_merge($generalFormFields, $paymentMethodFormFieds); + $before = array_merge($before, $paymentMethodFormFieds); + $formFields = array_merge($before, $after); + return $formFields; } } diff --git a/src/Settings/General/MollieGeneralSettings.php b/src/Settings/General/MollieGeneralSettings.php index a97d4a38..f55a549d 100644 --- a/src/Settings/General/MollieGeneralSettings.php +++ b/src/Settings/General/MollieGeneralSettings.php @@ -28,7 +28,7 @@ public function gatewayFormFields( ), 'default' => 'yes', ], - [ + 'display'=>[ 'id' => $defaultTitle . '_' . 'title', 'title' => sprintf( /* translators: Placeholder 1: Gateway title */ @@ -37,20 +37,6 @@ public function gatewayFormFields( ), 'type' => 'title', ], - 'title' => [ - 'title' => __('Title', 'mollie-payments-for-woocommerce'), - 'type' => 'text', - /* translators: Placeholder 1: Gateway title */ - 'description' => sprintf( - __( - 'This controls the title which the user sees during checkout. Default %s', - 'mollie-payments-for-woocommerce' - ), - $defaultTitle - ), - 'default' => $defaultTitle, - 'desc_tip' => true, - ], 'use_api_title' => [ 'title' => __( 'Use API dynamic title and gateway logo', @@ -60,18 +46,18 @@ public function gatewayFormFields( 'label' => __('Retrieve the gateway title and logo from the Mollie API', 'mollie-payments-for-woocommerce'), 'default' => 'no', ], - 'description' => [ - 'title' => __('Description', 'mollie-payments-for-woocommerce'), - 'type' => 'textarea', - /* translators: Placeholder 1: Gateway description */ + 'title' => [ + 'title' => __('Title', 'mollie-payments-for-woocommerce'), + 'type' => 'text', + /* translators: Placeholder 1: Gateway title */ 'description' => sprintf( __( - 'Payment method description that the customer will see on your checkout. Default %s', + 'This controls the title which the user sees during checkout. Default %s', 'mollie-payments-for-woocommerce' ), - $defaultDescription + $defaultTitle ), - 'default' => $defaultDescription, + 'default' => $defaultTitle, 'desc_tip' => true, ], 'display_logo' => [ @@ -86,33 +72,6 @@ public function gatewayFormFields( ), 'default' => 'yes', ], - [ - 'id' => $defaultTitle . '_' . 'title', - 'title' => sprintf(__( - 'Sales countries', - 'mollie-payments-for-woocommerce' - )), - 'type' => 'title', - ], - 'allowed_countries' => [ - 'title' => __( - 'Sell to specific countries', - 'mollie-payments-for-woocommerce' - ), - 'desc' => '', - 'css' => 'min-width: 350px;', - 'default' => [], - 'type' => 'multi_select_countries', - ], - [ - 'id' => $defaultTitle . '_' . 'custom_logo', - 'title' => sprintf( - /* translators: Placeholder 1: Gateway title */ - __('%s custom logo', 'mollie-payments-for-woocommerce'), - $defaultTitle - ), - 'type' => 'title', - ], 'enable_custom_logo' => [ 'title' => __( 'Enable custom logo', @@ -141,7 +100,39 @@ public function gatewayFormFields( ), 'desc_tip' => true, ], - [ + 'description' => [ + 'title' => __('Description', 'mollie-payments-for-woocommerce'), + 'type' => 'textarea', + /* translators: Placeholder 1: Gateway description */ + 'description' => sprintf( + __( + 'Payment method description that the customer will see on your checkout. Default %s', + 'mollie-payments-for-woocommerce' + ), + $defaultDescription + ), + 'default' => $defaultDescription, + 'desc_tip' => true, + ], + 'sales'=>[ + 'id' => $defaultTitle . '_' . 'title', + 'title' => sprintf(__( + 'Sales countries', + 'mollie-payments-for-woocommerce' + )), + 'type' => 'title', + ], + 'allowed_countries' => [ + 'title' => __( + 'Sell to specific countries', + 'mollie-payments-for-woocommerce' + ), + 'desc' => '', + 'css' => 'min-width: 350px;', + 'default' => [], + 'type' => 'multi_select_countries', + ], + 'surcharge'=>[ 'id' => $defaultTitle . '_' . 'surcharge', 'title' => sprintf( /* translators: Placeholder 1: Gateway title */ @@ -239,7 +230,7 @@ public function gatewayFormFields( 'default' => '0.00', 'desc_tip' => true, ], - [ + 'advanced' =>[ 'id' => $defaultTitle . '_' . 'advanced', 'title' => sprintf( /* translators: Placeholder 1: gateway title */ @@ -248,26 +239,6 @@ public function gatewayFormFields( ), 'type' => 'title', ], - 'activate_expiry_days_setting' => [ - 'title' => __('Activate expiry time setting', 'mollie-payments-for-woocommerce'), - 'label' => __('Enable expiry time for payments', 'mollie-payments-for-woocommerce'), - 'description' => __('Enable this option if you want to be able to set the time after which the order will expire.', 'mollie-payments-for-woocommerce'), - 'type' => 'checkbox', - 'default' => 'no', - ], - 'order_dueDate' => [ - 'title' => sprintf(__('Expiry time', 'mollie-payments-for-woocommerce')), - 'type' => 'number', - 'custom_attributes' => ['step' => '1', 'min' => '10', 'max' => '526000'], - 'description' => sprintf( - __( - 'Number of MINUTES after the order will expire and will be canceled at Mollie and WooCommerce.', - 'mollie-payments-for-woocommerce' - ) - ), - 'default' => '10', - 'desc_tip' => false, - ], ]; if ($paymentConfirmation) { @@ -306,6 +277,27 @@ public function gatewayFormFields( ]; } + $formFields['activate_expiry_days_setting'] = [ + 'title' => __('Activate expiry time setting', 'mollie-payments-for-woocommerce'), + 'label' => __('Enable expiry time for payments', 'mollie-payments-for-woocommerce'), + 'description' => __('Enable this option if you want to be able to set the time after which the order will expire.', 'mollie-payments-for-woocommerce'), + 'type' => 'checkbox', + 'default' => 'no', + ]; + $formFields['order_dueDate'] = [ + 'title' => sprintf(__('Expiry time', 'mollie-payments-for-woocommerce')), + 'type' => 'number', + 'custom_attributes' => ['step' => '1', 'min' => '10', 'max' => '526000'], + 'description' => sprintf( + __( + 'Number of MINUTES after the order will expire and will be canceled at Mollie and WooCommerce.', + 'mollie-payments-for-woocommerce' + ) + ), + 'default' => '10', + 'desc_tip' => false, + ]; + return $formFields; } }