array( 'title' => '', 'type' => 'hidden', 'priority' => 10000, 'value' => 'gateways', 'save' => false, ), 'section_gateways' => array( 'title' => __( 'Available 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', 'priority' => 15, ), ); } /** * Add settings for each individual payment gateway. * * @since 1.0.0 * * @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 * @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 * * @return void */ public function render_gateways_table( $args ) { charitable_admin_view( 'settings/gateways', $args ); } } endif;