Hooks
This page describes the available developer hooks for HeyTodos.
Actions
ActionsHook Pattern: gf_hey_todos_process_{$resource_type}_data
Available Resource Types:
gf_hey_todos_process_projects_datagf_hey_todos_process_sections_datagf_hey_todos_process_labels_datagf_hey_todos_process_collaborators_datagf_hey_todos_process_users_data
Parameters:
$sync_data(array) - The resource data retrieved from the API for the specific resource type
Usage:
// Hook into projects data processing
add_action( 'gf_hey_todos_process_projects_data', 'my_custom_projects_handler' );
function my_custom_projects_handler( $projects_data ) {
// Process projects data
foreach ( $projects_data as $project ) {
// Handle individual project data
}
}
// Hook into labels data processing
add_action( 'gf_hey_todos_process_labels_data', 'my_custom_labels_handler' );
function my_custom_labels_handler( $labels_data ) {
// Process labels data
}gf_hey_todos_task_creation_failed
gf_hey_todos_task_creation_failedDescription: Triggered when a Todoist task can't be completed.
Parameters:
/**
* Trigger an action when task creation fails.
*
* @param string $error The error.
* @param array $feed The feed.
* @param array $entry The entry.
* @param array $form The form.
*/gf_hey_todos_task_creation_succeeded
gf_hey_todos_task_creation_succeededDescription: Triggered when a Todoist task is created.
Parameters:
/**
* Trigger an action when task creation succeeds.
*
* @param array $api_request_body The API request body.
* @param array $feed The feed.
* @param array $entry The entry.
* @param array $form The form.
*/Filters
Filters`gf_hey_todos_process_feed_api_request_body
Description: Filter the API request body before it is sent to the Todoist API.
Parameters:
/**
* Filter the API request body.
*
* @param array $api_request_body The API request body.
* @param array $feed The feed.
* @param array $entry The entry.
* @param array $form The form.
*
* @return array The API request body.
*/Return: Todoist API Request Body
gf_hey_todos_scripts
gf_hey_todos_scriptsDescription: Filters the JavaScript scripts array before they are enqueued in the admin. This uses Gravity Forms script syntax.
Parameters:
$scripts(array) - Array of script configurations
Return: Array of script configurations
Usage:
add_filter( 'gf_hey_todos_scripts', 'my_custom_scripts_filter' );
function my_custom_scripts_filter( $scripts ) {
// Add custom scripts or modify existing ones
$scripts['my_custom_script'] = array(
'handle' => 'my-custom-script',
'src' => plugin_dir_url( __FILE__ ) . 'js/custom.js',
'version' => '1.0.0',
'deps' => array( 'jquery' ),
'in_footer' => true,
);
return $scripts;
}Last updated
Was this helpful?