You are here

function notifications_digest_line in Notifications 5

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

Digest each line, with some caching for performance

1 call to notifications_digest_line()
notifications_process_digest_short in ./notifications.cron.inc
Digest multiple events in a single message, short format.

File

./notifications.cron.inc, line 785

Code

function notifications_digest_line($event, $method) {
  static $digest = array();
  if (!isset($digest[$event->eid][$method])) {

    // The event may have an specific digest line, otherwise use template if present or even information
    if (!empty($event->text['digest'])) {
      $line = $event->text['digest'];
    }
    elseif ($part = notifications_message_part('event', 'digest', $method, $event)) {
      $line = $part;
    }
    else {

      // Get it from event information
      $info = notifications_event_types($event->type, $event->action);
      $line = $info['line'];
    }
    $digest[$event->eid][$method] = $line;
  }
  return $digest[$event->eid][$method];
}