gform_mollie_components_object

Description

Modify Mollie Components object when displaying Mollie Field.

Usage

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

Parameters

  • $args array

    Mollie components object.

  • $form_id int

    Current form ID.

Examples

Modify the card style

add_filter( 'gform_mollie_components_object', 'custom_mollie_components_object', 10, 2 );
function custom_mollie_components_object( $args, $form_id ) {
    // Check the form ID if you want to target specific forms
    if ( $form_id == 1 ) { // Replace 1 with your specific form ID
        // Customize card style, for example
        $args['cardStyle'] = array(
            'base' => array(
                'fontSize' => '16px',
                'color'    => '#32325d',
            ),
            'invalid' => array(
                'color' => '#fa755a',
            ),
        );
        
    }

    return $args;
}

Placement

This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.

See also the PHP section in this article: Where Do I Put This Code?

Since

Added in Mollie 1.0

Source Code

$args = apply_filters( 'gform_mollie_components_object', $args, $form['id'] );

This hook is located in GF_Mollie::register_init_scripts() in class-gf-mollie.php.