Filter
uncanny-automator
automator_gated_directory_types
Filters the available directory types for automator integrations, allowing customization of options like triggers, actions, and conditions.
add_filter( 'automator_gated_directory_types', $callback, 10, 1 );
Description
This filter hook allows developers to modify the array of directory types considered "gated" by the Automator plugin. It fires when the plugin determines which directory types require specific access controls. Developers can add, remove, or rename these types to customize how Automator manages access to different plugin components.
Usage
add_filter( 'automator_gated_directory_types', 'your_function_name', 10, 1 );
Return Value
The filtered value.
Examples
/**
* Example of how to use the 'automator_gated_directory_types' filter hook.
* This example demonstrates adding a custom directory type to the gated directories,
* for instance, to represent a new type of automation component that should be
* managed or displayed in a specific section of the plugin's interface.
*
* @param array $directory_types The current array of gated directory types.
* @return array The modified array of gated directory types.
*/
function my_custom_automator_gated_directory_types( $directory_types ) {
// Let's assume we have a new type of automation component, for example, 'webhooks'.
// We want to add this to the list of gated directory types.
$custom_type = 'webhooks';
// Add our custom type to the existing array of directory types.
// We'll append it to the end for simplicity.
$directory_types[] = $custom_type;
// It's good practice to ensure uniqueness, although in this simple example,
// it's unlikely to cause issues if the custom type is already present.
// If dealing with potentially dynamic custom types, you might want to check first:
// if ( ! in_array( $custom_type, $directory_types, true ) ) {
// $directory_types[] = $custom_type;
// }
// Return the modified array.
return $directory_types;
}
// Add the filter to WordPress.
// The priority is set to 10 (default) and we accept 1 argument, which is the $directory_types array.
add_filter( 'automator_gated_directory_types', 'my_custom_automator_gated_directory_types', 10, 1 );
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/global-functions.php:152
function automator_get_gated_directory_types() {
return apply_filters(
'automator_gated_directory_types',
array(
'triggers',
'actions',
'closures',
'conditions',
'loop-filters',
)
);
}