Action uncanny-automator

automator_add_integration_helpers

Fires when the Automator integration helpers are being added, allowing for modification or addition of integration logic.

add_action( 'automator_add_integration_helpers', $callback, 10, 1 );

Description

Fires after Uncanny Automator core integrations are initialized. Developers can use this action to register custom integration helpers, allowing for dynamic loading and management of integration-specific functionalities within recipes.


Usage

add_action( 'automator_add_integration_helpers', 'your_function_name', 10, 1 );

Examples

/**
 * Example function to register integration helper classes.
 *
 * This function would typically be used to tell Uncanny Automator how to
 * find and load custom helper classes for specific integrations.
 *
 * @since 1.0.0
 */
function my_automator_register_custom_integration_helpers() {
	// Assuming you have a custom helper class named 'My_Custom_Integration_Helper'.
	// This class would extend a base Automator helper class and implement specific logic.
	// The 'register_helper' method would be a hypothetical method within Automator's
	// core that accepts the fully qualified class name of your helper.

	// Example: Load custom helper for a hypothetical "MyPlugin" integration.
	if ( class_exists( 'My_Custom_Integration_Helper' ) ) {
		Uncanny_Automator_API::register_helper( 'My_Custom_Integration_Helper' );
	}

	// You could register multiple helpers here for different integrations.
	// if ( class_exists( 'Another_Custom_Helper' ) ) {
	// 	Uncanny_Automator_API::register_helper( 'Another_Custom_Helper' );
	// }
}

/**
 * Adds our custom integration helper registration to the automator_add_integration_helpers hook.
 *
 * We use a priority of 20 to ensure it runs after core helpers are loaded.
 */
add_action( 'automator_add_integration_helpers', 'my_automator_register_custom_integration_helpers', 20 );

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:293

public function load_helpers() {
		try {
			$this->loader->load_helpers( $this->active_directories, $this->directories_to_include );
		} catch ( Error $e ) {
			throw new Automator_Error( esc_html( $e->getMessage() ) );
		} catch ( Exception $e ) {
			throw new Automator_Exception( esc_html( $e->getMessage() ) );
		}

		// Let others hook in and add options
		do_action_deprecated( 'uncanny_automator_add_integration_helpers', array(), '3.0', 'automator_add_integration_helpers' );
		do_action( 'automator_add_integration_helpers' );
	}


Internal Usage

Found in src/core/lib/helpers/class-automator-recipe-helpers.php:383:

add_action( 'automator_add_integration_helpers', array( $this, 'load_helpers_for_recipes' ) );

Found in uncanny-automator-pro/src/core/includes/internal-triggers-actions.php:99:

add_action( 'automator_add_integration_helpers', array( $this, 'wire_pro_helper_chains' ), 11 );
Scroll to Top