gform_stripe_elements_classes

Description

This filter allows classes to be used with Stripe Elements to control the look of the Credit Card field.

For more information about which classes may be applied, check out the classes reference in Stripe’s documentation.

Usage

add_filter( 'gform_stripe_elements_classes', 'your_function_name', 10, 2);

Parameters

  • $cardClasses array

    Array of the current classes applied.

  • $formId int

    The current form id.

Examples

Check out Stripe’s documentation to see what options are available for the classes.

add_filter( 'gform_stripe_elements_classes', 'set_stripe_classes', 10, 2);
function set_stripe_classes( $cardClasses, $formId ){
	$cardClasses = array(
					'base' => 'TestElement',
					'complete' => 'TestComplete',
					'invalid' => 'TestInvalid'
	);
	return $cardClasses;
}

Placement

This code should be placed in the functions.php file of your active theme.

Since

This filter was added in Stripe version 2.6.

Source Code

This filter is located in GFStripe::register_init_scripts() in gravityformsstripe/class-gf-stripe.php.