Filter uncanny-automator

automator_integrations

Filters the array of available integrations before they are displayed to the user for automation setup.

add_filter( 'automator_integrations', $callback, 10, 1 );

Description

Filters the array of available integrations for the Automator plugin. Developers can use this hook to programmatically add, remove, or modify integrations before they are registered and displayed in the plugin's interface. This allows for custom integration management.


Usage

add_filter( 'automator_integrations', 'your_function_name', 10, 1 );

Parameters

$this (mixed)
This parameter contains an array of registered integrations for the plugin.

Return Value

The filtered value.


Examples

/**
 * Example of how to filter the 'automator_integrations' hook.
 * This example demonstrates adding a custom integration to the Automator plugin.
 *
 * @param array $integrations An array of registered integrations.
 * @return array Modified array of integrations.
 */
add_filter( 'automator_integrations', function( $integrations ) {

    // Define a placeholder for our custom integration.
    // In a real scenario, this would be an instance of a class
    // that extends or implements the necessary integration interface/abstract class.
    $custom_integration = [
        'slug'        => 'my_custom_integration',
        'name'        => esc_html__( 'My Custom Integration', 'your-text-domain' ),
        'description' => esc_html__( 'This is a custom integration for demonstration purposes.', 'your-text-domain' ),
        // ... other integration properties like actions, triggers, settings, etc.
    ];

    // Add our custom integration to the existing array.
    $integrations['my_custom_integration'] = $custom_integration;

    return $integrations;
}, 10, 1 );

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/core/lib/class-automator-functions.php:342

public function filter_recipe_parts() {

		$this->integrations = apply_filters_deprecated( 'uap_integrations', array( $this->integrations ), '3.0', 'automator_integrations' );
		$this->integrations = apply_filters( 'automator_integrations', $this->integrations );

		$this->actions = apply_filters_deprecated( 'uap_actions', array( $this->actions ), '3.0', 'automator_actions' );
		$this->actions = apply_filters( 'automator_actions', $this->actions );

		$this->triggers = apply_filters_deprecated( 'uap_triggers', array( $this->triggers ), '3.0', 'automator_triggers' );
		$this->triggers = apply_filters( 'automator_triggers', $this->triggers );

		$this->closures = apply_filters_deprecated( 'uap_closures', array( $this->closures ), '3.0', 'automator_closures' );
		$this->closures = apply_filters( 'automator_closures', $this->closures );

		$this->recipe_items = apply_filters( 'automator_recipe_items', $this->recipe_items );

		$this->all_integrations = apply_filters( 'automator_all_integrations', $this->all_integrations );

		$this->recipe_types = apply_filters_deprecated( 'uap_recipe_types', array( $this->recipe_types ), '3.0', 'automator_recipe_types' );
		$this->recipe_types = apply_filters( 'automator_recipe_types', $this->recipe_types );
	}


Internal Usage

Found in src/core/lib/recipe-parts/abstract-integration.php:109:

add_action( 'automator_integrations', array( $this, 'register_integration' ) );
Scroll to Top