trigger_trigger_info()Implements hook_trigger_info().
Defines all the triggers that this module implements triggers for.
modules/trigger/trigger.module, line 94
<?php
function trigger_trigger_info() {
return array(
'node' => array(
'node_presave' => array(
'label' => t('When either saving new content or updating existing content'),
),
'node_insert' => array(
'label' => t('After saving new content'),
),
'node_update' => array(
'label' => t('After saving updated content'),
),
'node_delete' => array(
'label' => t('After deleting content'),
),
'node_view' => array(
'label' => t('When content is viewed by an authenticated user'),
),
),
'comment' => array(
'comment_presave' => array(
'label' => t('When either saving a new comment or updating an existing comment'),
),
'comment_insert' => array(
'label' => t('After saving a new comment'),
),
'comment_update' => array(
'label' => t('After saving an updated comment'),
),
'comment_delete' => array(
'label' => t('After deleting a comment'),
),
'comment_view' => array(
'label' => t('When a comment is being viewed by an authenticated user'),
),
),
'taxonomy' => array(
'taxonomy_term_insert' => array(
'label' => t('After saving a new term to the database'),
),
'taxonomy_term_update' => array(
'label' => t('After saving an updated term to the database'),
),
'taxonomy_term_delete' => array(
'label' => t('After deleting a term'),
),
),
'system' => array(
'cron' => array(
'label' => t('When cron runs'),
),
),
'user' => array(
'user_presave' => array(
'label' => t('When either creating a new user account or updating an existing'),
),
'user_insert' => array(
'label' => t('After creating a new user account'),
),
'user_update' => array(
'label' => t('After updating a user account'),
),
'user_delete' => array(
'label' => t('After a user has been deleted'),
),
'user_login' => array(
'label' => t('After a user has logged in'),
),
'user_logout' => array(
'label' => t('After a user has logged out'),
),
'user_view' => array(
'label' => t("When a user's profile is being viewed"),
),
),
);
}
/**
* Gets the action IDs of actions to be executed for a hook.
*
* @param $hook
* The name of the hook being fired.
* @return
* An array whose keys are action IDs that the user has associated with
* this trigger, and whose values are arrays containing the action type and
* label.
*/
function trigger_get_assigned_actions($hook) {
return db_query("SELECT ta.aid, a.type, a.label FROM {trigger_assignments} ta LEFT JOIN {actions} a ON ta.aid = a.aid WHERE ta.hook = :hook ORDER BY ta.weight", array(
':hook' => $hook,
))->fetchAllAssoc( 'aid', PDO::FETCH_ASSOC);
}
?>