gform_ppcp_card_style

Description

The gform_ppcp_card_style filter can be used to customize the appearance of the credit card inputs for the PayPal Field which is available with the PayPal Checkout Add-On.

Usage

The following would apply to all forms:

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

Parameters

  • $card_style array

    An array of styles. See the PayPal API documentation for details about supported properties.

    The default styles array is defined like so:

    array(
    	'input'  => array(
    		'font-size' => '1em',
    	),
    	':focus' => array(
    		'color' => 'black',
    	),
    );
        

  • $form_id int

    The ID of the form containing the PayPal Field being prepared for display.

Example

This example shows how you can change the font size.

add_filter( 'gform_ppcp_card_style', 'ppcp_card_style_font_size', 10, 2 );
function ppcp_card_style_font_size( $card_style, $form_id ) {
	$card_style['input']['font-size'] = '1.5em';
	return $card_style;
}

Placement

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

Source Code

$args['cardStyle'] = apply_filters( 'gform_ppcp_card_style', $card_style, $form['id'] );

This filter is located in GF_PPCP::register_init_scripts() in class-gf-ppcp.php.