Filter uncanny-automator

automator_integration_data_{$code}

Filters the data for a specific API integration, allowing customization before it's processed.

add_filter( 'automator_integration_data_{$code}', $callback, 10, 2 );

Description

Fires after integration data is fetched for a specific integration code. Developers can use this filter to modify, add, or remove data for an integration, such as its color or other settings. The `$data` parameter contains the integration details, and `$code` is the integration's unique identifier.


Usage

add_filter( 'automator_integration_data_{$code}', 'your_function_name', 10, 2 );

Parameters

$data (mixed)
The `$data` parameter contains the integration data that is being filtered.
$code (mixed)
This parameter contains the integration data that is being filtered.

Return Value

The filtered value.


Examples

/**
 * Example of using the 'automator_integration_data_{$code}' filter to modify integration data.
 * This example specifically targets the 'STRIPE' integration and adds a custom 'custom_fee_percentage'
 * to its data array, which could be used later in the plugin for specific Stripe logic.
 */
add_filter( 'automator_integration_data_STRIPE', function( $data, $code ) {
    // Ensure this filter only applies to the STRIPE integration
    if ( 'STRIPE' === $code ) {
        // Add a custom piece of data to the integration's configuration.
        // This might be used by other parts of the plugin to dynamically adjust fees or other settings.
        $data['custom_fee_percentage'] = 1.5; // Represents a 1.5% custom fee

        // You can also modify existing data if needed.
        // For example, to change the display name:
        // $data['name'] = 'Stripe Payments (Custom)';

        // Always return the modified data array.
        return $data;
    }

    // If the code doesn't match 'STRIPE', return the original data unchanged.
    return $data;
}, 10, 2 );

Placement

This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.


Source Code

src/api/services/integration/class-integration-feed-service.php:240

private function apply_integration_filter( string $code, array $data ): array {
		return apply_filters( "automator_integration_data_{$code}", $data, $code );
	}

Scroll to Top