Filter
uncanny-automator
automator_all_integrations
Filters all integrations before they are processed, allowing for modification of the integration list.
add_filter( 'automator_all_integrations', $callback, 10, 1 );
Description
Filters all available integrations used by the plugin. Developers can use this hook to add, remove, or modify integrations before they are loaded and displayed to users, allowing for custom integration management.
Usage
add_filter( 'automator_all_integrations', 'your_function_name', 10, 1 );
Parameters
-
$this(mixed) - This parameter contains an array of all available integrations for the plugin.
Return Value
The filtered value.
Examples
<?php
/**
* Adds a new integration to the list of all available integrations.
*
* This function hooks into the 'automator_all_integrations' filter to dynamically
* add a custom integration definition. It assumes that $this refers to an object
* that has a property named 'all_integrations' which is an array, and that
* you are defining a new integration with a specific structure.
*
* @param array $all_integrations An array containing all existing integrations.
*
* @return array The modified array of integrations, including the new one.
*/
add_filter( 'automator_all_integrations', function ( $all_integrations ) {
// Define the new integration.
// This structure is hypothetical and depends on how your plugin defines integrations.
$new_integration = array(
'slug' => 'my_custom_integration',
'name' => __( 'My Custom Integration', 'your-text-domain' ),
'description' => __( 'Connects to your custom service or platform.', 'your-text-domain' ),
'icon' => 'path/to/your/icon.png', // Path to an icon for the integration.
'settings' => 'my_custom_integration_settings_page', // A callback or slug for settings.
'auth' => 'my_custom_integration_authentication', // Authentication method.
'providers' => array(
'my_custom_provider_trigger' => array(
'name' => __( 'My Custom Trigger', 'your-text-domain' ),
'callback' => 'My_Custom_Integration_Triggers::my_custom_trigger_callback',
'description' => __( 'Fires when something happens in your custom service.', 'your-text-domain' ),
),
'my_custom_provider_action' => array(
'name' => __( 'My Custom Action', 'your-text-domain' ),
'callback' => 'My_Custom_Integration_Actions::my_custom_action_callback',
'description' => __( 'Performs an action in your custom service.', 'your-text-domain' ),
),
),
);
// Add the new integration to the existing array.
$all_integrations['my_custom_integration'] = $new_integration;
// Return the updated array of integrations.
return $all_integrations;
}, 10, 1 ); // Priority 10, accepts 1 argument.
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:355
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 );
}