function notifications_lite_notifications in Notifications 6.3
Same name and namespace in other branches
- 5 notifications_lite/notifications_lite.module \notifications_lite_notifications()
- 6.4 notifications_lite/notifications_lite.module \notifications_lite_notifications()
- 6 notifications_lite/notifications_lite.module \notifications_lite_notifications()
- 6.2 notifications_lite/notifications_lite.module \notifications_lite_notifications()
Implementation of hook_notifications()
It handles event texts to rebuild the message from stored event parameters
File
- notifications_lite/
notifications_lite.module, line 209 - Simple notifications API
Code
function notifications_lite_notifications($op, &$arg0, $arg1 = NULL, $arg2 = NULL) {
switch ($op) {
case 'event load':
// $arg0 is event
$event =& $arg0;
if ($event->type == 'lite') {
if (!empty($event->params['subject'])) {
$event->text['subject'] = $event->params['subject'];
$event->text['digest'] = $event->params['subject'];
}
if (!empty($event->params['body'])) {
$event->text['main'] = $event->params['body'];
$event->text['digest'] .= ': ' . $event->params['body'];
}
}
break;
case 'event types':
// We just define event type 'lite', action 'default'
$types[] = array(
'type' => 'lite',
'action' => 'default',
'name' => t('Message for [user]'),
'digest' => NULL,
// This means grouping by: event type, event action
'description' => t('Notifications lite message'),
);
return $types;
}
}