Filter
uncanny-automator
automator_register_action_integration
Filters available actions for an integration to be registered, allowing modification before registration.
add_filter( 'automator_register_action_integration', $callback, 10, 3 );
Description
Filters the action integration data before it's registered. Developers can use this to modify or extend integration details for actions. This hook is applied after an integration's initial data is prepared, allowing for late-stage adjustments to its registration process.
Usage
add_filter( 'automator_register_action_integration', 'your_function_name', 10, 3 );
Parameters
-
$integration(mixed) - This parameter contains the integration object being registered, which can be modified or replaced.
-
$uap_action(mixed) - This parameter contains the integration object that is being registered.
-
$integration_code(mixed) - This parameter holds the action object for which the integration is being registered.
Return Value
The filtered value.
Examples
<?php
/**
* Example of how to use the 'automator_register_action_integration' filter.
* This filter allows you to modify the integration details before it's registered.
*
* @param mixed $integration The integration object or array being registered.
* @param mixed $uap_action The action object or data associated with the integration.
* @param mixed $integration_code The unique code for the integration.
*
* @return mixed The modified integration data.
*/
add_filter( 'automator_register_action_integration', function ( $integration, $uap_action, $integration_code ) {
// Example: If the integration code is 'my_custom_action',
// we might want to add some extra metadata to the integration.
if ( 'my_custom_action' === $integration_code ) {
// Assuming $integration is an array of integration details.
// If it's an object, you would access properties like $integration->some_property.
if ( is_array( $integration ) ) {
$integration['extra_metadata'] = array(
'description' => 'This is a custom action for demonstration purposes.',
'version' => '1.0.0',
);
} elseif ( is_object( $integration ) ) {
// If it's an object, you might add a public property or a method to set data.
// This is a hypothetical example.
if ( property_exists( $integration, 'extra_metadata' ) ) {
$integration->extra_metadata = array(
'description' => 'This is a custom action for demonstration purposes.',
'version' => '1.0.0',
);
}
}
// You could also conditionally prevent registration based on certain criteria.
// For example, if $uap_action is not set up correctly, you might return null.
// if ( empty( $uap_action ) ) {
// return null;
// }
}
// Always return the modified (or original) integration data.
return $integration;
}, 10, 3 ); // Priority 10, accepts 3 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/lib/utilities/class-automator-registration.php:368
*/
$integration = apply_filters_deprecated(
'uap_register_action_integration',
array( $integration, $uap_action, $integration_code ),
'3.0',
'automator_register_action_integration'
);
$integration = apply_filters( 'automator_register_action_integration', $integration, $uap_action, $integration_code );
//$integrations = Automator()->get_integrations();
// Integration was passed in, lets try to register it
if ( null !== $integration_code ) {
if ( ! is_string( $integration_code ) ) {
throw new Automator_Exception( 'You are trying to register an action without passing an proper integration code.', 1003 );
}