Action uncanny-automator

automator_add_recipe_type

Fires after a new recipe type is registered, allowing custom modifications before it's added.

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

Description

Fires when Uncanny Automator is initializing and preparing to load recipe types. Developers can use this hook to register custom recipe types programmatically, allowing them to extend Uncanny Automator's functionality with their own unique automation workflows.


Usage

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

Examples

add_action( 'automator_add_recipe_type', 'my_custom_automator_recipe_type', 10, 0 );

/**
 * Registers a custom recipe type for Uncanny Automator.
 *
 * This function is hooked into the 'automator_add_recipe_type' action hook.
 * It demonstrates how to register a new type of recipe that can be used within
 * Uncanny Automator. In a real-world scenario, this would involve defining
 * the properties of the new recipe type, such as its name, description,
 * and potentially default triggers or actions.
 *
 * @since 1.0.0
 */
function my_custom_automator_recipe_type() {
	// In a real implementation, you would define and register your custom recipe type here.
	// This might involve calling a specific Uncanny Automator class or function
	// to add your recipe type to the available options.

	// For demonstration purposes, let's assume there's a method or class
	// within Uncanny Automator that allows registering new recipe types.
	// Replace 'UncannyAutomatorRecipeTypesMyCustomRecipeType' with the actual
	// class that defines your recipe type.

	// Example:
	// $recipe_type_manager = UncannyAutomator()->get_recipe_type_manager();
	// $recipe_type_manager->register_recipe_type( new UncannyAutomatorRecipeTypesMyCustomRecipeType() );

	// For this example, we'll just log a message to show the hook is being fired.
	error_log( 'my_custom_automator_recipe_type hook fired. Custom recipe type registration would happen here.' );
}

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

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/classes/class-add-user-recipe-type.php:15:

add_action( 'automator_add_recipe_type', array( $this, 'add_user_type_recipe' ) );

Found in src/core/anon/class-add-anon-recipe-type.php:16:

add_action( 'automator_add_recipe_type', array( $this, 'add_anon_type_recipe' ) );
Scroll to Top