The Trigger API lets a contrib/custom module implement hook_hook_info() (bad name -- see #525540: trigger.module and includes/actions.inc need overhaul), to define what trigger/action "hooks" the module will let the user assign actions to.

The Trigger module then puts up UI screens that let the user assign actions to that trigger/action "hook".

The custom module is then in charge of calling actions_do() in order to make the actions fire off when the module's event happens. However, the only way currently for the module to find out what actions the user has assigned to their trigger/action "hook" in the UI is to call the internal-use function _trigger_get_hook_aids()

The Trigger module needs to have a real API function that modules can call to gather this information. It could probably be this same function, renamed without the underscore to make it official and maybe a better name in general (such as trigger_get_assigned_actions() or something like that), and with more correct documentation on what it is actually returning.

Comments

jhodgdon’s picture

Title: No official Trigger API function to discover triggers » No official Trigger API function to discover assigned actions

Better title

jhodgdon’s picture

Actually, why not just define a function like this:

trigger_do_actions( 'hook', 'op' );

This would tell Trigger that the event has occurred that should fire off all the actions that the site administrator has set up using Trigger module's UI. That would be even simpler.

jhodgdon’s picture

I've just attached a patch to fix this at #525540: trigger.module and includes/actions.inc need overhaul

jhodgdon’s picture

Issue tags: +API change
jhodgdon’s picture

Patch here http://drupal.org/node/525540#comment-1982822 by jvandyk also fixes this issue.

jhodgdon’s picture

Status: Active » Fixed

Issue #525540: trigger.module and includes/actions.inc need overhaul had a patch committed, including an API function to discover assigned actions, so this issue is now fixed.

Status: Fixed » Closed (fixed)
Issue tags: -API change

Automatically closed -- issue fixed for 2 weeks with no activity.