1 system.api.php | hook_action_info() |
Declares information about actions.
Any module can define actions, and then call actions_execute() to make those actions happen in response to events.
An action consists of two parts:
- an action definition (returned by this hook)
- a function which performs the action (which by convention is named MODULE_description-of-function_action)
Return value
An associative array of action descriptions. The keys of the array: are the names of the action functions, and each corresponding value is an associative array with the following key-value pairs:
- 'type': The type of object this action acts upon. Core actions have types 'node', 'user', 'comment', and 'system'.
- 'label': The human-readable name of the action, which should be passed through the t() function for translation.
- 'callback': Optional. A function name that will execute the action if the name of the action differs from the function name.
- 'file': Optional. Relative path to a file from the module's directory that contains the callback function.
See also
action_get_info()
Related topics
File
- core/
modules/ system/ system.api.php, line 3547 - Hooks provided by Backdrop core and the System module.
Code
function hook_action_info() {
return array(
'comment_unpublish_action' => array(
'type' => 'comment',
'label' => t('Unpublish comment'),
'callback' => 'comment_unpublish_action',
),
);
}