You are here

function notifications_lite_notifications in Notifications 6

Same name and namespace in other branches
  1. 5 notifications_lite/notifications_lite.module \notifications_lite_notifications()
  2. 6.4 notifications_lite/notifications_lite.module \notifications_lite_notifications()
  3. 6.2 notifications_lite/notifications_lite.module \notifications_lite_notifications()
  4. 6.3 notifications_lite/notifications_lite.module \notifications_lite_notifications()

Implementation of hook_notifications()

It handles event texts

File

notifications_lite/notifications_lite.module, line 109
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'];
        }
      }
      break;

    // By queueing the event here we gain access to some features, like immediate sending
    case 'event queued':

      // $event is arg0
      $event =& $arg0;
      if ($event->type == 'lite') {
        notifications_lite_queue_event($event);
      }
      break;
  }
}