Created
July 6, 2012 19:16
-
-
Save kevinchampion/3062228 to your computer and use it in GitHub Desktop.
Drupal create rules event
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Implements hook_rules_event_info(). | |
*/ | |
function lsadataclassify_rules_event_info() { | |
return array( | |
'lsadataclassify_submission_completed' => array( | |
'label' => t('A submission has been completed'), | |
'group' => t('Research Data'), | |
'module' => 'lsadataclassify', | |
'arguments' => array( | |
'submitting_user' => array('type' => 'user', 'label' => t('The user who created the submission.')), | |
'submission' => array('type' => 'node', 'label' => t('The research_data node.')), | |
), | |
), | |
); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Trigger rule indicating the submission has been completed. | |
if (module_exists('rules')) { | |
global $user; | |
$submission = node_load($nid); | |
rules_invoke_event('lsadataclassify_submission_completed', $user, $submission); | |
watchdog('lsadataclassify',t('User @username created the submission nid:!nid', array('@username' => $user->uid . ' - ' . $user->name, '!nid' => $submission->nid))); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment