/** * 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' => __('Enable / Disable', $this->text_domain), 'label' => __('Enable this gateway', $this->text_domain), 'type' => 'checkbox', 'default' => 'no'), 'title' => array('title' => __('Title', $this->text_domain), 'type' => 'text', 'desc_tip' => __('Payment method title that the customer will see during checkout.', $this->text_domain), 'default' => $this->get_default_title()), 'description' => array('title' => __('Description', $this->text_domain), 'type' => 'textarea', 'desc_tip' => __('Payment method description that the customer will see during checkout.', $this->text_domain), '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); } // 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 "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' => __('Detailed Decline Messages', $this->text_domain), 'type' => 'checkbox', 'label' => __('Check to enable detailed decline messages to the customer during checkout when possible, rather than a generic decline message.', $this->text_domain), 'default' => 'no'); } // add any common bottom fields $this->form_fields['debug_mode'] = array('title' => __('Debug Mode', $this->text_domain), 'type' => 'select', 'description' => sprintf(__('Show Detailed Error Messages and API requests/responses on the checkout page and/or save them to the debug log: %s', $this->text_domain), '<strong class="nobr">' . SV_WC_Plugin_Compatibility::wc_get_log_file_path($this->get_id()) . '</strong>'), 'default' => self::DEBUG_MODE_OFF, 'options' => array(self::DEBUG_MODE_OFF => _x('Off', 'Debug mode off', $this->text_domain), self::DEBUG_MODE_CHECKOUT => __('Show on Checkout Page', $this->text_domain), self::DEBUG_MODE_LOG => __('Save to Log', $this->text_domain), self::DEBUG_MODE_BOTH => _x('Both', 'Debug mode both show on checkout and log', $this->text_domain))); // 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'; } }