Issue #1379126 by chris.leversuch, Albert Volkman, jhodgdon: Clean up API docs for trigger.module.
parent
068f1fb1f3
commit
5251e90c98
|
@ -6,13 +6,16 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds the form that allows users to assign actions to triggers.
|
* Builds a form that allows users to assign actions to triggers.
|
||||||
*
|
*
|
||||||
* @param $module_to_display
|
* @param $module_to_display
|
||||||
* Which tab of triggers to display. E.g., 'node' for all
|
* Which tab of triggers to display. E.g., 'node' for all node-related
|
||||||
* node-related triggers.
|
* triggers.
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
* HTML form.
|
* HTML form.
|
||||||
|
*
|
||||||
|
* @see trigger_menu()
|
||||||
*/
|
*/
|
||||||
function trigger_assign($module_to_display = NULL) {
|
function trigger_assign($module_to_display = NULL) {
|
||||||
// If no type is specified we default to node actions, since they
|
// If no type is specified we default to node actions, since they
|
||||||
|
@ -36,16 +39,18 @@ function trigger_assign($module_to_display = NULL) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Confirm removal of an assigned action.
|
* Form constructor for confirmation page for removal of an assigned action.
|
||||||
*
|
*
|
||||||
* @param $module
|
* @param $module
|
||||||
* The tab of triggers the user will be directed to after successful
|
* The tab of triggers the user will be directed to after successful
|
||||||
* removal of the action, or if the confirmation form is cancelled.
|
* removal of the action, or if the confirmation form is cancelled.
|
||||||
* @param $hook
|
* @param $hook
|
||||||
|
* The name of the trigger hook, e.g., 'node_insert'.
|
||||||
* @param $aid
|
* @param $aid
|
||||||
* The action ID.
|
* The action ID.
|
||||||
* @ingroup forms
|
*
|
||||||
* @see trigger_unassign_submit()
|
* @see trigger_unassign_submit()
|
||||||
|
* @ingroup forms
|
||||||
*/
|
*/
|
||||||
function trigger_unassign($form, $form_state, $module, $hook = NULL, $aid = NULL) {
|
function trigger_unassign($form, $form_state, $module, $hook = NULL, $aid = NULL) {
|
||||||
if (!($hook && $aid)) {
|
if (!($hook && $aid)) {
|
||||||
|
@ -79,7 +84,7 @@ function trigger_unassign($form, $form_state, $module, $hook = NULL, $aid = NULL
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Submit callback for trigger_unassign() form.
|
* Form submission handler for trigger_unassign().
|
||||||
*/
|
*/
|
||||||
function trigger_unassign_submit($form, &$form_state) {
|
function trigger_unassign_submit($form, &$form_state) {
|
||||||
if ($form_state['values']['confirm'] == 1) {
|
if ($form_state['values']['confirm'] == 1) {
|
||||||
|
@ -108,9 +113,9 @@ function trigger_unassign_submit($form, &$form_state) {
|
||||||
* @param $label
|
* @param $label
|
||||||
* A plain English description of what this trigger does.
|
* A plain English description of what this trigger does.
|
||||||
*
|
*
|
||||||
* @ingoup forms
|
|
||||||
* @see trigger_assign_form_validate()
|
* @see trigger_assign_form_validate()
|
||||||
* @see trigger_assign_form_submit()
|
* @see trigger_assign_form_submit()
|
||||||
|
* @ingroup forms
|
||||||
*/
|
*/
|
||||||
function trigger_assign_form($form, $form_state, $module, $hook, $label) {
|
function trigger_assign_form($form, $form_state, $module, $hook, $label) {
|
||||||
$form['module'] = array(
|
$form['module'] = array(
|
||||||
|
@ -197,9 +202,11 @@ function trigger_assign_form($form, $form_state, $module, $hook, $label) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validation function for trigger_assign_form().
|
* Form validation handler for trigger_assign_form().
|
||||||
*
|
*
|
||||||
* Makes sure that the user is not re-assigning an action to an event.
|
* Makes sure that the user is not re-assigning an action to an event.
|
||||||
|
*
|
||||||
|
* @see trigger_assign_form_submit()
|
||||||
*/
|
*/
|
||||||
function trigger_assign_form_validate($form, $form_state) {
|
function trigger_assign_form_validate($form, $form_state) {
|
||||||
$form_values = $form_state['values'];
|
$form_values = $form_state['values'];
|
||||||
|
@ -216,7 +223,9 @@ function trigger_assign_form_validate($form, $form_state) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Submit function for trigger_assign_form().
|
* Form submission handler for trigger_assign_form().
|
||||||
|
*
|
||||||
|
* @see trigger_assign_form_validate()
|
||||||
*/
|
*/
|
||||||
function trigger_assign_form_submit($form, &$form_state) {
|
function trigger_assign_form_submit($form, &$form_state) {
|
||||||
if (!empty($form_state['values']['aid'])) {
|
if (!empty($form_state['values']['aid'])) {
|
||||||
|
@ -306,4 +315,3 @@ function theme_trigger_display($variables) {
|
||||||
}
|
}
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @file
|
||||||
* Enables functions to be stored and executed at a later time when
|
* Enables functions to be stored and executed at a later time.
|
||||||
* triggered by other modules or by one of Drupal's core API hooks.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -158,6 +157,7 @@ function trigger_trigger_info() {
|
||||||
*
|
*
|
||||||
* @param $hook
|
* @param $hook
|
||||||
* The name of the hook being fired.
|
* The name of the hook being fired.
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
* An array whose keys are action IDs that the user has associated with
|
* An array whose keys are action IDs that the user has associated with
|
||||||
* this trigger, and whose values are arrays containing the action type and
|
* this trigger, and whose values are arrays containing the action type and
|
||||||
|
@ -231,8 +231,8 @@ function _trigger_normalize_node_context($type, $node) {
|
||||||
*
|
*
|
||||||
* @param $node
|
* @param $node
|
||||||
* Node object.
|
* Node object.
|
||||||
* @param $op
|
* @param $hook
|
||||||
* Operation to trigger.
|
* Hook to trigger.
|
||||||
* @param $a3
|
* @param $a3
|
||||||
* Additional argument to action function.
|
* Additional argument to action function.
|
||||||
* @param $a4
|
* @param $a4
|
||||||
|
@ -384,8 +384,8 @@ function trigger_comment_view($comment) {
|
||||||
*
|
*
|
||||||
* @param $a1
|
* @param $a1
|
||||||
* Comment object or array of form values.
|
* Comment object or array of form values.
|
||||||
* @param $op
|
* @param $hook
|
||||||
* Operation to trigger.
|
* Hook to trigger.
|
||||||
*/
|
*/
|
||||||
function _trigger_comment($a1, $hook) {
|
function _trigger_comment($a1, $hook) {
|
||||||
// Keep objects for reuse so that changes actions make to objects can persist.
|
// Keep objects for reuse so that changes actions make to objects can persist.
|
||||||
|
@ -442,6 +442,7 @@ function trigger_cron() {
|
||||||
* The type of action that is about to be called.
|
* The type of action that is about to be called.
|
||||||
* @param $account
|
* @param $account
|
||||||
* The account object that was passed via the user hook.
|
* The account object that was passed via the user hook.
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
* The object expected by the action that is about to be called.
|
* The object expected by the action that is about to be called.
|
||||||
*/
|
*/
|
||||||
|
@ -518,6 +519,15 @@ function trigger_user_view($account) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calls action functions for user triggers.
|
* Calls action functions for user triggers.
|
||||||
|
*
|
||||||
|
* @param $hook
|
||||||
|
* The hook that called this function.
|
||||||
|
* @param $edit
|
||||||
|
* Edit variable passed in to the hook or empty array if not needed.
|
||||||
|
* @param $account
|
||||||
|
* Account variable passed in to the hook.
|
||||||
|
* @param $method
|
||||||
|
* Method variable passed in to the hook or NULL if not needed.
|
||||||
*/
|
*/
|
||||||
function _trigger_user($hook, &$edit, $account, $category = NULL) {
|
function _trigger_user($hook, &$edit, $account, $category = NULL) {
|
||||||
// Keep objects for reuse so that changes actions make to objects can persist.
|
// Keep objects for reuse so that changes actions make to objects can persist.
|
||||||
|
@ -596,6 +606,9 @@ function trigger_actions_delete($aid) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves and caches information from hook_trigger_info() implementations.
|
* Retrieves and caches information from hook_trigger_info() implementations.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* Array of all triggers.
|
||||||
*/
|
*/
|
||||||
function _trigger_get_all_info() {
|
function _trigger_get_all_info() {
|
||||||
$triggers = &drupal_static(__FUNCTION__);
|
$triggers = &drupal_static(__FUNCTION__);
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
class TriggerWebTestCase extends DrupalWebTestCase {
|
class TriggerWebTestCase extends DrupalWebTestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configure an advanced action.
|
* Configures an advanced action.
|
||||||
*
|
*
|
||||||
* @param $action
|
* @param $action
|
||||||
* The name of the action callback. For example: 'user_block_user_action'
|
* The name of the action callback. For example: 'user_block_user_action'
|
||||||
|
|
Loading…
Reference in New Issue