array( 'title' => '', 'type' => 'hidden', 'priority' => 10000, 'value' => 'gateways', 'save' => false, ), 'section_gateways' => array( 'title' => __( 'Payment Gateways', 'charitable' ), 'type' => 'heading', 'priority' => 5, ), 'gateways' => array( 'title' => false, 'callback' => array( $this, 'render_gateways_table' ), 'priority' => 10, ), 'test_mode' => array( 'title' => __( 'Turn on Test Mode', 'charitable' ), 'type' => 'checkbox', 'help' => __( 'When test mode is on, donations are routed to each gateway\'s sandbox/test credentials instead of live, no real charges are made, and the donation form displays a "Test Mode" banner. Use this to verify your setup end-to-end before accepting real donations. Turn off when you\'re ready to go live.', 'charitable' ), 'priority' => 15, 'class' => 'charitable-test-mode-checkbox', ), 'additional_gateways' => array( 'type' => 'content', 'content' => '
' . esc_html__( 'View Additional Payment Gateways', 'charitable' ) . '
', 'priority' => 20, ), ); } /** * Add settings for each individual payment gateway. * * @since 1.0.0 * * @param array $fields The existing fields. * @return array */ public function add_individual_gateway_fields( $fields ) { foreach ( charitable_get_helper( 'gateways' )->get_active_gateways() as $gateway ) { if ( ! class_exists( $gateway ) ) { continue; } $gateway = new $gateway(); $fields[ 'gateways_' . $gateway->get_gateway_id() ] = apply_filters( 'charitable_settings_fields_gateways_gateway', array(), $gateway ); } return $fields; } /** * Add gateway keys to the settings groups. * * @since 1.0.0 * * @param string[] $groups The existing groups. * @return string[] */ public function add_gateway_settings_dynamic_groups( $groups ) { foreach ( charitable_get_helper( 'gateways' )->get_active_gateways() as $gateway_key => $gateway ) { if ( ! class_exists( $gateway ) ) { continue; } $groups[ 'gateways_' . $gateway_key ] = apply_filters( 'charitable_gateway_settings_fields_gateways_gateway', array(), new $gateway() ); } return $groups; } /** * Display table with available payment gateways. * * @since 1.0.0 * * @param array $args The arguments. * @return void */ public function render_gateways_table( $args ) { charitable_admin_view( 'settings/gateways', $args ); } } endif;