Skip to content

Instantly share code, notes, and snippets.

@kevinchampion
Created July 6, 2012 19:16
Show Gist options
  • Save kevinchampion/3062228 to your computer and use it in GitHub Desktop.
Save kevinchampion/3062228 to your computer and use it in GitHub Desktop.
Drupal create rules event
/**
* 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.')),
),
),
);
}
// 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