hook_action_info()
contributions/docs/developer/hooks/core.php, line 66
Declare information about one or more Drupal actions.
Any module can define any number of Drupal actions. The trigger module is an example of a module that uses actions. An action consists of two or three parts: (1) an action definition (returned by this hook), (2) a function which does the action (which by convention is named module + '_' + description of what the function does + '_action'), and an optional form definition function that defines a configuration form (which has the name of the action with '_form' appended to it.)
The function that is called when the action is triggered is passed two parameters - an object of the same type as the 'type' value of the hook_actions_info array, and a context variable that contains the context under which the action is currently running, sent as an array. For example, the actions module sets the 'hook' and 'op' keys of the context array (so, 'hook' may be 'nodeapi' and 'op' may be 'insert').
| Name | Description |
|---|---|
| Hooks | Allow modules to interact with the Drupal core. |
function hook_action_info() {
return array(
'comment_unpublish_action' => array(
'description' => t('Unpublish comment'),
'type' => 'comment',
'configurable' => FALSE,
'hooks' => array(
'comment' => array('insert', 'update'),
)
),
'comment_unpublish_by_keyword_action' => array(
'description' => t('Unpublish comment containing keyword(s)'),
'type' => 'comment',
'configurable' => TRUE,
'hooks' => array(
'comment' => array('insert', 'update'),
)
)
);
}