Index: trigger_example.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/examples/trigger_example/trigger_example.module,v
retrieving revision 1.4
diff -u -r1.4 trigger_example.module
--- trigger_example/trigger_example.module	7 May 2010 01:53:21 -0000	1.4
+++ trigger_example/trigger_example.module	2 Oct 2010 16:13:22 -0000
@@ -64,6 +64,7 @@
  * @link http://drupal.org/node/199254 Triggers and Actions in Drupal 6 @endlink
  *
  * @see hook_trigger_info()
+ * @see hook_trigger_info_alter()
  */
 
 /**
@@ -279,3 +280,32 @@
     trigger_example_triggersomething();
   }
 }
+
+
+/**
+ * Optional usage of hook_trigger_info_aler()
+ *
+ * This function is not required to write your own triggers, but it may be
+ * useful when you want to alter existing triggers.
+ *
+ */
+
+/**
+ * Implements hook_trigger_info_alter().
+ *
+ * We call hook_trigger_info_alter when we want to chage an existing trigger.
+ * As mentioned earlier, this hook is not required to create your own triggers,
+ * and should only be used when you need to alter current existing triggers. In
+ * this example implementation a little change is done to the existing trigger
+ * provided by core: 'cron'
+ *
+ * @param array $triggers
+ *  Array of trigger information returned by hook_trigger_info() implementations.
+ *
+ * @see hook_trigger_info()
+ */
+function trigger_example_trigger_info_alter(&$triggers) {
+  // Make a simple change to an existing core trigger, altering the label
+  // "When cron runs" to our custom label "On cron execution"
+  $triggers['system']['cron']['label'] = t('On cron execution');
+}
Index: trigger_example.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/examples/trigger_example/trigger_example.test,v
retrieving revision 1.3
diff -u -r1.3 trigger_example.test
--- trigger_example/trigger_example.test	6 May 2010 15:52:24 -0000	1.3
+++ trigger_example/trigger_example.test	2 Oct 2010 16:12:55 -0000
@@ -85,7 +85,7 @@
 //    $this->assertText($action_label, "Found the random message on the page after login.");
   }
 
-  function drupalPost($path, $edit, $submit, array $options = array(), array $headers = array(), $form_html_id = NULL) {
+  protected function drupalPost($path, $edit, $submit, array $options = array(), array $headers = array(), $form_html_id = NULL, $extra_post = NULL) {
     $submit_matches = FALSE;
     $ajax = is_array($submit);
     if (isset($path)) {
@@ -167,4 +167,18 @@
     }
   }
 
+  /**
+   * Test assigning a configurable action to the triggersomething event.
+   */
+  function testTriggerhookinfoalter() {
+    // Create an administrative user.
+    $test_user = $this->drupalCreateUser(array('administer actions'));
+    $this->drupalLogin($test_user);
+
+    $this->drupalGet('admin/structure/trigger/system');
+    // Verify the new 'On cron execution' label of the cron trigger is shown,
+    // Triggers got
+    $this->assertText( strtoupper(t('On cron execution')) , t('The hook_trigger_info_alter() event changed a trigger name.'));
+    $this->assertNoText( strtoupper(t('When cron runs')) , t('The hook_trigger_info_alter() event changed a trigger name.'));
+  }
 }

