You are here

function nofitications_digest_event_info in Notifications 5

Same name and namespace in other branches
  1. 6 notifications.cron.inc \nofitications_digest_event_info()
  2. 6.2 notifications.cron.inc \nofitications_digest_event_info()
  3. 6.3 notifications_digest/notifications_digest.module \nofitications_digest_event_info()

Get digest information for an event.

2 calls to nofitications_digest_event_info()
notifications_process_digest_short in ./notifications.cron.inc
Digest multiple events in a single message, short format.
Notifications_Templates_Tests::testNotificationsTemplateAPI in tests/notifications_templates.test
Play with creating, retrieving, deleting a pair subscriptions

File

./notifications.cron.inc, line 483

Code

function nofitications_digest_event_info($event) {
  $info = notifications_event_types($event->type, $event->action);
  if (!empty($info['digest'])) {
    $type = $info['digest'][0];
    $field = $info['digest'][1];

    // Check object and values
    $object = !empty($event->objects[$type]) ? $event->objects[$type] : NULL;
    $value = $object && isset($object->{$field}) ? $object->{$field} : 0;
  }
  else {

    // No digest info for this event /action so we use event and action itselves.
    $type = $event->type;
    $field = $event->action;
    $value = 0;
    $object = NULL;
  }
  return array(
    'type' => $type,
    'field' => $field,
    'value' => $value,
    'object' => $object,
  );
}