automator_api_setup
Filters the API setup configuration before it's initialized by the Automator core.
add_filter( 'automator_api_setup', $callback, 10, 1 );
Description
Filters the API setup array for Uncanny Automator. Developers can modify this array to customize API endpoint configurations, add new settings, or conditionally alter how the API behaves, particularly useful for Pro features and UI integrations. The filter runs when the Automator API is being initialized.
Usage
add_filter( 'automator_api_setup', 'your_function_name', 10, 1 );
Parameters
-
$api_setup(mixed) - This filter allows modification of the data structure that defines the setup for Uncanny Automator's API integrations.
Return Value
The filtered value.
Examples
/**
* Example of how to add custom API setup information for Uncanny Automator.
*
* This filter allows you to add or modify the data that Uncanny Automator
* uses for its API setup. You can use this to register custom actions,
* triggers, or variables that your plugin provides.
*/
add_filter( 'automator_api_setup', function( $api_setup ) {
// Ensure $api_setup is an array, initialize if it's not.
if ( ! is_array( $api_setup ) ) {
$api_setup = array();
}
// Add a custom section for your plugin's integration.
// This could include registration for new recipe items.
if ( ! isset( $api_setup['my_custom_plugin'] ) ) {
$api_setup['my_custom_plugin'] = array();
}
// Example: Registering a custom trigger.
// The structure here depends on what Uncanny Automator expects for triggers.
// Consult Uncanny Automator's documentation for the exact format.
$api_setup['my_custom_plugin']['triggers'] = array(
'my_custom_plugin_new_user_registered' => array(
'name' => __( 'New User Registered', 'my-custom-plugin-textdomain' ),
'description' => __( 'Fires when a new user registers on your site.', 'my-custom-plugin-textdomain' ),
// Other properties like 'options', 'fields', etc. would go here.
),
);
// Example: Registering a custom action.
$api_setup['my_custom_plugin']['actions'] = array(
'my_custom_plugin_send_welcome_email' => array(
'name' => __( 'Send Custom Welcome Email', 'my-custom-plugin-textdomain' ),
'description' => __( 'Sends a personalized welcome email to the user.', 'my-custom-plugin-textdomain' ),
// Other properties like 'options', 'fields', etc. would go here.
),
);
// Return the modified $api_setup array.
return $api_setup;
}, 10, 1 ); // 10 is the priority, 1 is the number of accepted arguments.
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/automator-post-types/uo-recipe/class-recipe-post-utilities.php:714
// UncannyAutomator.recipe.publish
'publish' => array(),
),
);
$api_setup = apply_filters_deprecated( 'uap_api_setup', array( $api_setup ), '3.0', 'automator_api_setup' ); // deprecate
return apply_filters( 'automator_api_setup', $api_setup );
}
/**
* List of Pro features to upsell Automator Pro
*
* @return array
*/
Internal Usage
Found in uncanny-automator-pro/src/core/classes/actions-conditions.php:79:
add_filter( 'automator_api_setup', array( $this, 'send_to_ui' ) );
Found in uncanny-automator-pro/src/core/classes/pro-ui.php:18:
add_filter( 'automator_api_setup', array( $this, 'uap_api_setup' ), 20 );