/[drupal]/drupal/modules/trigger/trigger.api.php
ViewVC logotype

Contents of /drupal/modules/trigger/trigger.api.php

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.5 - (show annotations) (download) (as text)
Sat Sep 19 11:07:36 2009 UTC (2 months ago) by dries
Branch: MAIN
CVS Tags: DRUPAL-7-0-UNSTABLE-10, HEAD
Changes since 1.4: +38 -130 lines
File MIME type: text/x-php
- Patch ##525540 by jvandyk, sun, jhodgdon, fago | webchick, TheRec, Dave Reid, brianV, sun.core, cweagans, Dries: gave trigger.module and includes/actions.inc an API overhaul.  Simplified definitions of actions and triggers and removed dependency on the combination of hooks and operations. Triggers now directly map to module hooks.
1 <?php
2 // $Id: trigger.api.php,v 1.4 2009/05/29 19:15:08 dries Exp $
3
4 /**
5 * @file
6 * Hooks provided by the Trigger module.
7 */
8
9 /**
10 * @addtogroup hooks
11 * @{
12 */
13
14 /**
15 * Declares triggers (events) for users to assign actions to.
16 *
17 * This hook is used by the trigger module to create a list of triggers (events)
18 * that users can assign actions to. Your module is responsible for detecting
19 * that the events have occurred, calling trigger_get_assigned_actions() to find
20 * out which actions the user has associated with your trigger, and then calling
21 * actions_do() to fire off the actions.
22 *
23 * @see hook_action_info().
24 *
25 * @return
26 * A nested associative array.
27 * - The outermost key is the name of the module that is defining the triggers.
28 * This will be used to create a local task (tab) in the trigger module's
29 * user interface. A contrib module may supply a trigger for a core module by
30 * giving the core module's name as the key. For example, you could use the
31 * 'node' key to add a node-related trigger.
32 * - Within each module, each individual trigger is keyed by a hook name
33 * describing the particular trigger (this is not visible to the user, but
34 * can be used by your module for identification).
35 * - Each trigger is described by an associative array. Currently, the only
36 * key-value pair is 'label', which contains a translated human-readable
37 * description of the triggering event.
38 * For example, the trigger set for the 'node' module has 'node' as the
39 * outermost key and defines triggers for 'node_insert', 'node_update',
40 * 'node_delete' etc. that fire when a node is saved, updated, etc.
41 */
42 function hook_trigger_info() {
43 return array(
44 'node' => array(
45 'node_presave' => array(
46 'label' => t('When either saving new content or updating existing content'),
47 ),
48 'node_insert' => array(
49 'label' => t('After saving new content'),
50 ),
51 'node_update' => array(
52 'label' => t('After saving updated content'),
53 ),
54 'node_delete' => array(
55 'label' => t('After deleting content'),
56 ),
57 'node_view' => array(
58 'label' => t('When content is viewed by an authenticated user'),
59 ),
60 ),
61 );
62 }
63
64 /**
65 * @} End of "addtogroup hooks".
66 */

  ViewVC Help
Powered by ViewVC 1.1.2