automator_add_integration
Fires when a new integration is added to the Automator core, allowing for custom integration actions.
add_action( 'automator_add_integration', $callback, 10, 1 );
Description
Fires after Uncanny Automator core setup is complete. Developers can use this action to register custom integrations or modify existing ones before they are loaded. This hook is essential for extending Automator's functionality with third-party services.
Usage
add_action( 'automator_add_integration', 'your_function_name', 10, 1 );
Examples
// Register a new integration with Uncanny Automator.
// This hook is designed for plugins and themes to add their own integrations
// to Uncanny Automator, allowing users to connect their services.
add_action( 'automator_add_integration', function() {
// Assuming you have a class named 'My_Custom_Integration' that handles the integration logic.
// This class should extend a base integration class provided by Uncanny Automator
// and implement the necessary methods for triggers, actions, and data mapping.
if ( class_exists( 'My_Custom_Integration' ) ) {
// Instantiate your integration class and register it.
// The 'register_integration' method is a hypothetical method that your integration
// class would implement to provide details about the integration to Uncanny Automator.
// This might include defining triggers, actions, and any associated settings.
$my_integration = new My_Custom_Integration();
$my_integration->register_integration();
} else {
// Log an error or display a notice if the integration class is not found.
error_log( 'My_Custom_Integration class not found. Please ensure the plugin is activated.' );
}
}, 20 ); // Using a priority of 20 to ensure it runs after core integrations.
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/classes/class-initialize-automator.php:146
public function automator_configuration_complete_func() {
//Let others hook in and add integrations
do_action_deprecated( 'uncanny_automator_add_integration', array(), '3.0', 'automator_add_integration' );
do_action( 'automator_add_integration' );
// Pro/addons may have hooked automator_item_map during automator_add_integration.
// Invalidate the early-cached item map so load_recipe_parts() picks up the merged map.
Recipe_Manifest::get_instance()->invalidate_item_map();
// Phase 3: Register legacy integrations.
try {
$this->initialize_add_integrations();
} catch ( Error $e ) {
throw new Automator_Error( esc_html( $e->getMessage() ) );
} catch ( Exception $e ) {
throw new Automator_Exception( esc_html( $e->getMessage() ) );
}
// Pro hooks here to merge its data into active_directories and directories_to_include.
do_action( 'automator_after_add_integrations', $this );
//Let others hook in to the directories and add their integration's actions / triggers etc
self::$auto_loaded_directories = apply_filters_deprecated( 'uncanny_automator_integration_directory', array( self::$auto_loaded_directories ), '3.0', 'automator_integration_directory' );
self::$auto_loaded_directories = apply_filters( 'automator_integration_directory', self::$auto_loaded_directories );
//Let others hook in and add integrations
do_action_deprecated( 'uncanny_automator_add_recipe_type', array(), '3.0', 'automator_add_recipe_type' );
do_action( 'automator_add_recipe_type' );
// Phase 4: Load helpers.
$this->load_helpers();
// Phase 5: Load recipe parts (triggers, actions, closures, conditions, loop-filters, tokens).
// Deferred to a later init priority for 6.7 translation fix with trigger engine.
add_action( 'init', array( $this, 'load_recipe_parts' ), AUTOMATOR_RECIPE_PARTS_PRIORITY_TRIGGER_ENGINE );
}
Internal Usage
Found in src/core/integration-loader/class-addon-registry.php:45:
* add_action( 'automator_add_integration', function() {
Found in uncanny-automator-pro/src/integrations/mailpoet/add-mailpoet-integration.php:26:
add_action( 'automator_add_integration', array( $this, 'add_integration_func' ) );
Found in uncanny-automator-pro/src/core/includes/internal-triggers-actions.php:84:
add_action( 'automator_add_integration', array( $this, 'register_via_addon_loader' ), 11 );
Found in uncanny-automator-pro/src/core/includes/internal-triggers-actions.php:88:
add_action( 'automator_add_integration', array( $this, 'init' ), 11 );
Found in uncanny-automator-pro/src/integrations/wishlist-member/add-wm-integration.php:25:
add_action( 'automator_add_integration', array( $this, 'add_integration_func' ) );