/** * Initialize payment gateway settings fields * * @since 1.0.0 * @see WC_Settings_API::init_form_fields() */ public function init_form_fields() { // common top form fields $this->form_fields = array('enabled' => array('title' => esc_html__('Enable / Disable', 'woocommerce-plugin-framework'), 'label' => esc_html__('Enable this gateway', 'woocommerce-plugin-framework'), 'type' => 'checkbox', 'default' => 'no'), 'title' => array('title' => esc_html__('Title', 'woocommerce-plugin-framework'), 'type' => 'text', 'desc_tip' => esc_html__('Payment method title that the customer will see during checkout.', 'woocommerce-plugin-framework'), 'default' => $this->get_default_title()), 'description' => array('title' => esc_html__('Description', 'woocommerce-plugin-framework'), 'type' => 'textarea', 'desc_tip' => esc_html__('Payment method description that the customer will see during checkout.', 'woocommerce-plugin-framework'), 'default' => $this->get_default_description())); // Card Security Code (CVV) field if ($this->is_credit_card_gateway()) { $this->form_fields = $this->add_csc_form_fields($this->form_fields); } // both credit card authorization & charge supported if ($this->supports_credit_card_authorization() && $this->supports_credit_card_charge()) { $this->form_fields = $this->add_authorization_charge_form_fields($this->form_fields); } // card types support if ($this->supports_card_types()) { $this->form_fields = $this->add_card_types_form_fields($this->form_fields); } // tokenization support if ($this->supports_tokenization()) { $this->form_fields = $this->add_tokenization_form_fields($this->form_fields); } // add "detailed customer decline messages" option if the feature is supported if ($this->supports(self::FEATURE_DETAILED_CUSTOMER_DECLINE_MESSAGES)) { $this->form_fields['enable_customer_decline_messages'] = array('title' => esc_html__('Detailed Decline Messages', 'woocommerce-plugin-framework'), 'type' => 'checkbox', 'label' => esc_html__('Check to enable detailed decline messages to the customer during checkout when possible, rather than a generic decline message.', 'woocommerce-plugin-framework'), 'default' => 'no'); } // debug mode $this->form_fields['debug_mode'] = array('title' => esc_html__('Debug Mode', 'woocommerce-plugin-framework'), 'type' => 'select', 'desc' => sprintf(esc_html__('Show Detailed Error Messages and API requests/responses on the checkout page and/or save them to the %1$sdebug log%2$s', 'woocommerce-plugin-framework'), '<a href="' . SV_WC_Helper::get_wc_log_file_url($this->get_id()) . '">', '</a>'), 'default' => self::DEBUG_MODE_OFF, 'options' => array(self::DEBUG_MODE_OFF => esc_html__('Off', 'woocommerce-plugin-framework'), self::DEBUG_MODE_CHECKOUT => esc_html__('Show on Checkout Page', 'woocommerce-plugin-framework'), self::DEBUG_MODE_LOG => esc_html__('Save to Log', 'woocommerce-plugin-framework'), self::DEBUG_MODE_BOTH => esc_html__('Both', 'woocommerce-plugin-framework'))); // if there is more than just the production environment available if (count($this->get_environments()) > 1) { $this->form_fields = $this->add_environment_form_fields($this->form_fields); } // add the "inherit settings" toggle if there are settings shared with a sibling gateway if (count($this->shared_settings)) { $this->form_fields = $this->add_shared_settings_form_fields($this->form_fields); } // add unique method fields added by concrete gateway class $gateway_form_fields = $this->get_method_form_fields(); $this->form_fields = array_merge($this->form_fields, $gateway_form_fields); // add the special 'shared-settings-field' class name to any shared settings fields foreach ($this->shared_settings as $field_name) { $this->form_fields[$field_name]['class'] = trim(isset($this->form_fields[$field_name]['class']) ? $this->form_fields[$field_name]['class'] : '') . ' shared-settings-field'; } /** * Payment Gateway Form Fields Filter. * * Actors can use this to add, remove, or tweak gateway form fields * * @since 4.0.0 * @param array $form_fields array of form fields in format required by WC_Settings_API * @param \SV_WC_Payment_Gateway $this gateway instance */ $this->form_fields = apply_filters('wc_payment_gateway_' . $this->get_id() . '_form_fields', $this->form_fields, $this); }